mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Backed out changeset e3f06f11de62 (bug 1237782) for causing browser-chrome failure on automation.py CLOSED TREE
This commit is contained in:
parent
e843afd6cd
commit
4ea120b5cb
@ -6,6 +6,7 @@
|
||||
###############################################################################
|
||||
|
||||
[DEFAULT]
|
||||
prefs = browser.cache.offline.insecure.enable=true
|
||||
support-files =
|
||||
alltabslistener.html
|
||||
app_bug575561.html
|
||||
@ -300,12 +301,10 @@ 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 = os == "linux" && !debug # bug 1304273
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_gZipOfflineChild.js]
|
||||
scheme = https
|
||||
skip-if = verify
|
||||
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 =
|
||||
"https://example.com/browser/browser/base/content/test/general/test_offline_gzip.html";
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/general/test_offline_gzip.html";
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
// Clean up after ourself
|
||||
|
@ -7,7 +7,7 @@
|
||||
// else the test runner gets in the way of notifications due to bug 857897.
|
||||
|
||||
const URL =
|
||||
"https://example.com/browser/browser/base/content/test/general/offlineQuotaNotification.html";
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/general/offlineQuotaNotification.html";
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
// Clean up after ourself
|
||||
@ -18,9 +18,7 @@ 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");
|
||||
Services.prefs.clearUserPref("offline-apps.allow_by_default");
|
||||
let { OfflineAppCacheHelper } = ChromeUtils.import(
|
||||
"resource://gre/modules/offlineAppCache.jsm"
|
||||
);
|
||||
@ -45,8 +43,6 @@ function checkInContentPreferences(win) {
|
||||
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);
|
||||
|
||||
// Open a new tab.
|
||||
|
@ -490,8 +490,6 @@ 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);
|
||||
@ -570,8 +568,6 @@ 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,7 +2936,8 @@ bool nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx,
|
||||
/* static */
|
||||
bool nsGlobalWindowInner::OfflineCacheAllowedForContext(JSContext* aCx,
|
||||
JSObject* aObj) {
|
||||
return IsSecureContextOrObjectIsFromSecureContext(aCx, aObj);
|
||||
return IsSecureContextOrObjectIsFromSecureContext(aCx, aObj) ||
|
||||
Preferences::GetBool("browser.cache.offline.insecure.enable");
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -1,11 +1,133 @@
|
||||
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()");
|
||||
|
@ -657,15 +657,6 @@
|
||||
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
|
||||
|
@ -225,6 +225,9 @@ 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);
|
||||
|
||||
// enable offline apps by default, disable prompt
|
||||
pref("offline-apps.allow_by_default", true);
|
||||
|
||||
|
23
netwerk/cache/nsCacheService.cpp
vendored
23
netwerk/cache/nsCacheService.cpp
vendored
@ -50,7 +50,6 @@ 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
|
||||
@ -64,7 +63,6 @@ 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,
|
||||
@ -80,7 +78,6 @@ class nsCacheProfilePrefObserver : public nsIObserver {
|
||||
nsCacheProfilePrefObserver()
|
||||
: mHaveProfile(false),
|
||||
mOfflineCacheEnabled(false),
|
||||
mOfflineStorageCacheEnabled(false),
|
||||
mOfflineCacheCapacity(0),
|
||||
mCacheCompressionLevel(CACHE_COMPRESSION_LEVEL),
|
||||
mSanitizeOnShutdown(false),
|
||||
@ -112,7 +109,6 @@ class nsCacheProfilePrefObserver : public nsIObserver {
|
||||
nsCOMPtr<nsIFile> mDiskCacheParentDirectory;
|
||||
|
||||
bool mOfflineCacheEnabled;
|
||||
bool mOfflineStorageCacheEnabled;
|
||||
int32_t mOfflineCacheCapacity; // in kilobytes
|
||||
nsCOMPtr<nsIFile> mOfflineCacheParentDirectory;
|
||||
|
||||
@ -241,17 +237,9 @@ void nsCacheProfilePrefObserver::PrefChanged(const char* aPref) {
|
||||
if (!mHaveProfile) return;
|
||||
// which preference changed?
|
||||
nsresult rv;
|
||||
if (!strcmp(OFFLINE_CACHE_ENABLE_PREF, aPref) ||
|
||||
!strcmp(OFFLINE_CACHE_STORAGE_ENABLE_PREF, aPref)) {
|
||||
if (!strcmp(OFFLINE_CACHE_ENABLE_PREF, aPref)) {
|
||||
rv = Preferences::GetBool(OFFLINE_CACHE_ENABLE_PREF, &mOfflineCacheEnabled);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
rv = Preferences::GetBool(OFFLINE_CACHE_STORAGE_ENABLE_PREF,
|
||||
&mOfflineStorageCacheEnabled);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
if (NS_FAILED(rv)) return;
|
||||
nsCacheService::SetOfflineCacheEnabled(OfflineCacheEnabled());
|
||||
|
||||
} else if (!strcmp(OFFLINE_CACHE_CAPACITY_PREF, aPref)) {
|
||||
@ -306,11 +294,6 @@ 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);
|
||||
@ -385,7 +368,7 @@ bool nsCacheProfilePrefObserver::OfflineCacheEnabled() {
|
||||
if ((mOfflineCacheCapacity == 0) || (!mOfflineCacheParentDirectory))
|
||||
return false;
|
||||
|
||||
return mOfflineCacheEnabled && mOfflineStorageCacheEnabled;
|
||||
return mOfflineCacheEnabled;
|
||||
}
|
||||
|
||||
int32_t nsCacheProfilePrefObserver::CacheCompressionLevel() {
|
||||
|
@ -129,9 +129,6 @@ 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,7 +167,6 @@ 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,7 +76,6 @@ 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,12 +86,6 @@ 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,7 +82,6 @@ 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,7 +82,6 @@ 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,7 +89,6 @@ 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,7 +89,6 @@ 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,7 +88,6 @@ 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,7 +89,6 @@ 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,7 +89,6 @@ 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,7 +89,6 @@ 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,7 +121,6 @@ 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,7 +109,6 @@ 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,2 +0,0 @@
|
||||
[appcache-iframe.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
@ -1,5 +1,4 @@
|
||||
[appcache-worker.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
||||
disabled:
|
||||
if verify: fails in verify mode
|
||||
expected: TIMEOUT
|
||||
|
@ -1,2 +0,0 @@
|
||||
[appcache-worker.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
@ -1,2 +0,0 @@
|
||||
[api_status_idle.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
@ -1,2 +0,0 @@
|
||||
[api_swapcache_error.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
@ -1,2 +0,0 @@
|
||||
[api_update.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
@ -1 +1,2 @@
|
||||
[secure_context.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:false]
|
||||
|
@ -1,5 +1,4 @@
|
||||
[claim-fetch-with-appcache.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
||||
[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,5 +1,4 @@
|
||||
[claim-fetch.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
||||
[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
|
||||
|
@ -1,2 +0,0 @@
|
||||
[clients-get.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
|
@ -1,5 +1,4 @@
|
||||
[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,5 +1,4 @@
|
||||
[sxg-served-from-appcache.tentative.https.html]
|
||||
prefs: [browser.cache.offline.storage.enable:true]
|
||||
[SignedHTTPExchange cached in appcache should work.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -406,8 +406,6 @@ 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,5 +1,4 @@
|
||||
[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,6 +51,7 @@ using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static nsOfflineCacheUpdateService* gOfflineCacheUpdateService = nullptr;
|
||||
static bool sAllowInsecureOfflineCache = true;
|
||||
|
||||
nsTHashtable<nsCStringHashKey>* nsOfflineCacheUpdateService::mAllowedDomains =
|
||||
nullptr;
|
||||
@ -238,6 +239,8 @@ 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() {
|
||||
@ -540,8 +543,9 @@ static nsresult OfflineAppPermForPrincipal(nsIPrincipal* aPrincipal,
|
||||
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(uri);
|
||||
if (!innerURI) return NS_OK;
|
||||
|
||||
// only https applications can use offline APIs.
|
||||
if (!innerURI->SchemeIs("https")) {
|
||||
// only http and https applications can use offline APIs.
|
||||
if (!(innerURI->SchemeIs("http") && sAllowInsecureOfflineCache) &&
|
||||
!innerURI->SchemeIs("https")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -610,25 +614,23 @@ nsOfflineCacheUpdateService::AllowOfflineApp(nsIPrincipal* aPrincipal) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!StaticPrefs::browser_cache_offline_storage_enable()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
if (!sAllowInsecureOfflineCache) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
if (!uri) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!uri) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(uri);
|
||||
if (!innerURI) {
|
||||
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 http then we should prevent this cache
|
||||
if (innerURI->SchemeIs("http")) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GeckoProcessType_Default != XRE_GetProcessType()) {
|
||||
|
Loading…
Reference in New Issue
Block a user