зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1237782 - Remove http override and add appcache pref r=baku
Differential Revision: https://phabricator.services.mozilla.com/D44472 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
89fcae5179
Коммит
bd229a5c73
|
@ -7,7 +7,6 @@
|
|||
|
||||
[DEFAULT]
|
||||
prefs =
|
||||
browser.cache.offline.insecure.enable=true
|
||||
plugin.load_flash_only=false # for plugin usage in browser_tab_dragdrop.js
|
||||
support-files =
|
||||
alltabslistener.html
|
||||
|
@ -303,10 +302,12 @@ tags = clipboard
|
|||
[browser_new_http_window_opened_from_file_tab.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_offlineQuotaNotification.js]
|
||||
scheme = https
|
||||
support-files = offlineQuotaNotification.cacheManifest offlineQuotaNotification.html
|
||||
skip-if = true # Bug 1579444
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_gZipOfflineChild.js]
|
||||
scheme = https
|
||||
skip-if = true # Bug 1579444
|
||||
support-files = test_offline_gzip.html gZipOfflineChild.cacheManifest gZipOfflineChild.cacheManifest^headers^ gZipOfflineChild.html gZipOfflineChild.html^headers^
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
const URL =
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/general/test_offline_gzip.html";
|
||||
"https://example.com/browser/browser/base/content/test/general/test_offline_gzip.html";
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
// Clean up after ourself
|
||||
|
@ -14,6 +14,9 @@ registerCleanupFunction(function() {
|
|||
{}
|
||||
);
|
||||
Services.perms.removeFromPrincipal(principal, "offline-app");
|
||||
Services.prefs.clearUserPref("offline-apps.allow_by_default");
|
||||
Services.prefs.clearUserPref("browser.cache.offline.enable");
|
||||
Services.prefs.clearUserPref("browser.cache.offline.storage.enable");
|
||||
});
|
||||
|
||||
//
|
||||
|
@ -82,6 +85,10 @@ function contentTask() {
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
Services.prefs.setBoolPref("offline-apps.allow_by_default", true);
|
||||
Services.prefs.setBoolPref("browser.cache.offline.enable", true);
|
||||
Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
|
||||
// Open a new tab.
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, URL);
|
||||
registerCleanupFunction(() => gBrowser.removeCurrentTab());
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// else the test runner gets in the way of notifications due to bug 857897.
|
||||
|
||||
const URL =
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/general/offlineQuotaNotification.html";
|
||||
"https://example.com/browser/browser/base/content/test/general/offlineQuotaNotification.html";
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
// Clean up after ourself
|
||||
|
@ -18,6 +18,9 @@ registerCleanupFunction(function() {
|
|||
);
|
||||
Services.perms.removeFromPrincipal(principal, "offline-app");
|
||||
Services.prefs.clearUserPref("offline-apps.quota.warn");
|
||||
Services.prefs.clearUserPref("offline-apps.quota.warn");
|
||||
Services.prefs.clearUserPref("browser.cache.offline.enable");
|
||||
Services.prefs.clearUserPref("browser.cache.offline.storage.enable");
|
||||
let { OfflineAppCacheHelper } = ChromeUtils.import(
|
||||
"resource://gre/modules/offlineAppCache.jsm"
|
||||
);
|
||||
|
@ -42,6 +45,9 @@ function checkInContentPreferences(win) {
|
|||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
Services.prefs.setBoolPref("browser.cache.offline.enable", true);
|
||||
Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
Services.prefs.setBoolPref("offline-apps.allow_by_default", false);
|
||||
let notificationShown = promiseNotification();
|
||||
|
||||
// Open a new tab.
|
||||
|
|
|
@ -490,6 +490,8 @@ add_task(async function test_form_entries() {
|
|||
|
||||
// Test for offline cache deletion
|
||||
add_task(async function test_offline_cache() {
|
||||
Services.prefs.setBoolPref("browser.cache.offline.enable", true);
|
||||
Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
// Prepare stuff, we will work with www.example.com
|
||||
var URL = "http://www.example.com";
|
||||
var URI = makeURI(URL);
|
||||
|
@ -568,6 +570,8 @@ add_task(async function test_offline_cache() {
|
|||
cacheListener
|
||||
);
|
||||
await wh.promiseClosed;
|
||||
Services.prefs.clearUserPref("browser.cache.offline.enable");
|
||||
Services.prefs.clearUserPref("browser.cache.offline.storage.enable");
|
||||
});
|
||||
|
||||
// Test for offline apps permission deletion
|
||||
|
|
|
@ -2936,8 +2936,7 @@ bool nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx,
|
|||
/* static */
|
||||
bool nsGlobalWindowInner::OfflineCacheAllowedForContext(JSContext* aCx,
|
||||
JSObject* aObj) {
|
||||
return IsSecureContextOrObjectIsFromSecureContext(aCx, aObj) ||
|
||||
Preferences::GetBool("browser.cache.offline.insecure.enable");
|
||||
return IsSecureContextOrObjectIsFromSecureContext(aCx, aObj);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -2,132 +2,12 @@ const PATH =
|
|||
"http://example.com/browser/dom/tests/mochitest/ajax/offline/";
|
||||
const URL = PATH + "file_simpleManifest.html";
|
||||
const MANIFEST = PATH + "file_simpleManifest.cacheManifest";
|
||||
const PREF_INSECURE_APPCACHE = "browser.cache.offline.insecure.enable";
|
||||
const PREF_NETWORK_PROXY = "network.proxy.type";
|
||||
|
||||
function setSJSState(sjsPath, stateQuery) {
|
||||
let client = new XMLHttpRequest();
|
||||
client.open("GET", sjsPath + "?state=" + stateQuery, false);
|
||||
let appcachechannel = SpecialPowers.wrap(client).channel.QueryInterface(Ci.nsIApplicationCacheChannel);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
client.addEventListener("load", resolve);
|
||||
client.addEventListener("error", reject);
|
||||
|
||||
appcachechannel.chooseApplicationCache = false;
|
||||
appcachechannel.inheritApplicationCache = false;
|
||||
appcachechannel.applicationCache = null;
|
||||
|
||||
client.send();
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
/* This test loads "evil" content and verified it isn't loaded when appcache is disabled, which emulates loading stale cache from an untrusted network:
|
||||
- Sets frame to load "evil" content
|
||||
- Loads HTML file which also loads and caches content into AppCache
|
||||
- Sets frame to load "good"
|
||||
- Check we still have "evil" content from AppCache
|
||||
- Disables appcache
|
||||
- Check content is "good"
|
||||
*/
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, true]
|
||||
]
|
||||
});
|
||||
await setSJSState(PATH + "file_testFile.sjs", "evil");
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
|
||||
let windowPromise = new Promise((resolve, reject) => {
|
||||
function init() {
|
||||
if (content.document.readyState == "complete") {
|
||||
const frame = content.document.getElementById("childframe");
|
||||
const state = frame.contentDocument.getElementById("state");
|
||||
is(state.textContent, "evil", "Loaded evil content");
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
content.document.onreadystatechange = init;
|
||||
init();
|
||||
});
|
||||
let appcachePromise = new Promise((resolve, reject) => {
|
||||
function appcacheInit() {
|
||||
if (content.applicationCache.status === content.applicationCache.IDLE) {
|
||||
ok(true, "Application cache loaded");
|
||||
resolve();
|
||||
} else {
|
||||
info("State was: " + content.applicationCache.status);
|
||||
}
|
||||
}
|
||||
content.applicationCache.oncached = appcacheInit;
|
||||
content.applicationCache.onnoupdate = appcacheInit;
|
||||
content.applicationCache.onerror = () => {
|
||||
ok(false, "Application cache failed");
|
||||
reject();
|
||||
};
|
||||
appcacheInit();
|
||||
});
|
||||
await Promise.all([windowPromise, appcachePromise]);
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
// Turn network and proxy off so we can check the content loads still
|
||||
await setSJSState(PATH + "file_testFile.sjs", "good");
|
||||
Services.cache2.clear();
|
||||
|
||||
// Check we still have the "evil" content despite the state change
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
|
||||
const frame = content.document.getElementById("childframe");
|
||||
const state = frame.contentDocument.getElementById("state");
|
||||
is(state.textContent, "evil", "Loaded evil content from cache");
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, false]
|
||||
]
|
||||
});
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
|
||||
// Check that the "good" content is back now appcache is disabled
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, [URL], async (URL) => {
|
||||
const frame = content.document.getElementById("childframe");
|
||||
const state = frame.contentDocument.getElementById("state");
|
||||
is(state.textContent, "good", "Loaded good content");
|
||||
// Eval is needed to execure in child context.
|
||||
content.window.eval("OfflineTest.clear()");
|
||||
});
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
await setSJSState(PATH + "file_testFile.sjs", "");
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_pref_removes_api() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, true]
|
||||
]
|
||||
});
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
|
||||
// Have to use in page checking as IsSecureContextOrObjectIsFromSecureContext is true for spawn()
|
||||
is(content.document.getElementById("hasAppcache").textContent, "yes", "Appcache is enabled");
|
||||
is(content.document.getElementById("hasOfflineResourceList").textContent, "yes", "OfflineResourceList is enabled");
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, false]
|
||||
]
|
||||
});
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, [URL], async (URL) => {
|
||||
// Have to use in page checking as IsSecureContextOrObjectIsFromSecureContext is true for spawn()
|
||||
is(content.document.getElementById("hasAppcache").textContent, "no", "Appcache is disabled");
|
||||
is(content.document.getElementById("hasOfflineResourceList").textContent, "no", "OfflineResourceList is disabled");
|
||||
content.window.eval("OfflineTest.clear()");
|
||||
|
|
|
@ -651,6 +651,15 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
- name: browser.cache.offline.storage.enable
|
||||
type: bool
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
value: false
|
||||
#else
|
||||
value: true
|
||||
#endif
|
||||
mirror: always
|
||||
|
||||
- name: browser.cache.disk.enable
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
|
|
|
@ -221,9 +221,6 @@ pref("browser.cache.check_doc_frequency", 3);
|
|||
// The half life used to re-compute cache entries frecency in hours.
|
||||
pref("browser.cache.frecency_half_life_hours", 6);
|
||||
|
||||
// AppCache over insecure connection is disabled by default
|
||||
pref("browser.cache.offline.insecure.enable", false);
|
||||
|
||||
// offline cache capacity in kilobytes
|
||||
pref("browser.cache.offline.capacity", 512000);
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ using namespace mozilla::net;
|
|||
* nsCacheProfilePrefObserver
|
||||
*****************************************************************************/
|
||||
#define OFFLINE_CACHE_ENABLE_PREF "browser.cache.offline.enable"
|
||||
#define OFFLINE_CACHE_STORAGE_ENABLE_PREF "browser.cache.offline.storage.enable"
|
||||
#define OFFLINE_CACHE_DIR_PREF "browser.cache.offline.parent_directory"
|
||||
#define OFFLINE_CACHE_CAPACITY_PREF "browser.cache.offline.capacity"
|
||||
#define OFFLINE_CACHE_CAPACITY 512000
|
||||
|
@ -63,6 +64,7 @@ static const char* observerList[] = {
|
|||
|
||||
static const char* prefList[] = {
|
||||
OFFLINE_CACHE_ENABLE_PREF,
|
||||
OFFLINE_CACHE_STORAGE_ENABLE_PREF,
|
||||
OFFLINE_CACHE_CAPACITY_PREF,
|
||||
OFFLINE_CACHE_DIR_PREF,
|
||||
nullptr,
|
||||
|
@ -78,6 +80,7 @@ class nsCacheProfilePrefObserver : public nsIObserver {
|
|||
nsCacheProfilePrefObserver()
|
||||
: mHaveProfile(false),
|
||||
mOfflineCacheEnabled(false),
|
||||
mOfflineStorageCacheEnabled(false),
|
||||
mOfflineCacheCapacity(0),
|
||||
mCacheCompressionLevel(CACHE_COMPRESSION_LEVEL),
|
||||
mSanitizeOnShutdown(false),
|
||||
|
@ -109,6 +112,7 @@ class nsCacheProfilePrefObserver : public nsIObserver {
|
|||
nsCOMPtr<nsIFile> mDiskCacheParentDirectory;
|
||||
|
||||
bool mOfflineCacheEnabled;
|
||||
bool mOfflineStorageCacheEnabled;
|
||||
int32_t mOfflineCacheCapacity; // in kilobytes
|
||||
nsCOMPtr<nsIFile> mOfflineCacheParentDirectory;
|
||||
|
||||
|
@ -237,9 +241,17 @@ void nsCacheProfilePrefObserver::PrefChanged(const char* aPref) {
|
|||
if (!mHaveProfile) return;
|
||||
// which preference changed?
|
||||
nsresult rv;
|
||||
if (!strcmp(OFFLINE_CACHE_ENABLE_PREF, aPref)) {
|
||||
if (!strcmp(OFFLINE_CACHE_ENABLE_PREF, aPref) ||
|
||||
!strcmp(OFFLINE_CACHE_STORAGE_ENABLE_PREF, aPref)) {
|
||||
rv = Preferences::GetBool(OFFLINE_CACHE_ENABLE_PREF, &mOfflineCacheEnabled);
|
||||
if (NS_FAILED(rv)) return;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
rv = Preferences::GetBool(OFFLINE_CACHE_STORAGE_ENABLE_PREF,
|
||||
&mOfflineStorageCacheEnabled);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
nsCacheService::SetOfflineCacheEnabled(OfflineCacheEnabled());
|
||||
|
||||
} else if (!strcmp(OFFLINE_CACHE_CAPACITY_PREF, aPref)) {
|
||||
|
@ -294,6 +306,11 @@ nsresult nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch) {
|
|||
mOfflineCacheEnabled = true; // presume offline cache is enabled
|
||||
(void)branch->GetBoolPref(OFFLINE_CACHE_ENABLE_PREF, &mOfflineCacheEnabled);
|
||||
|
||||
mOfflineStorageCacheEnabled =
|
||||
true; // presume offline storage cache is enabled
|
||||
(void)branch->GetBoolPref(OFFLINE_CACHE_STORAGE_ENABLE_PREF,
|
||||
&mOfflineStorageCacheEnabled);
|
||||
|
||||
mOfflineCacheCapacity = OFFLINE_CACHE_CAPACITY;
|
||||
(void)branch->GetIntPref(OFFLINE_CACHE_CAPACITY_PREF, &mOfflineCacheCapacity);
|
||||
mOfflineCacheCapacity = std::max(0, mOfflineCacheCapacity);
|
||||
|
@ -368,7 +385,7 @@ bool nsCacheProfilePrefObserver::OfflineCacheEnabled() {
|
|||
if ((mOfflineCacheCapacity == 0) || (!mOfflineCacheParentDirectory))
|
||||
return false;
|
||||
|
||||
return mOfflineCacheEnabled;
|
||||
return mOfflineCacheEnabled && mOfflineStorageCacheEnabled;
|
||||
}
|
||||
|
||||
int32_t nsCacheProfilePrefObserver::CacheCompressionLevel() {
|
||||
|
|
|
@ -129,6 +129,9 @@ function run_test() {
|
|||
// Simulate a profile dir for xpcshell
|
||||
do_get_profile();
|
||||
|
||||
Services.prefs.setBoolPref("browser.cache.offline.enable", true);
|
||||
Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
|
||||
appCache = Cc["@mozilla.org/network/application-cache-service;1"]
|
||||
.getService(Ci.nsIApplicationCacheService)
|
||||
.getApplicationCache("fake-client-id|fake-group-id");
|
||||
|
|
|
@ -167,6 +167,7 @@ function run_test() {
|
|||
httpserver.start(-1);
|
||||
|
||||
prefService.setBoolPref("browser.cache.offline.enable", false);
|
||||
prefService.setBoolPref("browser.cache.offline.storage.enable", false);
|
||||
prefService.setBoolPref("network.http.rcwn.enabled", false);
|
||||
|
||||
nextTest();
|
||||
|
|
|
@ -76,6 +76,7 @@ function init_profile() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -86,6 +86,12 @@ add_test(function test_noStore() {
|
|||
function run_test() {
|
||||
do_get_profile();
|
||||
|
||||
var ps = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
Ci.nsIPrefBranch
|
||||
);
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
|
||||
httpServer = new HttpServer();
|
||||
httpServer.registerPathHandler(basePath + normalEntry, normalHandler);
|
||||
httpServer.registerPathHandler(basePath + noStoreEntry, noStoreHandler);
|
||||
|
|
|
@ -82,6 +82,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -82,6 +82,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -89,6 +89,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -89,6 +89,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -88,6 +88,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -89,6 +89,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -89,6 +89,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -89,6 +89,7 @@ function run_test() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -121,6 +121,7 @@ function run_test() {
|
|||
Ci.nsIPrefBranch
|
||||
);
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
// Set this pref to mimic the default browser behavior.
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
|
|
|
@ -109,6 +109,7 @@ function init_profile() {
|
|||
);
|
||||
dump(ps.getBoolPref("browser.cache.offline.enable"));
|
||||
ps.setBoolPref("browser.cache.offline.enable", true);
|
||||
ps.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
ps.setComplexValue(
|
||||
"browser.cache.offline.parent_directory",
|
||||
Ci.nsIFile,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[appcache.tentative.https.sub.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
||||
[Appcache!]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[appcache-iframe.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
|
@ -1,4 +1,5 @@
|
|||
[appcache-worker.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
||||
disabled:
|
||||
if verify: fails in verify mode
|
||||
expected: TIMEOUT
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[api_status_idle.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
|
@ -0,0 +1,2 @@
|
|||
[api_swapcache_error.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
|
@ -0,0 +1,2 @@
|
|||
[api_update.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
|
@ -1,2 +1 @@
|
|||
[secure_context.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:false]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[appcache-ordering-main.https.html]
|
||||
prefs: [browser.cache.offline.enable:true,browser.cache.offline.storage.enable:true]
|
||||
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1305877
|
||||
expected:
|
||||
if (e10s and (os == "win")) or ((os == "linux") and (bits == 64)): TIMEOUT
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[claim-fetch-with-appcache.https.html]
|
||||
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1237782
|
||||
[fetch() should be intercepted after the client is claimed.]
|
||||
expected:
|
||||
if (os == "linux") and debug and not webrender and e10s and not sw-e10s: FAIL
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
[claim-fetch.https.html]
|
||||
[fetch() should be intercepted after the client is claimed.]
|
||||
expected:
|
||||
if (os == "linux") and debug and e10s and not sw-e10s and (processor == "x86"): FAIL
|
||||
if (os == "linux") and debug and not webrender and e10s and sw-e10s: FAIL
|
||||
if (os == "linux") and debug and webrender: FAIL
|
||||
if (os == "linux") and not debug: FAIL
|
||||
if os == "win": FAIL
|
||||
if os == "mac": FAIL
|
||||
if (os == "android") and not e10s: FAIL
|
||||
if (os == "linux") and debug and not webrender and e10s: FAIL
|
||||
FAIL
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
[clients-get.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
|
@ -1,4 +1,5 @@
|
|||
[sxg-inner-resp-over-appcache.tentative.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
||||
[SignedHTTPExchange inner resp should take precedence to appcache.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[sxg-served-from-appcache.tentative.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
||||
[SignedHTTPExchange cached in appcache should work.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -406,6 +406,8 @@ async function test_push_cleared() {
|
|||
const { PushService } = serviceExports;
|
||||
const userAgentID = "bd744428-f125-436a-b6d0-dd0c9845837f";
|
||||
const channelID = "0ef2ad4a-6c49-41ad-af6e-95d2425276bf";
|
||||
Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
|
||||
Services.prefs.setBoolPref("browser.cache.offline.enable", true);
|
||||
|
||||
let db = PushServiceWebSocket.newPushDB();
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[DEFAULT]
|
||||
prefs = [browser.cache.offline.enable = true, browser.cache.offline.storage.enable=true]
|
||||
head = head_forgetaboutsite.js ../../../../dom/push/test/xpcshell/head.js
|
||||
skip-if = toolkit == 'android'
|
||||
support-files =
|
||||
|
|
|
@ -51,7 +51,6 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
static nsOfflineCacheUpdateService* gOfflineCacheUpdateService = nullptr;
|
||||
static bool sAllowInsecureOfflineCache = true;
|
||||
|
||||
nsTHashtable<nsCStringHashKey>* nsOfflineCacheUpdateService::mAllowedDomains =
|
||||
nullptr;
|
||||
|
@ -239,8 +238,6 @@ NS_IMPL_ISUPPORTS(nsOfflineCacheUpdateService, nsIOfflineCacheUpdateService,
|
|||
nsOfflineCacheUpdateService::nsOfflineCacheUpdateService()
|
||||
: mDisabled(false), mUpdateRunning(false) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
Preferences::AddBoolVarCache(&sAllowInsecureOfflineCache,
|
||||
"browser.cache.offline.insecure.enable", true);
|
||||
}
|
||||
|
||||
nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService() {
|
||||
|
@ -542,9 +539,8 @@ static nsresult OfflineAppPermForPrincipal(nsIPrincipal* aPrincipal,
|
|||
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(uri);
|
||||
if (!innerURI) return NS_OK;
|
||||
|
||||
// only http and https applications can use offline APIs.
|
||||
if (!(innerURI->SchemeIs("http") && sAllowInsecureOfflineCache) &&
|
||||
!innerURI->SchemeIs("https")) {
|
||||
// only https applications can use offline APIs.
|
||||
if (!innerURI->SchemeIs("https")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -608,23 +604,25 @@ nsOfflineCacheUpdateService::AllowOfflineApp(nsIPrincipal* aPrincipal) {
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!sAllowInsecureOfflineCache) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
if (!StaticPrefs::browser_cache_offline_storage_enable()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!uri) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
|
||||
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(uri);
|
||||
if (!innerURI) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
if (!uri) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
// if http then we should prevent this cache
|
||||
if (innerURI->SchemeIs("http")) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(uri);
|
||||
if (!innerURI) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
// if http then we should prevent this cache
|
||||
if (innerURI->SchemeIs("http")) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (GeckoProcessType_Default != XRE_GetProcessType()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче