diff options
Diffstat (limited to 'toolkit')
17 files changed, 268 insertions, 158 deletions
diff --git a/toolkit/components/aboutcache/content/aboutCache.js b/toolkit/components/aboutcache/content/aboutCache.js index 07067cce3..e945d683e 100644 --- a/toolkit/components/aboutcache/content/aboutCache.js +++ b/toolkit/components/aboutcache/content/aboutCache.js @@ -40,5 +40,9 @@ function navigate() if ($('priv').checked) context += 'p,'; + if (storage == null) { + storage = ""; + } + window.location.href = 'about:cache?storage=' + storage + '&context=' + context; } diff --git a/toolkit/components/webextensions/ExtensionContent.jsm b/toolkit/components/webextensions/ExtensionContent.jsm index 5bdcde6f5..5f9b88f35 100644 --- a/toolkit/components/webextensions/ExtensionContent.jsm +++ b/toolkit/components/webextensions/ExtensionContent.jsm @@ -344,6 +344,7 @@ class ContentScriptContextChild extends BaseContext { // because it enables us to create the APIs object in this sandbox object and then copying it // into the iframe's window, see Bug 1214658 for rationale) this.sandbox = Cu.Sandbox(contentWindow, { + sandboxName: `Web-Accessible Extension Page ${this.extension.id}`, sandboxPrototype: contentWindow, sameZoneAs: contentWindow, wantXrays: false, @@ -360,6 +361,7 @@ class ContentScriptContextChild extends BaseContext { this.sandbox = Cu.Sandbox(principal, { metadata, + sandboxName: `Content Script ${this.extension.id}`, sandboxPrototype: contentWindow, sameZoneAs: contentWindow, wantXrays: true, diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml index e1f58f7aa..55cef8244 100644 --- a/toolkit/content/widgets/toolbar.xml +++ b/toolkit/content/widgets/toolbar.xml @@ -54,7 +54,7 @@ // Look to see if there is a toolbarset. this.toolbarset = this.firstChild; while (this.toolbarset && this.toolbarset.localName != "toolbarset") { - this.toolbarset = toolbarset.nextSibling; + this.toolbarset = this.toolbarset.nextSibling; } if (this.toolbarset) { diff --git a/toolkit/forgetaboutsite/ForgetAboutSite.jsm b/toolkit/forgetaboutsite/ForgetAboutSite.jsm index 5250ca75d..8c7825392 100644 --- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm +++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm @@ -45,175 +45,201 @@ const Ci = Components.interfaces; const Cu = Components.utils; this.ForgetAboutSite = { - removeDataFromDomain: function CRH_removeDataFromDomain(aDomain) + removeDataFromDomain: Task.async(function* (aDomain) { PlacesUtils.history.removePagesFromHost(aDomain, true); + let promises = []; // Cache - let cs = Cc["@mozilla.org/netwerk/cache-storage-service;1"]. - getService(Ci.nsICacheStorageService); - // NOTE: there is no way to clear just that domain, so we clear out - // everything) - try { + promises.push(Task.spawn(function*() { + let cs = Cc["@mozilla.org/netwerk/cache-storage-service;1"]. + getService(Ci.nsICacheStorageService); + // NOTE: there is no way to clear just that domain, so we clear out + // everything) cs.clear(); - } catch (ex) { - Cu.reportError("Exception thrown while clearing the cache: " + - ex.toString()); - } + }).catch(ex => { + throw new Error("Exception thrown while clearing the cache: " + ex); + })); // Image Cache - let imageCache = Cc["@mozilla.org/image/tools;1"]. - getService(Ci.imgITools).getImgCacheForDocument(null); - try { + promises.push(Task.spawn(function*() { + let imageCache = Cc["@mozilla.org/image/tools;1"]. + getService(Ci.imgITools).getImgCacheForDocument(null); imageCache.clearCache(false); // true=chrome, false=content - } catch (ex) { - Cu.reportError("Exception thrown while clearing the image cache: " + - ex.toString()); - } + }).catch(ex => { + throw new Error("Exception thrown while clearing the image cache: " + ex); + })); // Cookies - let cm = Cc["@mozilla.org/cookiemanager;1"]. - getService(Ci.nsICookieManager2); - let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({}), aDomain); - while (enumerator.hasMoreElements()) { - let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie); - cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes); - } + // Need to maximize the number of cookies cleaned here + promises.push(Task.spawn(function*() { + let cm = Cc["@mozilla.org/cookiemanager;1"]. + getService(Ci.nsICookieManager2); + let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({}), aDomain); + while (enumerator.hasMoreElements()) { + let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie); + cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes); + } + }).catch(ex => { + throw new Error("Exception thrown while clearning cookies: " + ex); + })); // EME - let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"]. - getService(Ci.mozIGeckoMediaPluginChromeService); - mps.forgetThisSite(aDomain, JSON.stringify({})); + promises.push(Task.spawn(function*() { + let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"]. + getService(Ci.mozIGeckoMediaPluginChromeService); + mps.forgetThisSite(aDomain, JSON.stringify({})); + }).catch(ex => { + throw new Error("Exception thrown while clearing Encrypted Media Extensions: " + ex); + })); // Plugin data const phInterface = Ci.nsIPluginHost; const FLAG_CLEAR_ALL = phInterface.FLAG_CLEAR_ALL; let ph = Cc["@mozilla.org/plugin/host;1"].getService(phInterface); let tags = ph.getPluginTags(); - let promises = []; for (let i = 0; i < tags.length; i++) { - let promise = new Promise(resolve => { - let tag = tags[i]; + promises.push(new Promise(resolve => { try { - ph.clearSiteData(tags[i], aDomain, FLAG_CLEAR_ALL, -1, function(rv) { - resolve(); - }); + ph.clearSiteData(tags[i], aDomain, FLAG_CLEAR_ALL, -1, resolve); } catch (e) { // Ignore errors from the plugin, but resolve the promise + // We cannot check if something is a bailout or an error resolve(); } - }); - promises.push(promise); + })); } // Downloads - Task.spawn(function*() { + promises.push(Task.spawn(function*() { let list = yield Downloads.getList(Downloads.ALL); list.removeFinished(download => hasRootDomain( - NetUtil.newURI(download.source.url).host, aDomain)); - }).then(null, Cu.reportError); + NetUtil.newURI(download.source.url).host, aDomain)); + }).catch(ex => { + throw new Error("Exception in clearing Downloads: " + ex); + })); // Passwords - let lm = Cc["@mozilla.org/login-manager;1"]. - getService(Ci.nsILoginManager); - // Clear all passwords for domain - try { + promises.push(Task.spawn(function*() { + let lm = Cc["@mozilla.org/login-manager;1"]. + getService(Ci.nsILoginManager); + // Clear all passwords for domain let logins = lm.getAllLogins(); - for (let i = 0; i < logins.length; i++) - if (hasRootDomain(logins[i].hostname, aDomain)) + for (let i = 0; i < logins.length; i++) { + if (hasRootDomain(logins[i].hostname, aDomain)) { lm.removeLogin(logins[i]); - } - // XXXehsan: is there a better way to do this rather than this - // hacky comparison? - catch (ex) { - if (!ex.message.includes("User canceled Master Password entry")) { - throw ex; + } } - } + }).catch(ex => { + // XXX: + // Is there a better way to do this rather than this hacky comparison? + // Copied this from toolkit/components/passwordmgr/crypto-SDR.js + if (!ex.message.includes("User canceled master password entry")) { + throw new Error("Exception occured in clearing passwords: " + ex); + } + })); // Permissions let pm = Cc["@mozilla.org/permissionmanager;1"]. getService(Ci.nsIPermissionManager); // Enumerate all of the permissions, and if one matches, remove it - enumerator = pm.enumerator; + let enumerator = pm.enumerator; while (enumerator.hasMoreElements()) { let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission); - try { - if (hasRootDomain(perm.principal.URI.host, aDomain)) { - pm.removePermission(perm); + promises.push(new Promise((resolve, reject) => { + try { + if (hasRootDomain(perm.principal.URI.host, aDomain)) { + pm.removePermission(perm); + } + } catch (ex) { + // Ignore entry + } finally { + resolve(); } - } catch (e) { - /* Ignore entry */ - } + })); } // Offline Storages - let qms = Cc["@mozilla.org/dom/quota-manager-service;1"]. - getService(Ci.nsIQuotaManagerService); - // delete data from both HTTP and HTTPS sites - let caUtils = {}; - let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]. - getService(Ci.mozIJSSubScriptLoader); - scriptLoader.loadSubScript("chrome://global/content/contentAreaUtils.js", - caUtils); - let httpURI = caUtils.makeURI("http://" + aDomain); - let httpsURI = caUtils.makeURI("https://" + aDomain); - // Following code section has been reverted to the state before Bug 1238183, - // but added a new argument to clearStoragesForPrincipal() for indicating - // clear all storages under a given origin. - let httpPrincipal = Services.scriptSecurityManager - .createCodebasePrincipal(httpURI, {}); - let httpsPrincipal = Services.scriptSecurityManager - .createCodebasePrincipal(httpsURI, {}); - qms.clearStoragesForPrincipal(httpPrincipal, null, true); - qms.clearStoragesForPrincipal(httpsPrincipal, null, true); - - - function onContentPrefsRemovalFinished() { - // Everybody else (including extensions) - Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain); - } + promises.push(Task.spawn(function*() { + let qms = Cc["@mozilla.org/dom/quota-manager-service;1"]. + getService(Ci.nsIQuotaManagerService); + // delete data from both HTTP and HTTPS sites + let httpURI = NetUtil.newURI("http://" + aDomain); + let httpsURI = NetUtil.newURI("https://" + aDomain); + // Following code section has been reverted to the state before Bug 1238183, + // but added a new argument to clearStoragesForPrincipal() for indicating + // clear all storages under a given origin. + let httpPrincipal = Services.scriptSecurityManager + .createCodebasePrincipal(httpURI, {}); + let httpsPrincipal = Services.scriptSecurityManager + .createCodebasePrincipal(httpsURI, {}); + qms.clearStoragesForPrincipal(httpPrincipal, null, true); + qms.clearStoragesForPrincipal(httpsPrincipal, null, true); + }).catch(ex => { + throw new Error("Exception occured while clearing offline storages: " + ex); + })); // Content Preferences - let cps2 = Cc["@mozilla.org/content-pref/service;1"]. - getService(Ci.nsIContentPrefService2); - cps2.removeBySubdomain(aDomain, null, { - handleCompletion: () => onContentPrefsRemovalFinished(), - handleError: function() {} - }); + promises.push(Task.spawn(function*() { + let cps2 = Cc["@mozilla.org/content-pref/service;1"]. + getService(Ci.nsIContentPrefService2); + cps2.removeBySubdomain(aDomain, null, { + handleCompletion: (reason) => { + // Notify other consumers, including extensions + Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain); + if (reason === cps2.COMPLETE_ERROR) { + throw new Error("Exception occured while clearing content preferences"); + } + }, + handleError() {} + }); + })); // Predictive network data - like cache, no way to clear this per // domain, so just trash it all - let np = Cc["@mozilla.org/network/predictor;1"]. - getService(Ci.nsINetworkPredictor); - np.reset(); - - // Push notifications. - promises.push(new Promise(resolve => { - var push = Cc["@mozilla.org/push/Service;1"] - .getService(Ci.nsIPushService); + promises.push(Task.spawn(function*() { + let np = Cc["@mozilla.org/network/predictor;1"]. + getService(Ci.nsINetworkPredictor); + np.reset(); + }).catch(ex => { + throw new Error("Exception occured while clearing predictive network data: " + ex); + })); + + // Push notifications + promises.push(Task.spawn(function*() { + var push = Cc["@mozilla.org/push/Service;1"]. + getService(Ci.nsIPushService); push.clearForDomain(aDomain, status => { - (Components.isSuccessCode(status) ? resolve : reject)(status); + if (!Components.isSuccessCode(status)) { + throw new Error("Exception occured while clearing push notifications: " + status); + } }); - }).catch(e => { - Cu.reportError("Exception thrown while clearing Push notifications: " + - e.toString()); })); // HSTS and HPKP // TODO (bug 1290529): also remove HSTS/HPKP information for subdomains. // Since we can't enumerate the information in the site security service // (bug 1115712), we can't implement this right now. - try { + promises.push(Task.spawn(function*() { let sss = Cc["@mozilla.org/ssservice;1"]. getService(Ci.nsISiteSecurityService); + let httpsURI = NetUtil.newURI("https://" + aDomain); sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, httpsURI, 0); sss.removeState(Ci.nsISiteSecurityService.HEADER_HPKP, httpsURI, 0); - } catch (e) { - Cu.reportError("Exception thrown while clearing HSTS/HPKP: " + - e.toString()); - } + }).catch(ex => { + throw new Error("Exception thrown while clearing HSTS/HPKP: " + ex); + })); - return Promise.all(promises); - } -}; + let ErrorCount = 0; + for (let promise of promises) { + try { + yield promise; + } catch (ex) { + Cu.reportError(ex); + ErrorCount++; + } + } + if (ErrorCount !== 0) + throw new Error(`There were a total of ${ErrorCount} errors during removal`); + }) +} diff --git a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js index ec0a70228..ca0d394c3 100644 --- a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js +++ b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js @@ -37,7 +37,7 @@ function setTestPluginEnabledState(newEnabledState, plugin) { }); } -add_task(function* setup() { +add_task(function* () { var tags = pluginHost.getPluginTags(); // Find the test plugin @@ -50,12 +50,9 @@ add_task(function* setup() { } if (!pluginTag) { ok(false, "Test Plug-in not available, can't run test"); - finish(); + return; } setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, pluginTag); -}); - -add_task(function* () { yield BrowserTestUtils.openNewForegroundTab(gBrowser, testURL); // Set data for the plugin after the page load. @@ -87,5 +84,3 @@ add_task(function* () { gBrowser.removeCurrentTab(); }); - - diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js index f6ace1e64..d2db95e6a 100644 --- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js +++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js @@ -257,7 +257,7 @@ function* test_history_cleared_with_direct_match() do_check_false(yield promiseIsURIVisited(TEST_URI)); yield PlacesTestUtils.addVisits(TEST_URI); do_check_true(yield promiseIsURIVisited(TEST_URI)); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); do_check_false(yield promiseIsURIVisited(TEST_URI)); } @@ -267,7 +267,7 @@ function* test_history_cleared_with_subdomain() do_check_false(yield promiseIsURIVisited(TEST_URI)); yield PlacesTestUtils.addVisits(TEST_URI); do_check_true(yield promiseIsURIVisited(TEST_URI)); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); do_check_false(yield promiseIsURIVisited(TEST_URI)); } @@ -277,7 +277,7 @@ function* test_history_not_cleared_with_uri_contains_domain() do_check_false(yield promiseIsURIVisited(TEST_URI)); yield PlacesTestUtils.addVisits(TEST_URI); do_check_true(yield promiseIsURIVisited(TEST_URI)); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); do_check_true(yield promiseIsURIVisited(TEST_URI)); // Clear history since we left something there from this test. @@ -285,52 +285,52 @@ function* test_history_not_cleared_with_uri_contains_domain() } // Cookie Service -function test_cookie_cleared_with_direct_match() +function* test_cookie_cleared_with_direct_match() { const TEST_DOMAIN = "mozilla.org"; add_cookie(TEST_DOMAIN); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_cookie_exists(TEST_DOMAIN, false); } -function test_cookie_cleared_with_subdomain() +function* test_cookie_cleared_with_subdomain() { const TEST_DOMAIN = "www.mozilla.org"; add_cookie(TEST_DOMAIN); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_cookie_exists(TEST_DOMAIN, false); } -function test_cookie_not_cleared_with_uri_contains_domain() +function* test_cookie_not_cleared_with_uri_contains_domain() { const TEST_DOMAIN = "ilovemozilla.org"; add_cookie(TEST_DOMAIN); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_cookie_exists(TEST_DOMAIN, true); } // Login Manager -function test_login_manager_disabled_hosts_cleared_with_direct_match() +function* test_login_manager_disabled_hosts_cleared_with_direct_match() { const TEST_HOST = "http://mozilla.org"; add_disabled_host(TEST_HOST); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_disabled_host(TEST_HOST, false); } -function test_login_manager_disabled_hosts_cleared_with_subdomain() +function* test_login_manager_disabled_hosts_cleared_with_subdomain() { const TEST_HOST = "http://www.mozilla.org"; add_disabled_host(TEST_HOST); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_disabled_host(TEST_HOST, false); } -function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain() +function* test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain() { const TEST_HOST = "http://ilovemozilla.org"; add_disabled_host(TEST_HOST); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_disabled_host(TEST_HOST, true); // Reset state @@ -340,27 +340,27 @@ function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain( check_disabled_host(TEST_HOST, false); } -function test_login_manager_logins_cleared_with_direct_match() +function* test_login_manager_logins_cleared_with_direct_match() { const TEST_HOST = "http://mozilla.org"; add_login(TEST_HOST); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_login_exists(TEST_HOST, false); } -function test_login_manager_logins_cleared_with_subdomain() +function* test_login_manager_logins_cleared_with_subdomain() { const TEST_HOST = "http://www.mozilla.org"; add_login(TEST_HOST); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_login_exists(TEST_HOST, false); } -function test_login_manager_logins_not_cleared_with_uri_contains_domain() +function* test_login_manager_logins_not_cleared_with_uri_contains_domain() { const TEST_HOST = "http://ilovemozilla.org"; add_login(TEST_HOST); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_login_exists(TEST_HOST, true); let lm = Cc["@mozilla.org/login-manager;1"]. @@ -370,27 +370,27 @@ function test_login_manager_logins_not_cleared_with_uri_contains_domain() } // Permission Manager -function test_permission_manager_cleared_with_direct_match() +function* test_permission_manager_cleared_with_direct_match() { const TEST_URI = uri("http://mozilla.org"); add_permission(TEST_URI); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_permission_exists(TEST_URI, false); } -function test_permission_manager_cleared_with_subdomain() +function* test_permission_manager_cleared_with_subdomain() { const TEST_URI = uri("http://www.mozilla.org"); add_permission(TEST_URI); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_permission_exists(TEST_URI, false); } -function test_permission_manager_not_cleared_with_uri_contains_domain() +function* test_permission_manager_not_cleared_with_uri_contains_domain() { const TEST_URI = uri("http://ilovemozilla.org"); add_permission(TEST_URI); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); check_permission_exists(TEST_URI, true); // Reset state @@ -427,7 +427,7 @@ function* test_content_preferences_cleared_with_direct_match() do_check_false(yield preference_exists(TEST_URI)); yield add_preference(TEST_URI); do_check_true(yield preference_exists(TEST_URI)); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); yield waitForPurgeNotification(); do_check_false(yield preference_exists(TEST_URI)); } @@ -438,7 +438,7 @@ function* test_content_preferences_cleared_with_subdomain() do_check_false(yield preference_exists(TEST_URI)); yield add_preference(TEST_URI); do_check_true(yield preference_exists(TEST_URI)); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); yield waitForPurgeNotification(); do_check_false(yield preference_exists(TEST_URI)); } @@ -449,12 +449,12 @@ function* test_content_preferences_not_cleared_with_uri_contains_domain() do_check_false(yield preference_exists(TEST_URI)); yield add_preference(TEST_URI); do_check_true(yield preference_exists(TEST_URI)); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); yield waitForPurgeNotification(); do_check_true(yield preference_exists(TEST_URI)); // Reset state - ForgetAboutSite.removeDataFromDomain("ilovemozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("ilovemozilla.org"); yield waitForPurgeNotification(); do_check_false(yield preference_exists(TEST_URI)); } @@ -535,7 +535,7 @@ function* test_push_cleared() } // Cache -function test_cache_cleared() +function* test_cache_cleared() { // Because this test is asynchronous, it should be the last test do_check_true(tests[tests.length - 1] == arguments.callee); @@ -557,7 +557,7 @@ function test_cache_cleared() } }; os.addObserver(observer, "cacheservice:empty-cache", false); - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); do_test_pending(); } @@ -588,7 +588,7 @@ function* test_storage_cleared() do_check_eq(storage.getItem("test"), "value" + i); } - ForgetAboutSite.removeDataFromDomain("mozilla.org"); + yield ForgetAboutSite.removeDataFromDomain("mozilla.org"); yield waitForPurgeNotification(); do_check_eq(s[0].getItem("test"), null); diff --git a/toolkit/modules/addons/WebRequestContent.js b/toolkit/modules/addons/WebRequestContent.js index 219675e5b..f044a1cd4 100644 --- a/toolkit/modules/addons/WebRequestContent.js +++ b/toolkit/modules/addons/WebRequestContent.js @@ -80,6 +80,16 @@ var ContentPolicy = { shouldLoad(policyType, contentLocation, requestOrigin, node, mimeTypeGuess, extra, requestPrincipal) { + + // Loads of TYPE_DOCUMENT and TYPE_SUBDOCUMENT perform a ConPol check + // within docshell as well as within the ContentSecurityManager. To avoid + // duplicate evaluations we ignore ConPol checks performed within docShell. + if (extra instanceof Ci.nsISupportsString) { + if (extra.data === "conPolCheckFromDocShell") { + return Ci.nsIContentPolicy.ACCEPT; + } + } + if (requestPrincipal && Services.scriptSecurityManager.isSystemPrincipal(requestPrincipal)) { return Ci.nsIContentPolicy.ACCEPT; diff --git a/toolkit/modules/sessionstore/FormData.jsm b/toolkit/modules/sessionstore/FormData.jsm index f90ba5825..d4fb08d93 100644 --- a/toolkit/modules/sessionstore/FormData.jsm +++ b/toolkit/modules/sessionstore/FormData.jsm @@ -216,7 +216,7 @@ var FormDataInternal = { // We want to avoid saving data for about:sessionrestore as a string. // Since it's stored in the form as stringified JSON, stringifying further // causes an explosion of escape characters. cf. bug 467409 - if (isRestorationPage(ret.url)) { + if (isRestorationPage(ret.url) && ret.id && ret.id.sessionData) { ret.id.sessionData = JSON.parse(ret.id.sessionData); } diff --git a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm index 11944ddf5..66147b9aa 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm @@ -60,7 +60,11 @@ this.AddonRepository_SQLiteMigrator = { this._retrieveStoredData((results) => { this._closeConnection(); - let resultArray = [addon for ([,addon] of Iterator(results))]; + // Tycho: let resultArray = [addon for ([,addon] of Iterator(results))]; + let resultArray = []; + for (let [,addon] of Iterator(results)) { + resultArray.push(addon); + } logger.debug(resultArray.length + " addons imported.") aCallback(resultArray); }); diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 72a460e4a..c43811ba8 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -4436,7 +4436,18 @@ this.XPIProvider = { if (aAddon.type == "locale") return; - if (!(aMethod in this.bootstrapScopes[aAddon.id])) { + let method = undefined; + try { + method = Components.utils.evalInSandbox(`${aMethod};`, + this.bootstrapScopes[aAddon.id], + "ECMAv5"); + } + catch (e) { + // An exception will be caught if the expected method is not defined. + // That will be logged below. + } + + if (!method) { logger.warn("Add-on " + aAddon.id + " is missing bootstrap method " + aMethod); return; } @@ -4455,9 +4466,9 @@ this.XPIProvider = { } logger.debug("Calling bootstrap method " + aMethod + " on " + aAddon.id + " version " + - aAddon.version); + aAddon.version); try { - this.bootstrapScopes[aAddon.id][aMethod](params, aReason); + method(params, aReason); } catch (e) { logger.warn("Exception running bootstrap method " + aMethod + " on " + aAddon.id, e); diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js new file mode 100644 index 000000000..498b76526 --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js @@ -0,0 +1,5 @@ +Components.utils.import("resource://gre/modules/Services.jsm");
+
+const install = function() {
+ Services.obs.notifyObservers(null, "addon-install", "");
+}
\ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf new file mode 100644 index 000000000..af3a749ce --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf @@ -0,0 +1,24 @@ +<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>bootstrap@tests.mozilla.org</em:id>
+ <em:version>1.0</em:version>
+ <em:bootstrap>true</em:bootstrap>
+
+ <!-- Front End MetaData -->
+ <em:name>Test Bootstrap</em:name>
+ <em:description>Test Description</em:description>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>xpcshell@tests.mozilla.org</em:id>
+ <em:minVersion>1</em:minVersion>
+ <em:maxVersion>1</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ </Description>
+</RDF>
\ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js new file mode 100644 index 000000000..fb02b59be --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js @@ -0,0 +1,17 @@ +/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
+startupManager();
+
+add_task(function*() {
+ let sawInstall = false;
+ Services.obs.addObserver(function() {
+ sawInstall = true;
+ }, "addon-install", false);
+
+ yield promiseInstallAllFiles([do_get_addon("test_bootstrap_const")]);
+
+ ok(sawInstall);
+});
\ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini index bab072e83..2a12f147a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini @@ -29,6 +29,7 @@ skip-if = os == "android" [test_bootstrap.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" +[test_bootstrap_const.js] [test_bootstrap_resource.js] [test_bug299716.js] # Bug 676992: test consistently hangs on Android diff --git a/toolkit/pluginproblem/content/pluginProblemBinding.css b/toolkit/pluginproblem/content/pluginProblemBinding.css index 48506de34..a545e3eba 100644 --- a/toolkit/pluginproblem/content/pluginProblemBinding.css +++ b/toolkit/pluginproblem/content/pluginProblemBinding.css @@ -19,6 +19,11 @@ object:-moz-handler-crashed, object:-moz-handler-clicktoplay, object:-moz-handler-vulnerable-updatable, object:-moz-handler-vulnerable-no-update { +%ifdef MC_PALEMOON + /* Initialize the overlay with visibility:hidden to prevent flickering if + * the plugin is too small to show the overlay */ + visibility: hidden; +%endif display: inline-block; overflow: hidden; opacity: 1 !important; diff --git a/toolkit/pluginproblem/content/pluginProblemContent.css b/toolkit/pluginproblem/content/pluginProblemContent.css index 43a9f52dc..cf8755635 100644 --- a/toolkit/pluginproblem/content/pluginProblemContent.css +++ b/toolkit/pluginproblem/content/pluginProblemContent.css @@ -51,6 +51,7 @@ a .mainBox:focus, line-height: initial; } +%ifndef MC_PALEMOON /* Initialize the overlay with visibility:hidden to prevent flickering if * the plugin is too small to show the overlay */ .mainBox > .hoverBox, @@ -62,6 +63,7 @@ a .mainBox:focus, .visible > .closeIcon { visibility: visible; } +%endif .mainBox[chromedir="rtl"] { direction: rtl; @@ -97,6 +99,10 @@ a .msgTapToPlay, :-moz-handler-blocked .msgBlocked, :-moz-handler-crashed .msgCrashed { display: block; + position: relative; + left: 0; + top: 0; + z-index: 9999; } .submitStatus[status] { diff --git a/toolkit/pluginproblem/jar.mn b/toolkit/pluginproblem/jar.mn index d0af1c82f..c027793de 100644 --- a/toolkit/pluginproblem/jar.mn +++ b/toolkit/pluginproblem/jar.mn @@ -5,6 +5,6 @@ toolkit.jar: % content pluginproblem %pluginproblem/ contentaccessible=yes pluginproblem/pluginProblem.xml (content/pluginProblem.xml) - pluginproblem/pluginProblemContent.css (content/pluginProblemContent.css) - pluginproblem/pluginProblemBinding.css (content/pluginProblemBinding.css) +* pluginproblem/pluginProblemContent.css (content/pluginProblemContent.css) +* pluginproblem/pluginProblemBinding.css (content/pluginProblemBinding.css) pluginproblem/pluginReplaceBinding.css (content/pluginReplaceBinding.css) |