mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
72ace35626
--HG-- rename : browser/components/thumbnails/BrowserPageThumbs.manifest => toolkit/components/thumbnails/BrowserPageThumbs.manifest rename : browser/components/thumbnails/Makefile.in => toolkit/components/thumbnails/Makefile.in rename : browser/components/thumbnails/PageThumbs.jsm => toolkit/components/thumbnails/PageThumbs.jsm rename : browser/components/thumbnails/PageThumbsProtocol.js => toolkit/components/thumbnails/PageThumbsProtocol.js rename : browser/components/thumbnails/PageThumbsWorker.js => toolkit/components/thumbnails/PageThumbsWorker.js rename : browser/components/thumbnails/test/Makefile.in => toolkit/components/thumbnails/test/Makefile.in rename : browser/components/thumbnails/test/background_red.html => toolkit/components/thumbnails/test/background_red.html rename : browser/components/thumbnails/test/background_red_redirect.sjs => toolkit/components/thumbnails/test/background_red_redirect.sjs rename : browser/components/thumbnails/test/browser_thumbnails_bug726727.js => toolkit/components/thumbnails/test/browser_thumbnails_bug726727.js rename : browser/components/thumbnails/test/browser_thumbnails_capture.js => toolkit/components/thumbnails/test/browser_thumbnails_capture.js rename : browser/components/thumbnails/test/browser_thumbnails_expiration.js => toolkit/components/thumbnails/test/browser_thumbnails_expiration.js rename : browser/components/thumbnails/test/browser_thumbnails_privacy.js => toolkit/components/thumbnails/test/browser_thumbnails_privacy.js rename : browser/components/thumbnails/test/browser_thumbnails_redirect.js => toolkit/components/thumbnails/test/browser_thumbnails_redirect.js rename : browser/components/thumbnails/test/browser_thumbnails_storage.js => toolkit/components/thumbnails/test/browser_thumbnails_storage.js rename : browser/components/thumbnails/test/browser_thumbnails_storage_migrate3.js => toolkit/components/thumbnails/test/browser_thumbnails_storage_migrate3.js rename : browser/components/thumbnails/test/head.js => toolkit/components/thumbnails/test/head.js rename : browser/components/thumbnails/test/privacy_cache_control.sjs => toolkit/components/thumbnails/test/privacy_cache_control.sjs
67 lines
2.3 KiB
JavaScript
67 lines
2.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
const PREF_DISK_CACHE_SSL = "browser.cache.disk_cache_ssl";
|
|
const URL = "://example.com/browser/toolkit/components/thumbnails/" +
|
|
"test/privacy_cache_control.sjs";
|
|
|
|
function runTests() {
|
|
registerCleanupFunction(function () {
|
|
Services.prefs.clearUserPref(PREF_DISK_CACHE_SSL);
|
|
});
|
|
|
|
let positive = [
|
|
// A normal HTTP page without any Cache-Control header.
|
|
{scheme: "http", cacheControl: null, diskCacheSSL: false},
|
|
|
|
// A normal HTTP page with 'Cache-Control: private'.
|
|
{scheme: "http", cacheControl: "private", diskCacheSSL: false},
|
|
|
|
// Capture HTTPS pages if browser.cache.disk_cache_ssl == true.
|
|
{scheme: "https", cacheControl: null, diskCacheSSL: true},
|
|
{scheme: "https", cacheControl: "public", diskCacheSSL: true},
|
|
{scheme: "https", cacheControl: "private", diskCacheSSL: true}
|
|
];
|
|
|
|
let negative = [
|
|
// Never capture pages with 'Cache-Control: no-store'.
|
|
{scheme: "http", cacheControl: "no-store", diskCacheSSL: false},
|
|
{scheme: "http", cacheControl: "no-store", diskCacheSSL: true},
|
|
{scheme: "https", cacheControl: "no-store", diskCacheSSL: false},
|
|
{scheme: "https", cacheControl: "no-store", diskCacheSSL: true},
|
|
|
|
// Don't capture HTTPS pages by default.
|
|
{scheme: "https", cacheControl: null, diskCacheSSL: false},
|
|
{scheme: "https", cacheControl: "public", diskCacheSSL: false},
|
|
{scheme: "https", cacheControl: "private", diskCacheSSL: false}
|
|
];
|
|
|
|
yield checkCombinations(positive, true);
|
|
yield checkCombinations(negative, false);
|
|
}
|
|
|
|
function checkCombinations(aCombinations, aResult) {
|
|
let combi = aCombinations.shift();
|
|
if (!combi) {
|
|
next();
|
|
return;
|
|
}
|
|
|
|
let url = combi.scheme + URL;
|
|
if (combi.cacheControl)
|
|
url += "?" + combi.cacheControl;
|
|
Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, combi.diskCacheSSL);
|
|
|
|
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
|
|
let browser = gBrowser.selectedBrowser;
|
|
|
|
whenLoaded(browser, function () {
|
|
let msg = JSON.stringify(combi) + " == " + aResult;
|
|
is(gBrowserThumbnails._shouldCapture(browser), aResult, msg);
|
|
gBrowser.removeTab(tab);
|
|
|
|
// Continue with the next combination.
|
|
checkCombinations(aCombinations, aResult);
|
|
});
|
|
}
|