Backed out changeset 8a9ead048034 (bug 1516767) for setting wrong bug number. a=backout
authorGurzau Raul <rgurzau@mozilla.com>
Tue, 28 May 2019 02:43:04 +0300
changeset 536500 97158e94fd0a16e451db9720d64bdfc7df4c685e
parent 536499 67d20a416452bedd1df182229de370b3e32e4212
child 536501 6ec3cb391f03a3d02c47e3cb4525fe9eb6abd242
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1516767
milestone68.0
backs out8a9ead04803465749d2cb41a9ca00cc72a050815
Backed out changeset 8a9ead048034 (bug 1516767) for setting wrong bug number. 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,updates.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,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,59 +211,38 @@ 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;
-    if ("onWizardCancel" in this._pages[pageid])
-      this._pages[pageid].onWizardCancel();
+    let cancelEvent = new CustomEvent("wizardpagecancel", { });
+    document.documentElement.currentPage.dispatchEvent(cancelEvent);
     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
@@ -289,51 +268,61 @@ 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,64 +38,60 @@
 
   <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"
-              object="gCheckingPage">
+  <wizardpage id="checking" pageid="checking" next="noupdatesfound">
     <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"
-              object="gNoUpdatesPage">
+  <wizardpage id="noupdatesfound" pageid="noupdatesfound">
     <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" object="gManualUpdatePage">
+  <wizardpage id="manualUpdate" pageid="manualUpdate">
     <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"
-              object="gUnsupportedPage">
+  <wizardpage id="unsupported" pageid="unsupported">
     <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"
-              object="gUpdatesFoundBasicPage" next="downloading">
+  <wizardpage id="updatesfoundbasic" pageid="updatesfoundbasic" 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"/>
@@ -103,18 +99,17 @@
         <hbox id="moreInfoURL">
           <label id="updateMoreInfoURL" is="text-link"
                  value="&clickHere.label;" onclick="openUpdateURL(event);"/>
         </hbox>
       </vbox>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="downloading" pageid="downloading"
-              object="gDownloadingPage">
+  <wizardpage id="downloading" pageid="downloading">
     <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>
@@ -122,60 +117,57 @@
       <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" object="gErrorsPage">
+  <wizardpage id="errors" pageid="errors">
     <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"
-              object="gErrorExtraPage">
+  <wizardpage id="errorextra" pageid="errorextra">
     <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"
-              object="gErrorPatchingPage">
+  <wizardpage id="errorpatching" pageid="errorpatching" next="downloading">
     <updateheader label="&error.title;"/>
     <vbox class="update-content" flex="1">
       <label>&errorpatching.intro;</label>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="finished" pageid="finished" object="gFinishedPage">
+  <wizardpage id="finished" pageid="finished">
     <updateheader label="&finishedPage.title;"/>
     <vbox class="update-content" flex="1">
       <label>&finishedPage.text;</label>
     </vbox>
   </wizardpage>
 
-  <wizardpage id="finishedBackground" pageid="finishedBackground"
-              object="gFinishedPage">
+  <wizardpage id="finishedBackground" pageid="finishedBackground">
     <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"