Bug 1607366 - Display a warning when we're running Fission without WebRender;r?gijs draft
authorDavid Teller <dteller@mozilla.com>
Sat, 22 Feb 2020 10:04:40 +0000
changeset 2648937 7fb18d9661cfd5541aa13f7f84996e75ee383d71
parent 2606256 be3a05f615a557fd4c5171f789cc460688d9c3b8
child 2648938 1d9be9efe9deb125d915f8c97c7698cc8e8aa0d9
push id490873
push userreviewbot
push dateSat, 22 Feb 2020 10:05:03 +0000
treeherdertry@1d9be9efe9de [default view] [failures only]
reviewersgijs
bugs1607366
milestone74.0a1
Bug 1607366 - Display a warning when we're running Fission without WebRender;r?gijs Differential Revision: https://phabricator.services.mozilla.com/D61827 Differential Diff: PHID-DIFF-aujgq2cj3rrjeitmiuom
browser/base/content/browser.js
browser/components/tests/browser/browser.ini
browser/components/tests/browser/browser_webrender_and_fission_notification.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -9401,23 +9401,37 @@ var ConfirmationHint = {
       "confirmation-hint-description"
     ));
   },
 };
 
 if (AppConstants.NIGHTLY_BUILD) {
   var FissionTestingUI = {
     init() {
+      // Handle the Fission/Non-Fission testing UI.
       let autostart = Services.prefs.getBoolPref("fission.autostart");
       if (!autostart) {
         return;
       }
 
       let newFissionWindow = document.getElementById("Tools:FissionWindow");
       let newNonFissionWindow = document.getElementById(
         "Tools:NonFissionWindow"
       );
 
       newFissionWindow.hidden = gFissionBrowser;
       newNonFissionWindow.hidden = !gFissionBrowser;
+
+      // Display a warning if we're attempting to use Fission without WebRender
+      let isWebRenderEnabled = Services.prefs.getBoolPref("gfx.webrender.all");
+
+      if (!isWebRenderEnabled) {
+        // Note: Test is hardcoded in English. This is a Nightly-locked warning, so we can afford to.
+        window.gNotificationBox.appendNotification(
+          "You are running with Fission enabled but without WebRender. This combination is untested, so use at your own risk.",
+          "warning-fission-without-webrender-notification",
+          "chrome://global/skin/icons/question-16.png",
+          window.gNotificationBox.PRIORITY_WARNING_LOW
+        );
+      }
     },
   };
 }
--- a/browser/components/tests/browser/browser.ini
+++ b/browser/components/tests/browser/browser.ini
@@ -4,8 +4,12 @@
 skip-if = !updater
 reason = test depends on update channel
 [browser_contentpermissionprompt.js]
 [browser_default_bookmark_toolbar_visibility.js]
 [browser_initial_tab_remoteType.js]
 [browser_startup_homepage.js]
 [browser_urlbar_matchBuckets_migration60.js]
 skip-if = (debug && os=='win') #Bug 1592498
+
+[browser_webrender_and_fission_notification.js]
+run-if = nightly_build
+
new file mode 100644
--- /dev/null
+++ b/browser/components/tests/browser/browser_webrender_and_fission_notification.js
@@ -0,0 +1,24 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Makes sure that we report correctly the combo fission + non-webrender
+
+"use strict";
+
+add_task(async function() {
+  const isWebRenderEnabled = Services.prefs.getBoolPref("gfx.webrender.all");
+  const isFissionEnabled = Services.prefs.getBoolPref("fission.autostart");
+  const isWarningExpected = isFissionEnabled && !isWebRenderEnabled;
+
+  // Wait until the browser has had a chance to display the warning.
+  await gBrowserInit.idleTasksFinishedPromise;
+
+  let isWarningFound = !!gNotificationBox.getNotificationWithValue(
+    "warning-fission-without-webrender-notification"
+  );
+  is(
+    isWarningFound,
+    isWarningExpected,
+    "Did we get the Fission/WebRender warning right?"
+  );
+});