Bug 1317164 - ensure browser_967000_button_sync.js cleans up after itself completely. r?malayaleecoder
MozReview-Commit-ID: DO5RbkGj0Dv
--- a/browser/components/customizableui/test/browser_967000_button_sync.js
+++ b/browser/components/customizableui/test/browser_967000_button_sync.js
@@ -37,18 +37,28 @@ let mockedInternal = {
hasSyncedThisSession: false,
};
add_task(function* setup() {
let oldInternal = SyncedTabs._internal;
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;
+ }
+
registerCleanupFunction(() => {
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
function* openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
info("Check Sync button functionality");
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");