--- a/accessible/tests/mochitest/test_nsIAccessibleDocument.html
+++ b/accessible/tests/mochitest/test_nsIAccessibleDocument.html
@@ -62,17 +62,17 @@ https://bugzilla.mozilla.org/show_bug.cg
domDoc = docAcc.DOMDocument.QueryInterface(nsIDOMDocument);
} catch (e) {}
ok(domDoc, "no nsIDOMDocument for this doc accessible!");
is(domDoc, document, "Document nodes do not match!");
// Test for correct nsIDOMWindow retrieval.
var domWindow = null;
try {
- domWindow = docAcc.window.QueryInterface(nsIDOMWindow);
+ domWindow = docAcc.window;
} catch (e) {}
ok(domWindow, "no nsIDOMWindow for this doc accessible!");
is(domWindow, window, "Window nodes do not match!");
}
SimpleTest.finish();
}
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6841,17 +6841,17 @@ var CanvasPermissionPromptHelper = {
// aData is an URL string.
observe(aSubject, aTopic, aData) {
if (aTopic != this._permissionsPrompt) {
return;
}
let browser;
if (aSubject instanceof Ci.nsIDOMWindow) {
- let contentWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ let contentWindow = aSubject;
browser = gBrowser.getBrowserForContentWindow(contentWindow);
} else {
browser = aSubject.QueryInterface(Ci.nsIBrowser);
}
let uri = Services.io.newURI(aData);
if (gBrowser.selectedBrowser !== browser) {
// Must belong to some other window.
@@ -7217,17 +7217,16 @@ function BrowserOpenAddonsMgr(aView) {
"tab";
openTrustedLinkIn("about:addons", whereToOpen);
Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
Services.obs.removeObserver(observer, aTopic);
if (aView) {
aSubject.loadView(aView);
}
- aSubject.QueryInterface(Ci.nsIDOMWindow);
aSubject.focus();
resolve(aSubject);
}, "EM-loaded");
});
}
function AddKeywordForSearchField() {
let mm = gBrowser.selectedBrowser.messageManager;
--- a/browser/base/content/test/general/browser_newwindow_focus.js
+++ b/browser/base/content/test/general/browser_newwindow_focus.js
@@ -14,20 +14,19 @@ const PAGE = `data:text/html,<a id="targ
* because by the time the "then" on the Promise runs,
* DOMContentLoaded and load may have already run in the new
* window. However, we want to be very explicit about what
* events we're waiting for, and not rely on a quirk of our
* Promises infrastructure.
*/
function promiseNewWindow() {
return new Promise((resolve) => {
- let observer = (subject, topic, data) => {
+ let observer = (win, topic, data) => {
if (topic == "domwindowopened") {
Services.ww.unregisterNotification(observer);
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
resolve(win);
}, {once: true});
}
};
Services.ww.registerNotification(observer);
});
--- a/browser/base/content/test/sanitize/browser_sanitizeDialog.js
+++ b/browser/base/content/test/sanitize/browser_sanitizeDialog.js
@@ -777,24 +777,23 @@ WindowHelper.prototype = {
* when done so that the tests may continue. Set this.onunload to a function
* to execute onunload. this.onunload is optional. If it returns true, the
* caller is expected to call promiseAsyncUpdates at some point; if false is
* returned, promiseAsyncUpdates is called automatically.
*/
open() {
let wh = this;
- function windowObserver(aSubject, aTopic, aData) {
+ function windowObserver(win, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
var loaded = false;
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function onload(event) {
if (win.name !== "SanitizeDialog")
return;
wh.win = win;
loaded = true;
executeSoon(() => wh.onload());
--- a/browser/base/content/test/webrtc/head.js
+++ b/browser/base/content/test/webrtc/head.js
@@ -46,17 +46,16 @@ function promiseWaitForCondition(aCondit
* The url of the window.
* @return {Promise} resolved when the window exists.
* @resolves to the window
*/
function promiseWindow(url) {
info("expecting a " + url + " window");
return new Promise(resolve => {
Services.obs.addObserver(function obs(win) {
- win.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
if (win.location.href !== url) {
info("ignoring a window with this url: " + win.location.href);
return;
}
Services.obs.removeObserver(obs, "domwindowopened");
executeSoon(() => resolve(win));
--- a/browser/components/customizableui/test/browser_947914_button_newPrivateWindow.js
+++ b/browser/components/customizableui/test/browser_947914_button_newPrivateWindow.js
@@ -15,17 +15,17 @@ add_task(async function() {
info("Menu panel was opened");
let windowWasHandled = false;
let privateWindow = null;
let observerWindowOpened = {
observe(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- privateWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ privateWindow = aSubject;
privateWindow.addEventListener("load", function() {
is(privateWindow.location.href, "chrome://browser/content/browser.xul",
"A new browser window was opened");
ok(PrivateBrowsingUtils.isWindowPrivate(privateWindow), "Window is private");
windowWasHandled = true;
}, {once: true});
}
}
--- a/browser/components/customizableui/test/browser_947914_button_newWindow.js
+++ b/browser/components/customizableui/test/browser_947914_button_newWindow.js
@@ -15,17 +15,17 @@ add_task(async function() {
info("Menu panel was opened");
let windowWasHandled = false;
let newWindow = null;
let observerWindowOpened = {
observe(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ newWindow = aSubject;
newWindow.addEventListener("load", function() {
is(newWindow.location.href, "chrome://browser/content/browser.xul",
"A new browser window was opened");
ok(!PrivateBrowsingUtils.isWindowPrivate(newWindow), "Window is not private");
windowWasHandled = true;
}, {once: true});
}
}
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -399,21 +399,20 @@ function open_properties_dialog(test) {
await BrowserTestUtils.waitForCondition(() => tree, "Sidebar tree has been loaded");
// Ask current test to select the node to edit.
test.selectNode(tree);
Assert.ok(tree.selectedNode,
"We have a places node selected: " + tree.selectedNode.title);
// Wait for the Properties dialog.
- function windowObserver(aSubject, aTopic, aData) {
+ function windowObserver(observerWindow, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
- let observerWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
waitForFocus(async () => {
// Ensure overlay is loaded
await BrowserTestUtils.waitForCondition(
() => observerWindow.gEditItemOverlay.initialized, "EditItemOverlay is initialized");
test.window = observerWindow;
try {
executeSoon(resolve);
} catch (ex) {
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -164,17 +164,17 @@ function isToolbarVisible(aToolbar) {
*/
var withBookmarksDialog = async function(autoCancel, openFn, taskFn, closeFn,
dialogUrl = "chrome://browser/content/places/bookmarkProperties",
skipOverlayWait = false) {
let closed = false;
let dialogPromise = new Promise(resolve => {
Services.ww.registerNotification(function winObserver(subject, topic, data) {
if (topic == "domwindowopened") {
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
+ let win = subject;
win.addEventListener("load", function() {
ok(win.location.href.startsWith(dialogUrl),
"The bookmark properties dialog is open: " + win.location.href);
// This is needed for the overlay.
waitForFocus(() => {
resolve(win);
}, win);
}, {once: true});
--- a/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js
+++ b/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js
@@ -89,17 +89,17 @@ add_task(async function test() {
gProgressListener.unsetCallback();
resolve();
});
});
// We also want to catch the extra windows (there should be 2), so we need to observe domwindowopened
Services.ww.registerNotification(function observer(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ let win = aSubject;
win.addEventListener("load", function() {
Services.ww.unregisterNotification(observer);
win.gBrowser.addTabsProgressListener(gProgressListener);
}, {once: true});
}
});
let backupState = ss.getBrowserState();
--- a/browser/components/sessionstore/test/browser_586068-multi_window.js
+++ b/browser/components/sessionstore/test/browser_586068-multi_window.js
@@ -46,17 +46,17 @@ add_task(async function test() {
resolve();
}
});
});
// We also want to catch the 2nd window, so we need to observe domwindowopened
Services.ww.registerNotification(function observer(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ let win = aSubject;
win.addEventListener("load", function() {
Services.ww.unregisterNotification(observer);
win.gBrowser.addTabsProgressListener(gProgressListener);
}, {once: true});
}
});
let backupState = ss.getBrowserState();
--- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setBrowserState.js
+++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setBrowserState.js
@@ -40,17 +40,17 @@ function test() {
// waitForBrowserState does it's own observing for windows, but doesn't attach
// the listeners we want here, so do it ourselves.
let newWindow;
function windowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
Services.ww.unregisterNotification(windowObserver);
- newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ newWindow = aSubject;
newWindow.addEventListener("load", function() {
windowEvents[getOuterWindowID(newWindow)] = { busyEventCount: 0, readyEventCount: 0 };
newWindow.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
newWindow.addEventListener("SSWindowStateReady", onSSWindowStateReady);
}, {once: true});
}
}
--- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseWindow.js
+++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseWindow.js
@@ -26,17 +26,17 @@ const lameMultiWindowState = { windows:
function test() {
/** Test for Bug 615394 - Session Restore should notify when it is beginning and ending a restore **/
waitForExplicitFinish();
let newWindow, reopenedWindow;
function firstWindowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ newWindow = aSubject;
Services.ww.unregisterNotification(firstWindowObserver);
}
}
Services.ww.registerNotification(firstWindowObserver);
waitForBrowserState(lameMultiWindowState, function() {
// Close the window which isn't window
BrowserTestUtils.closeWindow(newWindow).then(() => {
--- a/browser/components/sessionstore/test/head.js
+++ b/browser/components/sessionstore/test/head.js
@@ -118,17 +118,17 @@ function waitForBrowserState(aState, aSe
executeSoon(aSetStateCallback);
}
}
// Used to add our listener to further windows so we can catch SSTabRestored
// coming from them when creating a multi-window state.
function windowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- let newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ let newWindow = aSubject;
newWindow.addEventListener("load", function() {
if (++windowsOpen == expectedWindows) {
Services.ww.unregisterNotification(windowObserver);
windowObserving = false;
}
// Track this window so we can remove the progress listener later
windows.push(newWindow);
--- a/browser/components/tests/browser/browser_bug538331.js
+++ b/browser/components/tests/browser/browser_bug538331.js
@@ -152,22 +152,21 @@ var gWindowCatcher = {
this.finish(this.finishFunc);
}
},
windowLoad(win) {
executeSoon(this.closeWindow.bind(this, win));
},
- observe(subject, topic, data) {
+ observe(win, topic, data) {
if (topic != "domwindowopened")
return;
this.windowsOpen++;
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
info("window catcher caught window opening: " + win.document.documentURI);
win.addEventListener("load", function() {
gWindowCatcher.windowLoad(win);
}, {once: true});
}
};
function finish_test() {
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -132,18 +132,17 @@ function startup(data) {
function shutdown() {
resProto.setSubstitution(RESOURCE_HOST, null);
Services.mm.removeMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
let enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
- let domWindow = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
- let cachedStyleSheets = CACHED_STYLESHEETS.get(domWindow);
+ let cachedStyleSheets = CACHED_STYLESHEETS.get(win);
if (!cachedStyleSheets) {
continue;
}
while (cachedStyleSheets.length !== 0) {
cachedStyleSheets.pop().remove();
}
--- a/browser/modules/ProcessHangMonitor.jsm
+++ b/browser/modules/ProcessHangMonitor.jsm
@@ -238,27 +238,27 @@ var ProcessHangMonitor = {
case "clear-hang-report": {
this.clearHang(subject.QueryInterface(Ci.nsIHangReport));
break;
}
case "domwindowopened": {
// Install event listeners on the new window in case one of
// its tabs is already hung.
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
+ let win = subject;
let listener = (ev) => {
win.removeEventListener("load", listener, true);
this.updateWindows();
};
win.addEventListener("load", listener, true);
break;
}
case "domwindowclosed": {
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
+ let win = subject;
this.onWindowClosed(win);
break;
}
}
},
/**
* Called early on in the shutdown sequence. We take this opportunity to
--- a/devtools/client/scratchpad/test/browser_scratchpad_sessions.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_sessions.js
@@ -36,17 +36,17 @@ function test() {
Services.ww.registerNotification(windowObserver);
SessionStore.setBrowserState(JSON.stringify(testState));
}
function windowObserver(subject, topic, data) {
if (topic == "domwindowopened") {
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
+ let win = subject;
win.addEventListener("load", function() {
if (win.Scratchpad) {
win.Scratchpad.addObserver({
onReady() {
win.Scratchpad.removeObserver(this);
let state = win.Scratchpad.getState();
BrowserTestUtils.closeWindow(win).then(() => {
--- a/devtools/client/shared/test/browser_telemetry_button_scratchpad.js
+++ b/devtools/client/shared/test/browser_telemetry_button_scratchpad.js
@@ -36,17 +36,17 @@ add_task(async function() {
function trackScratchpadWindows() {
info("register the window observer to track when scratchpad windows open");
let numScratchpads = 0;
return new Promise(resolve => {
Services.ww.registerNotification(function observer(subject, topic) {
if (topic == "domwindowopened") {
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
+ let win = subject;
win.addEventListener("load", function() {
if (win.Scratchpad) {
win.Scratchpad.addObserver({
onReady: function() {
win.Scratchpad.removeObserver(this);
numScratchpads++;
win.close();
--- a/devtools/server/actors/child-process.js
+++ b/devtools/server/actors/child-process.js
@@ -28,17 +28,17 @@ function ChildProcessActor(connection) {
shouldAddNewGlobalAsDebuggee: global => true
});
let sandboxPrototype = {
get tabs() {
let tabs = [];
let windowEnumerator = Services.ww.getWindowEnumerator();
while (windowEnumerator.hasMoreElements()) {
- let window = windowEnumerator.getNext().QueryInterface(Ci.nsIDOMWindow);
+ let window = windowEnumerator.getNext();
let tabChildGlobal = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.sameTypeRootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIContentFrameMessageManager);
tabs.push(tabChildGlobal);
}
return tabs;
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -648,18 +648,16 @@ DevToolsUtils.makeInfallible(function(wi
});
/*
* You can hardly do anything at all with a XUL window at this point; it
* doesn't even have its document yet. Wait until its document has
* loaded, and then see what we've got. This also avoids
* nsIWindowMediator enumeration from within listeners (bug 873589).
*/
- window = window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
window.addEventListener("load", handleLoad);
}, "BrowserTabList.prototype.onOpenWindow");
BrowserTabList.prototype.onCloseWindow =
DevToolsUtils.makeInfallible(function(window) {
window = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
--- a/layout/tools/reftest/bootstrap.js
+++ b/layout/tools/reftest/bootstrap.js
@@ -11,17 +11,17 @@ var WindowListener = {
onOpenWindow: function(win) {
Services.wm.removeListener(WindowListener);
win = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function listener() {
// Load into any existing windows.
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
- win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
+ win = windows.getNext();
break;
}
ChromeUtils.import("chrome://reftest/content/reftest.jsm");
win.addEventListener("pageshow", function() {
// Add setTimeout here because windows.innerWidth/Height are not set yet.
win.setTimeout(function() {OnRefTestLoad(win);}, 0);
}, {once: true});
--- a/mobile/android/modules/WebrtcUI.jsm
+++ b/mobile/android/modules/WebrtcUI.jsm
@@ -92,17 +92,17 @@ var WebrtcUI = {
when: null, // hide the date row
light: [0xFF9500FF, 1000, 1000],
ongoing: true
};
let cameraActive = false;
let audioActive = false;
for (let i = 0; i < count; i++) {
- let win = windows.queryElementAt(i, Ci.nsIDOMWindow);
+ let win = windows.queryElementAt(i, Ci.nsISupports);
let hasCamera = {};
let hasMicrophone = {};
MediaManagerService.mediaCaptureWindowState(win, hasCamera, hasMicrophone);
if (hasCamera.value != MediaManagerService.STATE_NOCAPTURE) cameraActive = true;
if (hasMicrophone.value != MediaManagerService.STATE_NOCAPTURE) audioActive = true;
}
if (cameraActive && audioActive) {
--- a/mobile/android/modules/geckoview/GeckoViewUtils.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewUtils.jsm
@@ -298,17 +298,17 @@ var GeckoViewUtils = {
let win = Services.focus.activeWindow;
let dispatcher = this.getDispatcherForWindow(win);
if (dispatcher) {
return [dispatcher, win];
}
let iter = Services.wm.getEnumerator(/* windowType */ null);
while (iter.hasMoreElements()) {
- win = iter.getNext().QueryInterface(Ci.nsIDOMWindow);
+ win = iter.getNext();
dispatcher = this.getDispatcherForWindow(win);
if (dispatcher) {
return [dispatcher, win];
}
}
return [null, null];
},
--- a/mobile/android/tests/browser/chrome/test_awsy_lite.html
+++ b/mobile/android/tests/browser/chrome/test_awsy_lite.html
@@ -119,17 +119,17 @@
function startup() {
var enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
// potential race condition here - the window may not be ready yet at
// this point, so ideally we would test for that. but i can't find a
// property that reflects whether or not UIReady has been fired, so
// for now just assume the window is ready
- attachTo(enumerator.getNext().QueryInterface(Ci.nsIDOMWindow));
+ attachTo(enumerator.getNext());
}
Services.wm.addListener(browserListener);
}
function startTest() {
checkpoint("Fresh start");
setTimeout(settle, 30000);
}
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -613,17 +613,17 @@ var BrowserTestUtils = {
* @return {Promise}
* A Promise which resolves when a "domwindowopened" notification
* has been fired by the window watcher.
*/
domWindowOpened(win, checkFn) {
return new Promise(resolve => {
async function observer(subject, topic, data) {
if (topic == "domwindowopened" && (!win || subject === win)) {
- let observedWindow = subject.QueryInterface(Ci.nsIDOMWindow);
+ let observedWindow = subject;
if (checkFn && !await checkFn(observedWindow)) {
return;
}
Services.ww.unregisterNotification(observer);
resolve(observedWindow);
}
}
Services.ww.registerNotification(observer);
@@ -639,17 +639,17 @@ var BrowserTestUtils = {
* A Promise which resolves when a "domwindowclosed" notification
* has been fired by the window watcher.
*/
domWindowClosed(win) {
return new Promise((resolve) => {
function observer(subject, topic, data) {
if (topic == "domwindowclosed" && (!win || subject === win)) {
Services.ww.unregisterNotification(observer);
- resolve(subject.QueryInterface(Ci.nsIDOMWindow));
+ resolve(subject);
}
}
Services.ww.registerNotification(observer);
});
},
/**
* @param {Object} options
--- a/testing/mochitest/bootstrap.js
+++ b/testing/mochitest/bootstrap.js
@@ -104,17 +104,17 @@ function startup(data, reason) {
win.addEventListener("mochitest-load", loadMochitest);
}
}
function shutdown(data, reason) {
if (AppConstants.platform != "android") {
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
- let win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
+ let win = windows.getNext();
WindowListener.tearDownWindow(win);
}
Services.wm.removeListener(WindowListener);
}
}
function install(data, reason) {}
--- a/toolkit/components/alerts/test/test_alerts_requireinteraction.html
+++ b/toolkit/components/alerts/test/test_alerts_requireinteraction.html
@@ -19,22 +19,21 @@ const chromeScript = SpecialPowers.loadC
ChromeUtils.import("resource://gre/modules/Timer.jsm");
addMessageListener("waitForXULAlert", function() {
var timer = setTimeout(function() {
Services.ww.unregisterNotification(windowObserver);
sendAsyncMessage("waitForXULAlert", false);
}, 2000);
- var windowObserver = function(aSubject, aTopic, aData) {
+ var windowObserver = function(win, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
- var win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
let windowType = win.document.documentElement.getAttribute("windowtype");
if (windowType == "alert:alert") {
clearTimeout(timer);
Services.ww.unregisterNotification(windowObserver);
sendAsyncMessage("waitForXULAlert", true);
}
--- a/toolkit/components/alerts/test/test_multiple_alerts.html
+++ b/toolkit/components/alerts/test/test_multiple_alerts.html
@@ -22,27 +22,26 @@ const chromeScript = SpecialPowers.loadC
.getService(Ci.nsIAlertsService);
addMessageListener("waitForPosition", function() {
var timer = setTimeout(function() {
Services.ww.unregisterNotification(windowObserver);
sendAsyncMessage("waitedForPosition", null);
}, 2000);
- var windowObserver = function(aSubject, aTopic, aData) {
+ var windowObserver = function(win, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
// Alerts are implemented using XUL.
clearTimeout(timer);
Services.ww.unregisterNotification(windowObserver);
- var win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("pageshow", function() {
var x = win.screenX;
var y = win.screenY;
win.addEventListener("pagehide", function() {
sendAsyncMessage("waitedForPosition", { x, y });
}, {once: true});
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -56,24 +56,22 @@ var gViewSourceUtils = {
// Try existing browsers first.
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
if (browserWin && browserWin.BrowserViewSourceOfDocument) {
browserWin.BrowserViewSourceOfDocument(aArgs);
return;
}
// No browser window created yet, try to create one.
let utils = this;
- Services.ww.registerNotification(function onOpen(subj, topic) {
- if (subj.document.documentURI !== "about:blank" ||
+ Services.ww.registerNotification(function onOpen(win, topic) {
+ if (win.document.documentURI !== "about:blank" ||
topic !== "domwindowopened") {
return;
}
Services.ww.unregisterNotification(onOpen);
- let win = subj.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
win.addEventListener("load", () => {
aArgs.viewSourceBrowser = win.gBrowser.selectedTab.linkedBrowser;
utils.viewSourceInBrowser(aArgs);
}, { once: true });
});
window.top.openWebLinkIn("about:blank", "current");
},
--- a/toolkit/content/tests/browser/browser_f7_caret_browsing.js
+++ b/toolkit/content/tests/browser/browser_f7_caret_browsing.js
@@ -26,17 +26,17 @@ registerCleanupFunction(function() {
// then "stop" waiting so that when we next *do* want it to open, our "old"
// listener doesn't fire and do things we don't want (like close the window...).
let gCaretPromptOpeningObserver;
function promiseCaretPromptOpened() {
return new Promise(resolve => {
function observer(subject, topic, data) {
if (topic == "domwindowopened") {
Services.ww.unregisterNotification(observer);
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
+ let win = subject;
BrowserTestUtils.waitForEvent(win, "load", false, e => e.target.location.href != "about:blank").then(() => resolve(win));
gCaretPromptOpeningObserver = null;
}
}
Services.ww.registerNotification(observer);
gCaretPromptOpeningObserver = observer;
});
}
--- a/toolkit/mozapps/extensions/test/browser/browser_bug523784.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug523784.js
@@ -16,23 +16,22 @@ var args = {
blocked: false,
url: "http://example.com/bug523784_1",
}],
};
function test() {
waitForExplicitFinish();
- let windowObserver = function(aSubject, aTopic, aData) {
+ let windowObserver = function(win, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
executeSoon(() => bug523784_test1(win));
}, {once: true});
};
Services.ww.registerNotification(windowObserver);
args.wrappedJSObject = args;
Services.ww.openWindow(null, URI_BLOCKLIST_DIALOG, "",
@@ -66,22 +65,21 @@ function bug523784_test1(win) {
executeSoon(bug523784_test2);
};
Services.ww.registerNotification(windowObserver);
cancelButton.doCommand();
}
function bug523784_test2(win) {
- let windowObserver = function(aSubject, aTopic, aData) {
+ let windowObserver = function(win, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
executeSoon(function() {
let moreInfoLink = win.document.getElementById("moreInfo");
let cancelButton = win.document.documentElement.getButton("cancel");
is(moreInfoLink.getAttribute("href"),
Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL"),
"More Info link should link to the general blocklist page.");
cancelButton.doCommand();
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -93,17 +93,17 @@ function promiseFocus(window) {
return new Promise(resolve => waitForFocus(resolve, window));
}
// Helper to register test failures and close windows if any are left open
function checkOpenWindows(aWindowID) {
let windows = Services.wm.getEnumerator(aWindowID);
let found = false;
while (windows.hasMoreElements()) {
- let win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
+ let win = windows.getNext();
if (!win.closed) {
found = true;
win.close();
}
}
if (found)
ok(false, "Found unexpected " + aWindowID + " window still open");
}
--- a/widget/tests/test_imestate.html
+++ b/widget/tests/test_imestate.html
@@ -1321,17 +1321,17 @@ function runTestPasswordFieldOnDialog()
return this;
}
},
observe: function (subject, topic, data)
{
if (topic === "domwindowopened") {
ok(true, "dialog window is created");
- dialog = subject.QueryInterface(Ci.nsIDOMWindow);
+ dialog = subject;
dialog.addEventListener("load", onPasswordDialogLoad);
}
}
};
var observer = new WindowObserver();
var arg1 = new Object(), arg2 = new Object();
Cc["@mozilla.org/embedcomp/prompt-service;1"].