Bug 1365133 - Properly clean up an observer as well as remove an observer notification that was unreferenced. r?evanxd
MozReview-Commit-ID: 3VMa53frUIz
--- a/browser/components/preferences/in-content-new/privacy.js
+++ b/browser/components/preferences/in-content-new/privacy.js
@@ -283,21 +283,16 @@ var gPrivacyPane = {
appendSearchKeywords("viewSecurityDevicesButton", [
pkiBundle.getString("enable_fips"),
]);
appendSearchKeywords("siteDataSettings", [
bundlePrefs.getString("siteDataSettings.description"),
bundlePrefs.getString("removeAllCookies.label"),
bundlePrefs.getString("removeSelectedCookies.label"),
]);
-
- // Notify observers that the UI is now ready
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .notifyObservers(window, "privacy-pane-loaded");
},
// TRACKING PROTECTION MODE
/**
* Selects the right item of the Tracking Protection radiogroup.
*/
trackingProtectionReadPrefs() {
--- a/browser/components/preferences/in-content-new/tests/browser_change_app_handler.js
+++ b/browser/components/preferences/in-content-new/tests/browser_change_app_handler.js
@@ -13,24 +13,20 @@ function setupFakeHandler() {
gHandlerSvc.store(infoToModify);
}
add_task(async function() {
setupFakeHandler();
// Ensure general pane is loaded before testing.
- let isGeneralPaneLoaded = false;
- Services.obs.addObserver(() => {
- isGeneralPaneLoaded = true;
- }, "main-pane-loaded");
-
+ let generalPaneLoadedPromise = TestUtils.topicObserved("main-pane-loaded", () => true);
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
- await BrowserTestUtils.waitForCondition(() => isGeneralPaneLoaded);
+ await generalPaneLoadedPromise;
let win = gBrowser.selectedBrowser.contentWindow;
let container = win.document.getElementById("handlersView");
let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']");
ok(ourItem, "handlersView is present");
ourItem.scrollIntoView();
container.selectItem(ourItem);
ok(ourItem.selected, "Should be able to select our item.");