Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1356569 - Remove notifyObservers' last parameter when it is falsy…
Browse files Browse the repository at this point in the history
…, r=jaws.
  • Loading branch information
fqueze committed Apr 14, 2017
1 parent 71b2641 commit 6d1b239
Show file tree
Hide file tree
Showing 218 changed files with 381 additions and 387 deletions.
2 changes: 1 addition & 1 deletion addon-sdk/source/lib/toolkit/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const make = (exports, rootURI, components) => {
// during development is acceptable.
components.classes["@mozilla.org/observer-service;1"].
getService(components.interfaces.nsIObserverService).
notifyObservers({}, "startupcache-invalidate", null);
notifyObservers({}, "startupcache-invalidate");

if (all) {
for (let uri of Object.keys(loader.sandboxes)) {
Expand Down
2 changes: 1 addition & 1 deletion addon-sdk/source/test/addons/e10s-remote/remote-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function listener(event) {
// Use the raw observer service here since it will be usable even if the
// loader has unloaded
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
Services.obs.notifyObservers(null, "Test:Reply", "");
Services.obs.notifyObservers(null, "Test:Reply");
}

frames.port.on('sdk/test/registerframesevent', (frame) => {
Expand Down
2 changes: 1 addition & 1 deletion addon-sdk/source/test/addons/remote/remote-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function listener(event) {
// Use the raw observer service here since it will be usable even if the
// loader has unloaded
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
Services.obs.notifyObservers(null, "Test:Reply", "");
Services.obs.notifyObservers(null, "Test:Reply");
}

frames.port.on('sdk/test/registerframesevent', (frame) => {
Expand Down
2 changes: 1 addition & 1 deletion b2g/chrome/content/devtools/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ var USBRemoteDebugger = {
this._listener.open();
// Temporary event, until bug 942756 lands and offers a way to know
// when the server is up and running.
Services.obs.notifyObservers(null, "debugger-server-started", null);
Services.obs.notifyObservers(null, "debugger-server-started");
} catch (e) {
debug("Unable to start USB debugger server: " + e);
}
Expand Down
6 changes: 3 additions & 3 deletions b2g/chrome/content/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ var shell = {

this.sendEvent(window, 'ContentStart');

Services.obs.notifyObservers(null, 'content-start', null);
Services.obs.notifyObservers(null, 'content-start');

if (AppConstants.MOZ_GRAPHENE &&
Services.prefs.getBoolPref("b2g.nativeWindowGeometry.fullscreen")) {
Expand Down Expand Up @@ -732,7 +732,7 @@ var shell = {

// This will cause Gonk Widget to remove boot animation from the screen
// and reveals the page.
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
Services.obs.notifyObservers(null, "browser-ui-startup-complete");

SystemAppProxy.setIsLoaded();
},
Expand Down Expand Up @@ -797,7 +797,7 @@ var CustomEventManager = {

switch(detail.type) {
case 'system-message-listener-ready':
Services.obs.notifyObservers(null, 'system-message-listener-ready', null);
Services.obs.notifyObservers(null, 'system-message-listener-ready');
break;
case 'captive-portal-login-cancel':
CaptivePortalLoginHelper.handleEvent(detail);
Expand Down
4 changes: 2 additions & 2 deletions b2g/components/GlobalSimulatorScreen.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ this.GlobalSimulatorScreen = {
this.mozOrientation = orientation;

// Notify each app screen object to fire the event
Services.obs.notifyObservers(null, 'simulator-orientation-change', null);
Services.obs.notifyObservers(null, 'simulator-orientation-change');
}

// Finally, in any case, we update the window size and orientation
// (Use wrappedJSObject trick to be able to pass a raw JS object)
Services.obs.notifyObservers({wrappedJSObject:this}, 'simulator-adjust-window-size', null);
Services.obs.notifyObservers({wrappedJSObject:this}, 'simulator-adjust-window-size');
},

flipScreen: function() {
Expand Down
2 changes: 1 addition & 1 deletion b2g/components/SafeMode.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ this.SafeMode = {

// browser-ui-startup-complete is used by the AppShell to stop the
// boot animation and start gecko rendering.
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
Services.obs.notifyObservers(null, "browser-ui-startup-complete");
content.addEventListener("mozContentEvent", handleEvent, true);
}

Expand Down
4 changes: 2 additions & 2 deletions b2g/components/test/unit/test_aboutserviceworkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ var mockSendResult = (aId, aResult) => {
id: aId,
result: aResult
};
Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG, null);
Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG);
};

var mockSendError = (aId, aError) => {
let msg = {
id: aId,
result: aError
};
Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG, null);
Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG);
};

function attachMocks() {
Expand Down
2 changes: 1 addition & 1 deletion b2g/components/test/unit/test_fxaccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ do_get_profile();

// Mock the system app proxy; make message passing possible
var mockSendCustomEvent = function(aEventName, aMsg) {
Services.obs.notifyObservers({wrappedJSObject: aMsg}, aEventName, null);
Services.obs.notifyObservers({wrappedJSObject: aMsg}, aEventName);
};

function run_test() {
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/browser-data-submission-info-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var gDataNotificationInfoBar = {
buttons,
event => {
if (event == "removed") {
Services.obs.notifyObservers(null, "datareporting:notify-data-policy:close", null);
Services.obs.notifyObservers(null, "datareporting:notify-data-policy:close");
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/browser-fullScreenAndPointerLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ var FullScreen = {
break;
}
case "DOMFullscreen:Painted": {
Services.obs.notifyObservers(window, "fullscreen-painted", "");
Services.obs.notifyObservers(window, "fullscreen-painted");
TelemetryStopwatch.finish("FULLSCREEN_CHANGE_MS");
break;
}
Expand Down
8 changes: 4 additions & 4 deletions browser/base/content/browser-fullZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ var FullZoom = {
if (token.isCurrent) {
ZoomManager.setZoomForBrowser(browser, value === undefined ? 1 : value);
this._ignorePendingZoomAccesses(browser);
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset");
}
});
this._removePref(browser);
Expand Down Expand Up @@ -355,7 +355,7 @@ var FullZoom = {
* @param browser The zoom of this browser will be saved. Required.
*/
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange");
if (!this.siteSpecific ||
gInPrintPreviewMode ||
browser.isSyntheticDocument)
Expand All @@ -376,7 +376,7 @@ var FullZoom = {
* @param browser The zoom of this browser will be removed. Required.
*/
_removePref: function FullZoom__removePref(browser) {
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset");
if (browser.isSyntheticDocument)
return;
let ctxt = this._loadContextFromBrowser(browser);
Expand Down Expand Up @@ -514,7 +514,7 @@ var FullZoom = {
*/
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
this._executeSoon(function() {
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change");
});
},

Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/browser-syncui.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ var gSyncUI = {
if (!needsSetup) {
setTimeout(() => Weave.Service.errorHandler.syncAndReportErrors(), 0);
}
Services.obs.notifyObservers(null, "cloudsync:user-sync", null);
Services.obs.notifyObservers(null, "cloudsync:user-sync");
}).catch(err => {
this.log.error("Failed to force a sync", err);
});
Expand Down
17 changes: 8 additions & 9 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ var gBrowserInit = {
// their tasks BEFORE the browser window is shown. SessionStore uses it to
// restore tabs into windows AFTER important parts like gMultiProcessBrowser
// have been initialized.
Services.obs.notifyObservers(window, "browser-window-before-show", "");
Services.obs.notifyObservers(window, "browser-window-before-show");

let isResistFingerprintingEnabled = gPrefService.getBoolPref("privacy.resistFingerprinting");

Expand Down Expand Up @@ -1606,7 +1606,7 @@ var gBrowserInit = {

this.delayedStartupFinished = true;

Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
Services.obs.notifyObservers(window, "browser-delayed-startup-finished");
TelemetryTimestamps.add("delayedStartupFinished");
},

Expand Down Expand Up @@ -6160,7 +6160,7 @@ var BrowserOffline = {
_canGoOffline() {
try {
var cancelGoOffline = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelGoOffline, "offline-requested", null);
Services.obs.notifyObservers(cancelGoOffline, "offline-requested");

// Something aborted the quit process.
if (cancelGoOffline.data)
Expand Down Expand Up @@ -6489,8 +6489,7 @@ function warnAboutClosingWindow() {
createInstance(Ci.nsISupportsPRBool);
exitingCanceled.data = false;
Services.obs.notifyObservers(exitingCanceled,
"last-pb-context-exiting",
null);
"last-pb-context-exiting");
if (exitingCanceled.data)
return false;
}
Expand All @@ -6504,11 +6503,11 @@ function warnAboutClosingWindow() {
let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
os.notifyObservers(closingCanceled,
"browser-lastwindow-close-requested", null);
"browser-lastwindow-close-requested");
if (closingCanceled.data)
return false;

os.notifyObservers(null, "browser-lastwindow-close-granted", null);
os.notifyObservers(null, "browser-lastwindow-close-granted");

// OS X doesn't quit the application when the last window is closed, but keeps
// the session alive. Hence don't prompt users to save tabs, but warn about
Expand Down Expand Up @@ -6566,7 +6565,7 @@ function BrowserOpenAddonsMgr(aView) {
}
}
Services.obs.addObserver(receivePong, "EM-pong");
Services.obs.notifyObservers(null, "EM-ping", "");
Services.obs.notifyObservers(null, "EM-ping");
Services.obs.removeObserver(receivePong, "EM-pong");

if (emWindow) {
Expand Down Expand Up @@ -8129,7 +8128,7 @@ function safeModeRestart() {
return;
}

Services.obs.notifyObservers(null, "restart-in-safe-mode", "");
Services.obs.notifyObservers(null, "restart-in-safe-mode");
}

/* duplicateTabIn duplicates tab in a place specified by the parameter |where|.
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ var handleContentContextMenu = function(event) {
addonInfo,
};
subject.wrappedJSObject = subject;
Services.obs.notifyObservers(subject, "content-contextmenu", null);
Services.obs.notifyObservers(subject, "content-contextmenu");

let doc = event.target.ownerDocument;
let docLocation = doc.mozDocumentURIIfNotForErrorPages;
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/nsContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ nsContextMenu.prototype = {
frameId: this.frameOuterWindowID,
};
subject.wrappedJSObject = subject;
Services.obs.notifyObservers(subject, "on-build-contextmenu", null);
Services.obs.notifyObservers(subject, "on-build-contextmenu");
}

this.isFrameImage = document.getElementById("isFrameImage");
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/pageinfo/pageInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function onLoadPageInfo() {
loadTab(args);
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "page-info-dialog-loaded", null);
.notifyObservers(window, "page-info-dialog-loaded");
}

function loadPageInfo(frameOuterWindowID, imageElement, browser) {
Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/sanitize.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Sanitizer.prototype = {
try {
yield promise;
} finally {
Services.obs.notifyObservers(null, "sanitizer-sanitization-complete", "");
Services.obs.notifyObservers(null, "sanitizer-sanitization-complete");
}
}),

Expand Down Expand Up @@ -437,7 +437,7 @@ Sanitizer.prototype = {
sdr.logoutAndTeardown();

// clear FTP and plain HTTP auth sessions
Services.obs.notifyObservers(null, "net:clear-active-logins", null);
Services.obs.notifyObservers(null, "net:clear-active-logins");
} finally {
TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS", refObj);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_task(function* test_settingsOpen_observer() {
info("simulate a notifications-open-settings notification");
let uri = NetUtil.newURI("https://example.com");
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.obs.notifyObservers(principal, "notifications-open-settings", null);
Services.obs.notifyObservers(principal, "notifications-open-settings");
let tab = yield tabPromise;
ok(tab, "The notification settings tab opened");
yield BrowserTestUtils.removeTab(tab);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ add_task(function* checkCaptivePortalCertErrorUI() {
let captivePortalStatePropagated = TestUtils.topicObserved("ipc:network:captive-portal-set-state");

info("Checking that the alternate about:certerror UI is shown when we are behind a captive portal.");
Services.obs.notifyObservers(null, "captive-portal-login", null);
Services.obs.notifyObservers(null, "captive-portal-login");

info("Waiting for captive portal state to be propagated to the content process.");
yield captivePortalStatePropagated;
Expand Down Expand Up @@ -67,7 +67,7 @@ add_task(function* checkCaptivePortalCertErrorUI() {
let portalTabRemoved = BrowserTestUtils.tabRemoved(portalTab);
let errorTabReloaded = BrowserTestUtils.waitForErrorPage(browser);

Services.obs.notifyObservers(null, "captive-portal-login-success", null);
Services.obs.notifyObservers(null, "captive-portal-login-success");
yield portalTabRemoved;

info("Waiting for error tab to be reloaded after the captive portal was freed.");
Expand Down
6 changes: 3 additions & 3 deletions browser/base/content/test/captivePortal/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ function* setupPrefsAndRecentWindowBehavior() {
}

function* portalDetected() {
Services.obs.notifyObservers(null, "captive-portal-login", null);
Services.obs.notifyObservers(null, "captive-portal-login");
yield BrowserTestUtils.waitForCondition(() => {
return cps.state == cps.LOCKED_PORTAL;
}, "Waiting for Captive Portal Service to update state after portal detected.");
}

function* freePortal(aSuccess) {
Services.obs.notifyObservers(null,
"captive-portal-login-" + (aSuccess ? "success" : "abort"), null);
"captive-portal-login-" + (aSuccess ? "success" : "abort"));
yield BrowserTestUtils.waitForCondition(() => {
return cps.state != cps.LOCKED_PORTAL;
}, "Waiting for Captive Portal Service to update state after portal freed.");
Expand Down Expand Up @@ -76,7 +76,7 @@ function* focusWindowAndWaitForPortalUI(aLongRecheck, win) {
yield BrowserTestUtils.waitForCondition(() => {
return win.CaptivePortalWatcher._waitingForRecheck;
}, "Waiting for CaptivePortalWatcher to trigger a recheck.");
Services.obs.notifyObservers(null, "captive-portal-check-complete", null);
Services.obs.notifyObservers(null, "captive-portal-check-complete");

let notification = ensurePortalNotification(win);

Expand Down
8 changes: 4 additions & 4 deletions browser/base/content/test/general/browser_fxaccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const TEST_ROOT = "http://example.com/browser/browser/base/content/test/general/
let stubs = {
updateUI() {
return unstubs["updateUI"].call(gFxAccounts).then(() => {
Services.obs.notifyObservers(null, "test:browser_fxaccounts:updateUI", null);
Services.obs.notifyObservers(null, "test:browser_fxaccounts:updateUI");
});
},
// Opening preferences is trickier than it should be as leaks are reported
// due to the promises it fires off at load time and there's no clear way to
// know when they are done.
// So just ensure openPreferences is called rather than whether it opens.
openPreferences() {
Services.obs.notifyObservers(null, "test:browser_fxaccounts:openPreferences", null);
Services.obs.notifyObservers(null, "test:browser_fxaccounts:openPreferences");
}
};

Expand Down Expand Up @@ -73,7 +73,7 @@ add_task(function* test_nouser() {
let user = yield fxAccounts.getSignedInUser();
Assert.strictEqual(user, null, "start with no user signed in");
let promiseUpdateDone = promiseObserver("test:browser_fxaccounts:updateUI");
Services.obs.notifyObservers(null, this.FxAccountsCommon.ONLOGOUT_NOTIFICATION, null);
Services.obs.notifyObservers(null, this.FxAccountsCommon.ONLOGOUT_NOTIFICATION);
yield promiseUpdateDone;

// Check the world - the FxA footer area is visible as it is offering a signin.
Expand Down Expand Up @@ -152,7 +152,7 @@ add_task(function* test_verifiedUserDisplayName() {
add_task(function* test_profileNotificationsClearsCache() {
let promiseUpdateDone = promiseObserver("test:browser_fxaccounts:updateUI", 1);
gFxAccounts._cachedProfile = { foo: "bar" };
Services.obs.notifyObservers(null, this.FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION, null);
Services.obs.notifyObservers(null, this.FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION);
Assert.ok(!gFxAccounts._cachedProfile);
yield promiseUpdateDone;
});
Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/test/general/browser_syncui.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function notifyAndPromiseUIUpdated(topic) {
});
};
// Now send the notification.
Services.obs.notifyObservers(null, topic, null);
Services.obs.notifyObservers(null, topic);
});
}

Expand Down Expand Up @@ -84,7 +84,7 @@ add_task(function* prepare() {
window.gSyncUI._needsSetup = oldNeedsSetup;
// and an observer to set the state back to what it should be now we've
// restored the stub.
Services.obs.notifyObservers(null, "weave:service:login:finish", null);
Services.obs.notifyObservers(null, "weave:service:login:finish");
});
// and a notification to have the state change away from "needs setup"
yield notifyAndPromiseUIUpdated("weave:service:login:finish");
Expand Down
Loading

0 comments on commit 6d1b239

Please sign in to comment.