Bug 1081856: Allow javascript urls to load in any process. r=mconley
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 18 Feb 2015 10:59:10 -0800
changeset 229932 abec19b886f43d6602fcf7902b9388972b44caf2
parent 229926 51458a066fda3375cf6abecca6bc3da61be56f70
child 229933 0bb440fbcbfec33568d217cbb21d6d7f74ad934c
push id28303
push usercbook@mozilla.com
push dateFri, 20 Feb 2015 14:07:30 +0000
treeherdermozilla-central@80bd1ae9dd0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1081856
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1081856: Allow javascript urls to load in any process. r=mconley
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_e10s_javascript.js
browser/modules/E10SUtils.jsm
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -479,16 +479,17 @@ skip-if = e10s
 skip-if = e10s
 [browser_bug1025195_switchToTabHavingURI_aOpenParams.js]
 [browser_addCertException.js]
 skip-if = e10s # Bug 1100687 - test directly manipulates content (content.document.getElementById)
 [browser_bug1045809.js]
 [browser_e10s_switchbrowser.js]
 [browser_e10s_about_process.js]
 [browser_e10s_chrome_process.js]
+[browser_e10s_javascript.js]
 [browser_blockHPKP.js]
 skip-if = e10s # bug 1100687 - test directly manipulates content (content.document.getElementById)
 [browser_mcb_redirect.js]
 skip-if = e10s # bug 1084504 - [e10s] Mixed content detection does not take redirection into account
 [browser_windowactivation.js]
 [browser_contextmenu_childprocess.js]
 [browser_bug963945.js]
 [browser_readerMode.js]
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/general/browser_e10s_javascript.js
@@ -0,0 +1,11 @@
+const CHROME_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
+const CONTENT_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
+
+add_task(function*() {
+  let url = "javascript:dosomething()";
+
+  ok(E10SUtils.canLoadURIInProcess(url, CHROME_PROCESS),
+     "Check URL in chrome process.");
+  ok(E10SUtils.canLoadURIInProcess(url, CONTENT_PROCESS),
+     "Check URL in content process.");
+});
--- a/browser/modules/E10SUtils.jsm
+++ b/browser/modules/E10SUtils.jsm
@@ -25,16 +25,20 @@ function getAboutModule(aURL) {
 }
 
 this.E10SUtils = {
   canLoadURIInProcess: function(aURL, aProcess) {
     // loadURI in browser.xml treats null as about:blank
     if (!aURL)
       aURL = "about:blank";
 
+    // Javascript urls can load in any process, they apply to the current document
+    if (aURL.startsWith("javascript:"))
+      return true;
+
     let processIsRemote = aProcess == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
 
     let canLoadRemote = true;
     let mustLoadRemote = true;
 
     if (aURL.startsWith("about:")) {
       let url = Services.io.newURI(aURL, null, null);
       let module = getAboutModule(url);