Bug 1553737 - Backed out changeset 2d54ea3f6208 (bug 1541062) for causing bug 1553737. a=backout
authorJulien Cristau <jcristau@mozilla.com>
Mon, 27 May 2019 12:00:16 +0200
changeset 533434 6ec3cb391f03a3d02c47e3cb4525fe9eb6abd242
parent 533433 97158e94fd0a16e451db9720d64bdfc7df4c685e
child 533435 35528f5b95dd34aeba73f14641aeb0d8b53dea86
push id11319
push userrgurzau@mozilla.com
push dateMon, 27 May 2019 23:54:00 +0000
treeherdermozilla-beta@6ec3cb391f03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1553737, 1541062
milestone68.0
Bug 1553737 - Backed out changeset 2d54ea3f6208 (bug 1541062) for causing bug 1553737. a=backout
modules/libpref/init/all.js
toolkit/mozapps/update/content/updates.js
toolkit/mozapps/update/content/updates.xul
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2667,17 +2667,17 @@ pref("security.notification_enable_delay
 
 #if defined(DEBUG) && !defined(ANDROID)
 pref("csp.about_uris_without_csp", "blank,printpreview,srcdoc,about,addons,cache-entry,config,crashes,debugging,devtools,downloads,home,memory,networking,newtab,performance,plugins,policies,profiles,restartrequired,serviceworkers,sessionrestore,support,sync-log,telemetry,url-classifier,webrtc,welcomeback");
 // the following prefs are for testing purposes only.
 pref("csp.overrule_about_uris_without_csp_whitelist", false);
 pref("csp.skip_about_page_has_csp_assert", false);
 // assertion flag will be set to false after fixing Bug 1473549
 pref("security.allow_eval_with_system_principal", false);
-pref("security.uris_using_eval_with_system_principal", "autocomplete.xml,redux.js,react-redux.js,content-task.js,preferencesbindings.js,lodash.js,jszip.js,sinon-7.2.7.js,ajv-4.1.1.js,jsol.js");
+pref("security.uris_using_eval_with_system_principal", "autocomplete.xml,redux.js,react-redux.js,content-task.js,preferencesbindings.js,lodash.js,jszip.js,sinon-7.2.7.js,ajv-4.1.1.js,updates.js,jsol.js");
 #endif
 
 #if defined(DEBUG) || defined(FUZZING)
 // Disallow web documents loaded with the SystemPrincipal
 pref("security.disallow_non_local_systemprincipal_in_tests", false);
 #endif
 
 // Mixed content blocking
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -211,38 +211,59 @@ var gUpdates = {
     // which will clear app.update.elevate.never preference.
     if (gAUS.elevationRequired) {
       Services.prefs.setCharPref(PREF_APP_UPDATE_ELEVATE_NEVER,
                                  this.update.appVersion);
     }
   },
 
   /**
+   * A hash of |pageid| attribute to page object. Can be used to dispatch
+   * function calls to the appropriate page.
+   */
+  _pages: { },
+
+  /**
    * Called when the user presses the "Finish" button on the wizard, dispatches
    * the function call to the selected page.
    */
   onWizardFinish() {
     this._runUnload = false;
     var pageid = document.documentElement.currentPage.pageid;
+    if ("onWizardFinish" in this._pages[pageid])
+      this._pages[pageid].onWizardFinish();
     this._submitTelemetry(pageid);
   },
 
   /**
    * Called when the user presses the "Cancel" button on the wizard, dispatches
    * the function call to the selected page.
    */
   onWizardCancel() {
     this._runUnload = false;
     var pageid = document.documentElement.currentPage.pageid;
-    let cancelEvent = new CustomEvent("wizardpagecancel", { });
-    document.documentElement.currentPage.dispatchEvent(cancelEvent);
+    if ("onWizardCancel" in this._pages[pageid])
+      this._pages[pageid].onWizardCancel();
     this._submitTelemetry(pageid);
   },
 
   /**
+   * Called when the user presses the "Next" button on the wizard, dispatches
+   * the function call to the selected page.
+   */
+  onWizardNext() {
+    var cp = document.documentElement.currentPage;
+    if (!cp)
+      return;
+    var pageid = cp.pageid;
+    if ("onWizardNext" in this._pages[pageid])
+      this._pages[pageid].onWizardNext();
+  },
+
+  /**
    * The checking process that spawned this update UI. There are two types:
    * SRCEVT_FOREGROUND:
    *   Some user-generated event caused this UI to appear, e.g. the Help
    *   menu item or the button in preferences. When in this mode, the UI
    *   should remain active for the duration of the download.
    * SRCEVT_BACKGROUND:
    *   A background update check caused this UI to appear, probably because
    *   UpdateUtils.getAppUpdateAutoEnabled returned false, indicating that the
@@ -268,61 +289,51 @@ var gUpdates = {
     this.wiz = document.documentElement;
 
     gLogEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
 
     this.strings = document.getElementById("updateStrings");
     var brandStrings = document.getElementById("brandStrings");
     this.brandName = brandStrings.getString("brandShortName");
 
+    var pages = this.wiz.childNodes;
+    for (var i = 0; i < pages.length; ++i) {
+      var page = pages[i];
+      if (page.localName == "wizardpage")
+        // eslint-disable-next-line no-eval
+        this._pages[page.pageid] = eval(page.getAttribute("object"));
+    }
+
     // Cache the standard button labels in case we need to restore them
     this._cacheButtonStrings("next");
     this._cacheButtonStrings("finish");
     this._cacheButtonStrings("extra1");
     this._cacheButtonStrings("extra2");
 
-    // Add wizardFinish eventListeners globally and to the pages that need one.
     document.addEventListener("wizardfinish", function() { gUpdates.onWizardFinish(); });
-    document.getElementById("finished").addEventListener("wizardfinish", function() { gFinishedPage.onWizardFinish(); });
-    document.getElementById("finishedBackground").addEventListener("wizardfinish", function() { gFinishedPage.onWizardFinish(); });
-
-    // Add wizardcancel eventListener globally.
     document.addEventListener("wizardcancel", function() { gUpdates.onWizardCancel(); });
+    document.addEventListener("wizardnext", function() { gUpdates.onWizardNext(); });
 
-    // Add wizardpagecancel eventListener to the pages that need one.
-    document.getElementById("checking").addEventListener("wizardpagecancel", function() { gCheckingPage.onWizardCancel(); });
-    document.getElementById("downloading").addEventListener("wizardpagecancel", function() { gDownloadingPage.onWizardCancel(); });
-
-    // Add special wizardNext eventListener for the errorpatching-page.
-    document.addEventListener("wizardnext", function() {
-        if (document.documentElement.currentPage.pageid == "errorpatching") {
-          gErrorPatchingPage.onWizardNext();
-        }
-    });
-
-    // Add pageShow eventListeners to all pages.
     document.getElementById("checking").addEventListener("pageshow", function() { gCheckingPage.onPageShow(); });
     document.getElementById("noupdatesfound").addEventListener("pageshow", function() { gNoUpdatesPage.onPageShow(); });
     document.getElementById("manualUpdate").addEventListener("pageshow", function() { gManualUpdatePage.onPageShow(); });
     document.getElementById("unsupported").addEventListener("pageshow", function() { gUnsupportedPage.onPageShow(); });
     document.getElementById("updatesfoundbasic").addEventListener("pageshow", function() { gUpdatesFoundBasicPage.onPageShow(); });
     document.getElementById("downloading").addEventListener("pageshow", function() { gDownloadingPage.onPageShow(); });
     document.getElementById("errors").addEventListener("pageshow", function() { gErrorsPage.onPageShow(); });
     document.getElementById("errorextra").addEventListener("pageshow", function() { gErrorExtraPage.onPageShow(); });
     document.getElementById("errorpatching").addEventListener("pageshow", function() { gErrorPatchingPage.onPageShow(); });
     document.getElementById("finished").addEventListener("pageshow", function() { gFinishedPage.onPageShow(); });
     document.getElementById("finishedBackground").addEventListener("pageshow", function() { gFinishedPage.onPageShowBackground(); });
 
-    // Add extra1 eventListeners to the pages that need one.
     document.getElementById("updatesfoundbasic").addEventListener("extra1", function() { gUpdatesFoundBasicPage.onExtra1(); });
     document.getElementById("downloading").addEventListener("extra1", function() { gDownloadingPage.onHide(); });
     document.getElementById("finished").addEventListener("extra1", function() { gFinishedPage.onExtra1(); });
     document.getElementById("finishedBackground").addEventListener("extra1", function() { gFinishedPage.onExtra1(); });
 
-    // Add extra2 eventListeners to the pages that need one.
     document.getElementById("updatesfoundbasic").addEventListener("extra2", function() { gUpdatesFoundBasicPage.onExtra2(); });
     document.getElementById("finishedBackground").addEventListener("extra2", function() { gFinishedPage.onExtra2(); });
 
     // Advance to the Start page.
     this.getStartPageID(function(startPageID) {
       LOG("gUpdates", "onLoad - setting current page to startpage " + startPageID);
       gUpdates.wiz.currentPage = document.getElementById(startPageID);
     });
--- a/toolkit/mozapps/update/content/updates.xul
+++ b/toolkit/mozapps/update/content/updates.xul
@@ -38,60 +38,64 @@
 
   <stringbundleset id="updateSet">
     <stringbundle id="brandStrings" src="chrome://branding/locale/brand.properties"/>
     <stringbundle id="updateStrings" src="chrome://mozapps/locale/update/updates.properties"/>
   </stringbundleset>
 
   <wizardpage id="dummy" pageid="dummy" firstpage="true"/>
 
-  <wizardpage id="checking" pageid="checking" next="noupdatesfound">
+  <wizardpage id="checking" pageid="checking" next="noupdatesfound"
+              object="gCheckingPage">
     <updateheader label="&checking.title;"/>
     <vbox class="update-content" flex="1">
       <label>&updateCheck.label;</label>
       <separator class="thin"/>
       <html:progress id="checkingProgress"/>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="noupdatesfound" pageid="noupdatesfound">
+  <wizardpage id="noupdatesfound" pageid="noupdatesfound"
+              object="gNoUpdatesPage">
     <updateheader label="&noupdatesfound.title;"/>
     <vbox class="update-content" flex="1">
       <label id="noUpdatesAutoEnabled" hidden="true">&noupdatesautoenabled.intro;</label>
       <label id="noUpdatesAutoDisabled" hidden="true">&noupdatesautodisabled.intro;</label>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="manualUpdate" pageid="manualUpdate">
+  <wizardpage id="manualUpdate" pageid="manualUpdate" object="gManualUpdatePage">
     <updateheader label="&manualUpdate.title;"/>
     <vbox class="update-content" flex="1">
       <label id="manualUpdateDesc">&manualUpdate.desc;</label>
       <label id="manualUpdateSpaceDesc"
              hidden="true">&manualUpdate.space.desc;</label>
       <separator class="thin"/>
       <label>&manualUpdateGetMsg.label;</label>
       <hbox>
         <label id="manualUpdateLinkLabel" value="" is="text-link"
                onclick="openUpdateURL(event);"/>
       </hbox>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="unsupported" pageid="unsupported">
+  <wizardpage id="unsupported" pageid="unsupported"
+              object="gUnsupportedPage">
     <updateheader label="&unsupported.title;"/>
     <vbox class="update-content" flex="1">
       <description flex="1">&unsupported.label;
         <label id="unsupportedLinkLabel" class="inline-link" onclick="openUpdateURL(event);" is="text-link">
           &unsupportedLink.label;
         </label>
       </description>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="updatesfoundbasic" pageid="updatesfoundbasic" next="downloading">
+  <wizardpage id="updatesfoundbasic" pageid="updatesfoundbasic"
+              object="gUpdatesFoundBasicPage" next="downloading">
     <updateheader id="updatesFoundBasicHeader" label=""/>
     <vbox class="update-content" flex="1">
       <label id="updatesFoundInto"/>
       <separator class="thin"/>
       <label id="updateName" crop="right" value=""/>
       <separator id="updateNameSep" class="thin"/>
       <label id="upgradeEvangelism">&evangelism.desc;</label>
       <separator id="upgradeEvangelismSep" flex="1"/>
@@ -99,17 +103,18 @@
         <hbox id="moreInfoURL">
           <label id="updateMoreInfoURL" is="text-link"
                  value="&clickHere.label;" onclick="openUpdateURL(event);"/>
         </hbox>
       </vbox>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="downloading" pageid="downloading">
+  <wizardpage id="downloading" pageid="downloading"
+              object="gDownloadingPage">
     <updateheader label="&downloadPage.title;"/>
     <vbox class="update-content" flex="1">
       <hbox id="downloadStatusProgress">
         <html:progress id="downloadProgress" max="100"/>
       </hbox>
       <separator class="thin"/>
       <hbox id="downloadStatusLine">
         <label id="downloadStatus" flex="1">&connecting.label;</label>
@@ -117,57 +122,60 @@
       <separator/>
       <hbox id="verificationFailed" align="start" hidden="true">
         <image id="verificationFailedIcon"/>
         <label flex="1">&verificationFailedText.label;</label>
       </hbox>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="errors" pageid="errors">
+  <wizardpage id="errors" pageid="errors" object="gErrorsPage">
     <updateheader label="&error.title;"/>
     <vbox class="update-content" flex="1">
       <label id="errorIntro">&error.label;</label>
       <separator/>
       <html:textarea class="plain" readonly="readonly" id="errorReason" rows="3"/>
       <separator/>
       <label id="errorManual">&errorManual.label;</label>
       <hbox>
         <label id="errorLinkLabel" value="" is="text-link"
                onclick="openUpdateURL(event);"/>
       </hbox>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="errorextra" pageid="errorextra">
+  <wizardpage id="errorextra" pageid="errorextra"
+              object="gErrorExtraPage">
     <updateheader label="&error.title;"/>
     <vbox class="update-content" flex="1">
       <label id="bgErrorLabel">&genericBackgroundError.label;</label>
       <hbox>
         <label id="errorExtraLinkLabel" is="text-link"
                value="" onclick="openUpdateURL(event);"/>
       </hbox>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="errorpatching" pageid="errorpatching" next="downloading">
+  <wizardpage id="errorpatching" pageid="errorpatching" next="downloading"
+              object="gErrorPatchingPage">
     <updateheader label="&error.title;"/>
     <vbox class="update-content" flex="1">
       <label>&errorpatching.intro;</label>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="finished" pageid="finished">
+  <wizardpage id="finished" pageid="finished" object="gFinishedPage">
     <updateheader label="&finishedPage.title;"/>
     <vbox class="update-content" flex="1">
       <label>&finishedPage.text;</label>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="finishedBackground" pageid="finishedBackground">
+  <wizardpage id="finishedBackground" pageid="finishedBackground"
+              object="gFinishedPage">
     <updateheader label="&finishedPage.title;"/>
     <vbox class="update-content" flex="1">
       <label>&finishedBackgroundPage.text;</label>
       <separator/>
       <hbox align="center">
         <label>&finishedBackground.name;</label>
         <label id="updateFinishedName" flex="1" crop="right" value=""/>
         <label id="finishedBackgroundLink" disabled="true" is="text-link"