Bug 1397744 - Show the Sync animation immediately after clicking the manual sync button. r=markh
☠☠ backed out by a4c7a0be9833 ☠ ☠
authorEdouard Oger <eoger@fastmail.com>
Wed, 20 Sep 2017 13:16:19 -0400
changeset 383531 8855ba3f65ba482513c0bfe322b351d4555d8619
parent 383530 7dcc9de817630a81d69720554d733018433b45d3
child 383532 50958575534033662c87ef2423922a1ad2cc96c4
push id52280
push usereoger@mozilla.com
push dateThu, 28 Sep 2017 17:01:10 +0000
treeherderautoland@8855ba3f65ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1397744
milestone58.0a1
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
Bug 1397744 - Show the Sync animation immediately after clicking the manual sync button. r=markh MozReview-Commit-ID: AIBjAZZlYX6
browser/base/content/browser-sync.js
browser/components/customizableui/test/browser_synced_tabs_menu.js
--- a/browser/base/content/browser-sync.js
+++ b/browser/base/content/browser-sync.js
@@ -519,16 +519,17 @@ 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;
     }
     const state = UIState.get();
     if (state.status == UIState.STATUS_SIGNED_IN) {
+      this.updateSyncStatus({ syncing: true });
       setTimeout(() => Weave.Service.errorHandler.syncAndReportErrors(), 0);
     }
   },
 
   openPrefs(entryPoint = "syncbutton", origin = undefined) {
     window.openPreferences("paneSync", { origin, urlParams: { entrypoint: entryPoint } });
   },
 
--- a/browser/components/customizableui/test/browser_synced_tabs_menu.js
+++ b/browser/components/customizableui/test/browser_synced_tabs_menu.js
@@ -2,16 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 requestLongerTimeout(2);
 
 let {SyncedTabs} = Cu.import("resource://services-sync/SyncedTabs.jsm", {});
+Cu.import("resource://services-sync/UIState.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "UITour", "resource:///modules/UITour.jsm");
 
 // These are available on the widget implementation, but it seems impossible
 // to grab that impl at runtime.
 const DECKINDEX_TABS = 0;
 const DECKINDEX_TABSDISABLED = 1;
 const DECKINDEX_FETCHING = 2;
@@ -43,18 +44,22 @@ add_task(async function setup() {
   SyncedTabs._internal = mockedInternal;
 
   // This test hacks some observer states to simulate a user being signed
   // in to Sync - restore them when the test completes.
   let initialObserverStates = {};
   for (let id of ["sync-reauth-state", "sync-setup-state", "sync-syncnow-state"]) {
     initialObserverStates[id] = document.getElementById(id).hidden;
   }
+  let origNotifyStateUpdated = UIState._internal.notifyStateUpdated;
+  // Sync start-up will interfere with our tests, don't let UIState send UI updates.
+  UIState._internal.notifyStateUpdated = () => {};
 
   registerCleanupFunction(() => {
+    UIState._internal.notifyStateUpdated = origNotifyStateUpdated;
     SyncedTabs._internal = oldInternal;
     for (let [id, initial] of Object.entries(initialObserverStates)) {
       document.getElementById(id).hidden = initial;
     }
   });
 });
 
 // The test expects the about:preferences#sync page to open in the current tab