Bug 1309699 - Add pref for bug 1279568 to address content crashes in Beta50. r=baku, a=jcristau
☠☠ backed out by 47f70e2af768 ☠ ☠
authorJonathan Hao <jhao@mozilla.com>
Thu, 13 Oct 2016 01:07:00 -0400
changeset 356097 a9a6e6eda3cb239b1f0b9105fc8c544b7a2e71f4
parent 356096 99dffa5be57569ee2f1a2f2366947c0872745f81
child 356098 39de9bdccf7562575a65973ba3b88a89b0a2f27a
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, jcristau
bugs1309699, 1279568
milestone51.0a2
Bug 1309699 - Add pref for bug 1279568 to address content crashes in Beta50. r=baku, a=jcristau
browser/app/profile/firefox.js
toolkit/components/thumbnails/BackgroundPageThumbs.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1408,19 +1408,21 @@ pref("privacy.trackingprotection.ui.enab
 #endif
 pref("privacy.trackingprotection.introCount", 0);
 pref("privacy.trackingprotection.introURL", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tracking-protection/start/");
 
 // Enable Contextual Identity Containers
 #ifdef NIGHTLY_BUILD
 pref("privacy.userContext.enabled", true);
 pref("privacy.userContext.ui.enabled", true);
+pref("privacy.usercontext.about_newtab_segregation.enabled", true);
 #else
 pref("privacy.userContext.enabled", false);
 pref("privacy.userContext.ui.enabled", false);
+pref("privacy.usercontext.about_newtab_segregation.enabled", false);
 #endif
 
 #ifndef RELEASE_BUILD
 // At the moment, autostart.2 is used, while autostart.1 is unused.
 // We leave it here set to false to reset users' defaults and allow
 // us to change everybody to true in the future, when desired.
 pref("browser.tabs.remote.autostart.1", false);
 pref("browser.tabs.remote.autostart.2", true);
--- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
+++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
@@ -10,16 +10,18 @@ const DEFAULT_CAPTURE_TIMEOUT = 30000; /
 const DESTROY_BROWSER_TIMEOUT = 60000; // ms
 const FRAME_SCRIPT_URL = "chrome://global/content/backgroundPageThumbsContent.js";
 
 const TELEMETRY_HISTOGRAM_ID_PREFIX = "FX_THUMBNAILS_BG_";
 
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 
+const ABOUT_NEWTAB_SEGREGATION_PREF = "privacy.usercontext.about_newtab_segregation.enabled";
+
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
 Cu.import("resource://gre/modules/PageThumbs.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 
 // possible FX_THUMBNAILS_BG_CAPTURE_DONE_REASON_2 telemetry values
@@ -191,20 +193,22 @@ const BackgroundPageThumbs = {
     if (this._thumbBrowser)
       return;
 
     let browser = this._parentWin.document.createElementNS(XUL_NS, "browser");
     browser.setAttribute("type", "content");
     browser.setAttribute("remote", "true");
     browser.setAttribute("disableglobalhistory", "true");
 
-    // Use the private container for thumbnails.
-    let privateIdentity =
-      ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
-    browser.setAttribute("usercontextid", privateIdentity.userContextId);
+    if (Services.prefs.getBoolPref(ABOUT_NEWTAB_SEGREGATION_PREF)) {
+      // Use the private container for thumbnails.
+      let privateIdentity =
+        ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
+      browser.setAttribute("usercontextid", privateIdentity.userContextId);
+    }
 
     // Size the browser.  Make its aspect ratio the same as the canvases' that
     // the thumbnails are drawn into; the canvases' aspect ratio is the same as
     // the screen's, so use that.  Aim for a size in the ballpark of 1024x768.
     let [swidth, sheight] = [{}, {}];
     Cc["@mozilla.org/gfx/screenmanager;1"].
       getService(Ci.nsIScreenManager).
       primaryScreen.
@@ -430,21 +434,23 @@ Capture.prototype = {
         try {
           callback.call(options, this.url);
         }
         catch (err) {
           Cu.reportError(err);
         }
       }
 
-      // Clear the data in the private container for thumbnails.
-      let privateIdentity =
-        ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
-      Services.obs.notifyObservers(null, "clear-origin-data",
+      if (Services.prefs.getBoolPref(ABOUT_NEWTAB_SEGREGATION_PREF)) {
+        // Clear the data in the private container for thumbnails.
+        let privateIdentity =
+          ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
+        Services.obs.notifyObservers(null, "clear-origin-data",
           JSON.stringify({ userContextId: privateIdentity.userContextId }));
+      }
     };
 
     if (!data) {
       done();
       return;
     }
 
     PageThumbs._store(this.url, data.finalURL, data.imageData, true)