Backed out changeset e5f8a98c5e8b (bug 1583414) for sync/browser_contextmenu_send* failures
authorBogdan Tara <btara@mozilla.com>
Wed, 25 Sep 2019 03:12:33 +0300
changeset 494849 a038e6afccbe6ac05279ab14e2d94718b6ba878a
parent 494848 7d339b451192c5cc3053013a8d4e0db4ce50e242
child 494850 9c5d1947a72e9264a5e16be2f3fa82f5edc243fe
push id114131
push userdluca@mozilla.com
push dateThu, 26 Sep 2019 09:47:34 +0000
treeherdermozilla-inbound@1dc1a755079a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1583414
milestone71.0a1
backs oute5f8a98c5e8b4a295001fa54d20da8fcaeff7691
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
Backed out changeset e5f8a98c5e8b (bug 1583414) for sync/browser_contextmenu_send* failures
browser/base/content/browser-sync.js
--- a/browser/base/content/browser-sync.js
+++ b/browser/base/content/browser-sync.js
@@ -112,17 +112,17 @@ var gSync = {
             `Failed to build url filter regexp for send tab: ${e}`
           );
           return null;
         }
       }
     );
     XPCOMUtils.defineLazyPreferenceGetter(
       this,
-      "FXA_ENABLED",
+      "SYNC_ENABLED",
       "identity.fxaccounts.enabled"
     );
   },
 
   maybeUpdateUIState() {
     // Update the UI.
     if (UIState.isReady()) {
       const state = UIState.get();
@@ -136,18 +136,18 @@ var gSync = {
 
   init() {
     if (this._initialized) {
       return;
     }
 
     this._definePrefGetters();
 
-    if (!this.FXA_ENABLED) {
-      this.onFxaDisabled();
+    if (!this.SYNC_ENABLED) {
+      this.onSyncDisabled();
       return;
     }
 
     this._generateNodeGetters();
 
     // Label for the sync buttons.
     if (!this.appMenuLabel) {
       // We are in a window without our elements - just abort now, without
@@ -308,17 +308,17 @@ var gSync = {
     );
 
     bodyNode.removeAttribute("state");
     // In the first ~10 sec after startup, Sync may not be loaded and the list
     // of devices will be empty.
     if (gSync.sendTabConfiguredAndLoading) {
       bodyNode.setAttribute("state", "notready");
     }
-    if (reloadDevices && UIState.get().syncEnabled) {
+    if (reloadDevices) {
       // Force a background Sync
       Services.tm.dispatchToMainThread(async () => {
         // `engines: []` = clients engine only + refresh FxA Devices.
         await Weave.Service.sync({ why: "pageactions", engines: [] });
         if (!window.closed) {
           this.populateSendTabToDevicesView(panelViewNode, false);
         }
       });
@@ -1027,18 +1027,18 @@ var gSync = {
   },
 
   // "Send Tab to Device" menu item
   updateTabContextMenu(aPopupMenu, aTargetTab) {
     // We may get here before initialisation. This situation
     // can lead to a empty label for 'Send To Device' Menu.
     this.init();
 
-    if (!this.FXA_ENABLED) {
-      // These items are hidden in onFxaDisabled(). No need to do anything.
+    if (!this.SYNC_ENABLED) {
+      // These items are hidden in onSyncDisabled(). No need to do anything.
       return;
     }
     let hasASendableURI = false;
     for (let tab of aTargetTab.multiselected
       ? gBrowser.selectedTabs
       : [aTargetTab]) {
       if (this.isSendableURI(tab.linkedBrowser.currentURI.spec)) {
         hasASendableURI = true;
@@ -1059,17 +1059,17 @@ var gSync = {
     ).replace("#1", tabCount.toLocaleString());
     sendTabsToDevice.accessKey = gNavigatorBundle.getString(
       "sendTabsToDevice.accesskey"
     );
   },
 
   // "Send Page to Device" and "Send Link to Device" menu items
   updateContentContextMenu(contextMenu) {
-    if (!this.FXA_ENABLED) {
+    if (!this.SYNC_ENABLED) {
       // These items are hidden by default. No need to do anything.
       return;
     }
     // showSendLink and showSendPage are mutually exclusive
     const showSendLink =
       contextMenu.onSaveableLink || contextMenu.onPlainTextLink;
     const showSendPage =
       !showSendLink &&
@@ -1200,18 +1200,16 @@ var gSync = {
   },
 
   // doSync forces a sync - it *does not* return a promise as it is called
   // via the various UI components.
   doSync() {
     if (!UIState.isReady()) {
       return;
     }
-    // Note we don't bother checking if sync is actually enabled - none of the
-    // UI which calls this function should be visible in that case.
     const state = UIState.get();
     if (state.status == UIState.STATUS_SIGNED_IN) {
       this.updateSyncStatus({ syncing: true });
       Services.tm.dispatchToMainThread(() => {
         // We are pretty confident that push helps us pick up all FxA commands,
         // but some users might have issues with push, so let's unblock them
         // by fetching the missed FxA commands on manual sync.
         fxAccounts.commands.pollDeviceCommands().catch(e => {
@@ -1335,17 +1333,17 @@ var gSync = {
       if (Weave.Service.clientsEngine.stats.numClients > 1) {
         element.setAttribute("devices-status", "multi");
       } else {
         element.setAttribute("devices-status", "single");
       }
     }
   },
 
-  onFxaDisabled() {
+  onSyncDisabled() {
     const toHide = [...document.querySelectorAll(".sync-ui-item")];
     for (const item of toHide) {
       item.hidden = true;
     }
   },
 
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIObserver,