Bug 1317101 - Part 7d: Load moz-extension: URLs remotely based on a pref. r?billm draft
authorKris Maglione <maglione.k@gmail.com>
Sat, 12 Nov 2016 15:36:03 -0800
changeset 438076 ca2f66ab4e0a446371cfb4c5276c11badaf55139
parent 438075 e4a12bca96f9f67e8d38739af41b9b23465bc14f
child 438077 5781a884fc0640acaf166632fb64fe244e900906
push id35614
push usermaglione.k@gmail.com
push dateSun, 13 Nov 2016 03:28:59 +0000
reviewersbillm
bugs1317101
milestone52.0a1
Bug 1317101 - Part 7d: Load moz-extension: URLs remotely based on a pref. r?billm MozReview-Commit-ID: Kxt9mDMdPQk
browser/modules/E10SUtils.jsm
--- a/browser/modules/E10SUtils.jsm
+++ b/browser/modules/E10SUtils.jsm
@@ -4,16 +4,20 @@
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["E10SUtils"];
 
 const {interfaces: Ci, utils: Cu, classes: Cc} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+XPCOMUtils.defineLazyPreferenceGetter(this, "useRemoteWebExtensions",
+                                      "extensions.webextensions.outOfProcess", false);
 
 function getAboutModule(aURL) {
   // Needs to match NS_GetAboutModuleName
   let moduleName = aURL.path.replace(/[#?].*/, "").toLowerCase();
   let contract = "@mozilla.org/network/protocol/about;1?what=" + moduleName;
   try {
     return Cc[contract].getService(Ci.nsIAboutModule);
   }
@@ -65,18 +69,18 @@ this.E10SUtils = {
         let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].
                         getService(Ci.nsIXULChromeRegistry);
         canLoadRemote = chromeReg.canLoadURLRemotely(url);
         mustLoadRemote = chromeReg.mustLoadURLRemotely(url);
       }
     }
 
     if (aURL.startsWith("moz-extension:")) {
-      canLoadRemote = false;
-      mustLoadRemote = false;
+      canLoadRemote = useRemoteWebExtensions;
+      mustLoadRemote = useRemoteWebExtensions;
     }
 
     if (aURL.startsWith("view-source:")) {
       return this.canLoadURIInProcess(aURL.substr("view-source:".length), aProcess);
     }
 
     if (mustLoadRemote)
       return processIsRemote;