Bug 1551070 - Check for type of remote content process depending on preference browser.tabs.remote.separatePrivilegedContentProcess in browser_updateLogin.js. r=jaws
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 13 May 2019 05:13:33 +0000
changeset 532384 12d0981bc456c88396f3819aa64aa81d8f67cb66
parent 532383 340b1a7c0c3ca75fc343d73c106db1b3ef8904e4
child 532385 ef1a01ffef86fc60b349353c86e78e8c5b2af8b3
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1551070, 1551042
milestone68.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 1551070 - Check for type of remote content process depending on preference browser.tabs.remote.separatePrivilegedContentProcess in browser_updateLogin.js. r=jaws Also fixes bug 1551042. Differential Revision: https://phabricator.services.mozilla.com/D30831
browser/components/aboutlogins/AboutLoginsParent.jsm
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -15,16 +15,27 @@ ChromeUtils.defineModuleGetter(this, "Se
                                "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "log", () => {
   return LoginHelper.createLogger("AboutLoginsParent");
 });
 
 const ABOUT_LOGINS_ORIGIN = "about:logins";
 
+const PRIVILEGED_PROCESS_PREF =
+  "browser.tabs.remote.separatePrivilegedContentProcess";
+const PRIVILEGED_PROCESS_ENABLED =
+  Services.prefs.getBoolPref(PRIVILEGED_PROCESS_PREF, false);
+
+// When the privileged content process is enabled, we expect about:logins
+// to load in it. Otherwise, it's in a normal web content process.
+const EXPECTED_ABOUTLOGINS_REMOTE_TYPE =
+  PRIVILEGED_PROCESS_ENABLED ? E10SUtils.PRIVILEGED_REMOTE_TYPE
+                             : E10SUtils.DEFAULT_REMOTE_TYPE;
+
 const isValidLogin = login => {
   return !(login.hostname || "").startsWith("chrome://");
 };
 
 const convertSubjectToLogin = subject => {
     subject.QueryInterface(Ci.nsILoginMetaInfo).QueryInterface(Ci.nsILoginInfo);
     const login = LoginHelper.loginToVanillaObject(subject);
     if (!isValidLogin(login)) {
@@ -34,17 +45,17 @@ const convertSubjectToLogin = subject =>
 };
 
 var AboutLoginsParent = {
   _subscribers: new WeakSet(),
 
   // Listeners are added in BrowserGlue.jsm
   receiveMessage(message) {
     // Only respond to messages sent from about:logins.
-    if (message.target.remoteType != E10SUtils.PRIVILEGED_REMOTE_TYPE ||
+    if (message.target.remoteType != EXPECTED_ABOUTLOGINS_REMOTE_TYPE ||
         message.target.contentPrincipal.originNoSuffix != ABOUT_LOGINS_ORIGIN) {
       return;
     }
 
     switch (message.name) {
       case "AboutLogins:DeleteLogin": {
         let login = LoginHelper.vanillaObjectToLogin(message.data.login);
         Services.logins.removeLogin(login);
@@ -117,17 +128,17 @@ var AboutLoginsParent = {
         break;
       }
     }
   },
 
   messageSubscribers(name, details) {
     let subscribers = ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers);
     for (let subscriber of subscribers) {
-      if (subscriber.remoteType != E10SUtils.PRIVILEGED_REMOTE_TYPE ||
+      if (subscriber.remoteType != EXPECTED_ABOUTLOGINS_REMOTE_TYPE ||
           !subscriber.contentPrincipal ||
           subscriber.contentPrincipal.originNoSuffix != ABOUT_LOGINS_ORIGIN) {
         this._subscribers.delete(subscriber);
         continue;
       }
       try {
         subscriber.messageManager.sendAsyncMessage(name, details);
       } catch (ex) {}