Bug 1476145 part 6. Stop using getInterface(nsIDOMWindowUtils) in toolkit. r=mossop

This is not quite a mechanical change, because some places have a .top or
whatnot snuck in there, so please review carefully!
This commit is contained in:
Boris Zbarsky 2018-07-24 19:47:42 -04:00
Родитель 1312fcd10f
Коммит 6e84b66899
50 изменённых файлов: 67 добавлений и 150 удалений

Просмотреть файл

@ -426,9 +426,7 @@ function doGC() {
function doCC() {
Services.obs.notifyObservers(null, "child-cc-request");
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.cycleCollect();
window.windowUtils.cycleCollect();
updateMainAndFooter("Cycle collection completed", SHOW_TIMESTAMP,
HIDE_FOOTER);
}

Просмотреть файл

@ -92,8 +92,7 @@ class DefaultMap extends Map {
}
const _winUtils = new DefaultWeakMap(win => {
return win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
return win.windowUtils;
});
const getWinUtils = win => _winUtils.get(win);

Просмотреть файл

@ -49,10 +49,7 @@ add_task(async function test_contentscript_devtools_sandbox_metadata() {
let win = window.open("file_sample.html");
let innerWindowID = SpecialPowers.wrap(win)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
let innerWindowID = SpecialPowers.getDOMWindowUtils(win).currentInnerWindowID;
await extension.awaitFinish("contentScript.executed");

Просмотреть файл

@ -156,11 +156,7 @@ add_task(async function test_ExtensionPageContextChild_in_child_frame() {
let {ExtensionPageChild} = ChromeUtils.import("resource://gre/modules/ExtensionPageChild.jsm", {});
let frame = this.content.document.querySelector("iframe[src*='iframe.html']");
let innerWindowID =
frame.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
let innerWindowID = frame.contentWindow.windowUtils.currentInnerWindowID;
let context = ExtensionPageChild.extensionContexts.get(innerWindowID);
Assert.ok(context, "Got extension page context for child frame");
@ -198,10 +194,7 @@ add_task(async function test_ExtensionPageContextChild_in_toplevel() {
await contentPage.spawn(extension.id, async extensionId => {
let {ExtensionPageChild} = ChromeUtils.import("resource://gre/modules/ExtensionPageChild.jsm", {});
let innerWindowID = this.content
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
let innerWindowID = this.content.windowUtils.currentInnerWindowID;
let context = ExtensionPageChild.extensionContexts.get(innerWindowID);
Assert.ok(context, "Got extension page context for top-level document");

Просмотреть файл

@ -23,9 +23,7 @@ function frameScript() {
MessageChannel.addListener(this, "ExtensionTest:HandleUserInput", {
receiveMessage({name, data}) {
if (data) {
handle = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.setHandlingUserInput(true);
handle = content.windowUtils.setHandlingUserInput(true);
} else if (handle) {
handle.destruct();
handle = null;

Просмотреть файл

@ -82,8 +82,7 @@ function setHandlingUserInput(extension) {
}
}
notEqual(bgwin, null, "Found background window for the test extension");
let winutils = bgwin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let winutils = bgwin.windowUtils;
return winutils.setHandlingUserInput(true);
}

Просмотреть файл

@ -168,8 +168,7 @@ var listener = {
scheduleTest(win) {
this.win = win;
this.win.onload = this.onWindowLoaded.bind(this);
this.utils = this.win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
this.utils = this.win.windowUtils;
setTimeout(TIMEOUT_SEC * 1000, () => {
if (this.win) {
reportResult(TEST_TIMEOUT);

Просмотреть файл

@ -11,8 +11,7 @@ const gfxFrameScript = {
.getInterface(Ci.nsIWebProgress);
webProgress.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
this.domUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
this.domUtils = content.windowUtils;
webNav.loadURI("chrome://gfxsanity/content/sanitytest.html",
Ci.nsIWebNavigation.LOAD_FLAGS_NONE,

Просмотреть файл

@ -40,8 +40,7 @@ Narrator.prototype = {
get _treeWalker() {
if (!this._treeWalkerRef) {
let wu = this._win.QueryInterface(
Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let wu = this._win.windowUtils;
let nf = this._win.NodeFilter;
let filter = {

Просмотреть файл

@ -34,7 +34,7 @@ CleanupManager.addCleanupHandler(() => {
while (windowEnumerator.hasMoreElements()) {
const window = windowEnumerator.getNext();
if (windowsWithInjectedCss.has(window)) {
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
const utils = window.windowUtils;
utils.removeSheet(HEARTBEAT_CSS_URI, window.AGENT_SHEET);
if (AppConstants.platform === "macosx") {
utils.removeSheet(HEARTBEAT_CSS_URI_OSX, window.AGENT_SHEET);
@ -123,7 +123,7 @@ var Heartbeat = class {
if (!windowsWithInjectedCss.has(chromeWindow)) {
windowsWithInjectedCss.add(chromeWindow);
const utils = chromeWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
const utils = chromeWindow.windowUtils;
utils.loadSheet(HEARTBEAT_CSS_URI, chromeWindow.AGENT_SHEET);
if (AppConstants.platform === "macosx") {
utils.loadSheet(HEARTBEAT_CSS_URI_OSX, chromeWindow.AGENT_SHEET);

Просмотреть файл

@ -40,8 +40,7 @@ var InsecurePasswordUtils = {
* Inner ID for the given window.
*/
_getInnerWindowId(window) {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
return window.windowUtils.currentInnerWindowID;
},
_sendWebConsoleMessage(messageTag, domDoc) {

Просмотреть файл

@ -59,8 +59,7 @@ add_task(async function() {
let color = await ContentTask.spawn(browser, null, async function() {
let iframe = content.document.getElementById("iframe");
let elem = iframe.contentDocument.getElementById("link");
return content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
return content.windowUtils
.getVisitedDependentComputedStyle(elem, "", "color");
});
return (color == test.color);

Просмотреть файл

@ -18,8 +18,7 @@ var PromptUtils = {
eventOptions.detail = detail;
}
let event = new domWin.CustomEvent(eventName, eventOptions);
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let winUtils = domWin.windowUtils;
winUtils.dispatchEventToChromeOnly(target, event);
},

Просмотреть файл

@ -333,8 +333,7 @@ function openModalWindow(domWin, uri, args) {
// See bug 875157 comment 30 for more...
if (domWin) {
// a domWin was passed, so we can apply the check for it being hidden.
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let winUtils = domWin.windowUtils;
if (winUtils && !winUtils.isParentWindowMainWidgetVisible) {
throw Components.Exception("Cannot call openModalWindow on a hidden window",
@ -360,8 +359,7 @@ function openTabPrompt(domWin, tabPrompt, args) {
let eventDetail = Cu.cloneInto({tabPrompt: true, inPermitUnload}, domWin);
PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog", null, eventDetail);
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let winUtils = domWin.windowUtils;
winUtils.enterModalState();
let frameMM = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
@ -445,8 +443,7 @@ function openRemotePrompt(domWin, args, tabPrompt) {
// it impossible to reach its scriptable top,
// a.k.a. window.top. To prevent this, make sure to enter/exit
// modal state beginning from top.
let winUtils = domWin.top.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let winUtils = domWin.top.windowUtils;
winUtils.enterModalState();
let closed = false;

Просмотреть файл

@ -41,8 +41,7 @@ var AboutReader = function(mm, win, articlePromise) {
this._docRef = Cu.getWeakReference(doc);
this._winRef = Cu.getWeakReference(win);
this._innerWindowId = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
this._innerWindowId = win.windowUtils.currentInnerWindowID;
this._article = null;
this._languagePromise = new Promise(resolve => {

Просмотреть файл

@ -233,7 +233,7 @@ var ReaderMode = {
},
getUtilsForWin(win) {
return win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
return win.windowUtils;
},
/**

Просмотреть файл

@ -91,8 +91,7 @@ var PageThumbUtils = {
* minus the scroll bars.
*/
getContentSize(aWindow) {
let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = aWindow.windowUtils;
// aWindow may be a cpow, add exposed props security values.
let sbWidth = {}, sbHeight = {};
@ -261,8 +260,7 @@ var PageThumbUtils = {
if (Cu.isCrossProcessWrapper(aWindow)) {
throw new Error("Do not pass cpows here.");
}
let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = aWindow.windowUtils;
// aWindow may be a cpow, add exposed props security values.
let sbWidth = {}, sbHeight = {};

Просмотреть файл

@ -62,10 +62,7 @@ const backgroundPageThumbsContent = {
// disableDialogs only works on the current inner window, so it has
// to be called every page load, but before scripts run.
if (content && subj == content.document) {
content.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).
disableDialogs();
content.windowUtils.disableDialogs();
}
},

Просмотреть файл

@ -195,7 +195,7 @@ var ViewSourceContent = {
// this document off of the network.
}
let utils = requestor.getInterface(Ci.nsIDOMWindowUtils);
let utils = contentWindow.windowUtils;
let doc = contentWindow.document;
forcedCharSet = utils.docCharsetIsForced ? doc.characterSet
: null;

Просмотреть файл

@ -340,8 +340,7 @@ var snapshotFormatters = {
delete data.info;
}
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let windowUtils = window.windowUtils;
let gpuProcessPid = windowUtils.gpuProcessPid;
if (gpuProcessPid != -1) {

Просмотреть файл

@ -614,7 +614,5 @@ addMessageListener("PermitUnload", msg => {
// We may not get any responses to Browser:Init if the browser element
// is torn down too quickly.
var outerWindowID = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
var outerWindowID = content.windowUtils.outerWindowID;
sendAsyncMessage("Browser:Init", {outerWindowID});

Просмотреть файл

@ -312,8 +312,7 @@ var AudioPlaybackListener = {
},
handleMediaControlMessage(msg) {
let utils = global.content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = global.content.windowUtils;
let suspendTypes = Ci.nsISuspendedTypes;
switch (msg) {
case "mute":

Просмотреть файл

@ -201,24 +201,21 @@ function saveDocument(aDocument, aSkipPrompt) {
} else if (aDocument.nodeType == 9 /* DOCUMENT_NODE */) {
// Otherwise it's an actual nsDocument (and possibly a CPOW).
// We want to use cached data because the document is currently visible.
let ifreq =
aDocument.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor);
let win = aDocument.defaultView;
try {
contentDisposition =
ifreq.getInterface(Ci.nsIDOMWindowUtils)
.getDocumentMetadata("content-disposition");
contentDisposition = win.windowUtils
.getDocumentMetadata("content-disposition");
} catch (ex) {
// Failure to get a content-disposition is ok
}
try {
let shEntry =
ifreq.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIWebPageDescriptor)
.currentDescriptor
.QueryInterface(Ci.nsISHEntry);
win.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIWebPageDescriptor)
.currentDescriptor
.QueryInterface(Ci.nsISHEntry);
cacheKey = shEntry.cacheKey;
} catch (ex) {

Просмотреть файл

@ -42,8 +42,7 @@
// capability, so using |overflow: hidden| is not an option.
// Instead, we are inserting a user agent stylesheet that is
// capable of selecting scrollbars, and do |display: none|.
var domWinUtls = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var domWinUtls = window.windowUtils;
domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
// Create a DatePicker instance and prepare to be
// initialized by the "DatePickerInit" event from datetimepopup.xml

Просмотреть файл

@ -98,8 +98,7 @@ function setTestPluginEnabledState(newEnabledState, pluginName) {
}
function disable_non_test_mouse(disable) {
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
utils.disableNonTestMouseEvents(disable);
}

Просмотреть файл

@ -81,9 +81,7 @@ function openContextMenu() {
menu = win.document.getElementById("menu");
var screenX = menu.boxObject.screenX;
var screenY = menu.boxObject.screenY;
var utils =
win.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = win.windowUtils;
utils.sendMouseEvent("contextmenu", mouseX, mouseY, 2, 0, 0);

Просмотреть файл

@ -56,8 +56,7 @@ function runTestSet(suffix)
checkAttributes(four, "Four", "F", "", "", false);
if (isMac && suffix) {
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
utils.forceUpdateNativeMenuAt("0");
}
else {

Просмотреть файл

@ -24,8 +24,7 @@ var gChecked = false;
function runTests()
{
var button = document.getElementById("button");
var windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var windowUtils = window.windowUtils;
windowUtils.disableNonTestMouseEvents(true);
synthesizeMouse(button, 2, 2, { type: "mouseover" });
synthesizeMouse(button, 4, 4, { type: "mousemove" });

Просмотреть файл

@ -26,8 +26,7 @@
// capability, so using |overflow: hidden| is not an option.
// Instead, we are inserting a user agent stylesheet that is
// capable of selecting scrollbars, and do |display: none|.
var domWinUtls = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var domWinUtls = window.windowUtils;
domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
// Create a TimePicker instance and prepare to be
// initialized by the "TimePickerInit" event from timepicker.xml

Просмотреть файл

@ -1781,7 +1781,7 @@
// The popup may have changed size between now and the last
// time the item was shown, so always handle over/underflow.
let dwu = window.getInterface(Ci.nsIDOMWindowUtils);
let dwu = window.windowUtils;
let popupWidth = dwu.getBoundsWithoutFlushing(this.parentNode).width;
if (!this._previousPopupWidth || this._previousPopupWidth != popupWidth) {
this._previousPopupWidth = popupWidth;

Просмотреть файл

@ -364,20 +364,14 @@
<property name="outerWindowID" readonly="true">
<getter><![CDATA[
return this.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
return this.contentWindow.windowUtils.outerWindowID;
]]></getter>
</property>
<property name="innerWindowID" readonly="true">
<getter><![CDATA[
try {
return this.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
return this.contentWindow.windowUtils.currentInnerWindowID;
} catch (e) {
if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e;

Просмотреть файл

@ -157,10 +157,7 @@
</property>
<property name="outerWindowID" readonly="true">
<getter><![CDATA[
return this.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
return this.contentWindow.windowUtils.outerWindowID;
]]></getter>
</property>
</implementation>

Просмотреть файл

@ -533,15 +533,13 @@
}
case "DOMFullscreen:RequestExit": {
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let windowUtils = window.windowUtils;
windowUtils.exitFullscreen();
break;
}
case "DOMFullscreen:RequestRollback": {
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let windowUtils = window.windowUtils;
windowUtils.remoteFrameFullscreenReverted();
break;
}

Просмотреть файл

@ -162,14 +162,7 @@
<parameter name="element"/>
<body><![CDATA[
if (!("_DOMWindowUtils" in this)) {
try {
this._DOMWindowUtils =
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
} catch (e) {
// Can't access nsIDOMWindowUtils if we're unprivileged.
this._DOMWindowUtils = null;
}
this._DOMWindowUtils = window.windowUtils;
}
return this._DOMWindowUtils ?

Просмотреть файл

@ -177,8 +177,7 @@ class AutoScrollController {
if (!content.performance)
return;
let domUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let domUtils = content.windowUtils;
let scrollable = this._scrollable;
if (scrollable instanceof Ci.nsIDOMWindow) {
// getViewId() needs an element to operate on.

Просмотреть файл

@ -180,7 +180,7 @@ var BrowserUtils = {
y += win.mozInnerScreenY;
}
let fullZoom = win.getInterface(Ci.nsIDOMWindowUtils).fullZoom;
let fullZoom = win.windowUtils.fullZoom;
rect = {
left: x * fullZoom,
top: y * fullZoom,
@ -371,7 +371,7 @@ var BrowserUtils = {
*/
async setToolbarButtonHeightProperty(element) {
let window = element.ownerGlobal;
let dwu = window.getInterface(Ci.nsIDOMWindowUtils);
let dwu = window.windowUtils;
let toolbarItem = element;
let urlBarContainer = element.closest("#urlbar-container");
if (urlBarContainer) {

Просмотреть файл

@ -328,8 +328,7 @@ var E10SUtils = {
wrapHandlingUserInput(aWindow, aIsHandling, aCallback) {
var handlingUserInput;
try {
handlingUserInput = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
handlingUserInput = aWindow.windowUtils
.setHandlingUserInput(aIsHandling);
aCallback();
} finally {

Просмотреть файл

@ -507,8 +507,7 @@ Finder.prototype = {
return null;
}
let utils = topWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = topWin.windowUtils;
let scrollX = {}, scrollY = {};
utils.getScrollXY(false, scrollX, scrollY);

Просмотреть файл

@ -543,8 +543,7 @@ FinderHighlighter.prototype = {
*/
_getDWU(window = null) {
return (window || this.finder._getWindow())
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
.windowUtils;
},
/**

Просмотреть файл

@ -577,7 +577,7 @@ var FinderIterator = {
// Casting `window.frames` to an Iterator doesn't work, so we're stuck with
// a plain, old for-loop.
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let dwu = window.windowUtils;
for (let i = 0, l = window.frames.length; i < l; ++i) {
let frame = window.frames[i];
// Don't count matches in hidden frames; get the frame element rect and

Просмотреть файл

@ -138,9 +138,7 @@ LightweightThemeConsumer.prototype = {
if (aTopic != "lightweight-theme-styling-update")
return;
const { outerWindowID } = this._win
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const { outerWindowID } = this._win.windowUtils;
let parsedData = JSON.parse(aData);
if (!parsedData) {

Просмотреть файл

@ -160,8 +160,7 @@ PageMenu.prototype = {
this._builder.click(target.getAttribute(this.GENERATEDITEMID_ATTR));
} else if (this._browser) {
let win = target.ownerGlobal;
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let windowUtils = win.windowUtils;
this._browser.messageManager.sendAsyncMessage("ContextMenu:DoCustomCommand", {
generatedItemId: target.getAttribute(this.GENERATEDITEMID_ATTR),
handlingUserInput: windowUtils.isHandlingUserInput

Просмотреть файл

@ -144,8 +144,7 @@ var PrintingContent = {
onStateChange(webProgress, req, flags, status) {
if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
webProgress.removeProgressListener(webProgressListener);
let domUtils = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let domUtils = contentWindow.windowUtils;
// Here we tell the parent that we have parsed the document successfully
// using ReaderMode primitives and we are able to enter on preview mode.
if (domUtils.isMozAfterPaintPending) {

Просмотреть файл

@ -361,9 +361,7 @@ var dataProviders = {
data.numAcceleratedWindows = 0;
let winEnumer = Services.ww.getWindowEnumerator();
while (winEnumer.hasMoreElements()) {
let winUtils = winEnumer.getNext().
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
let winUtils = winEnumer.getNext().windowUtils;
try {
// NOTE: windowless browser's windows should not be reported in the graphics troubleshoot report
if (winUtils.layerManagerType == "None" || !winUtils.layerManagerRemote) {
@ -562,9 +560,7 @@ var dataProviders = {
}
let data = {};
let winUtils = Services.wm.getMostRecentWindow("").
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
let winUtils = Services.wm.getMostRecentWindow("").windowUtils;
data.currentAudioBackend = winUtils.currentAudioBackend;
data.currentMaxAudioChannels = winUtils.currentMaxAudioChannels;
data.currentPreferredSampleRate = winUtils.currentPreferredSampleRate;
@ -579,9 +575,7 @@ var dataProviders = {
let data = {};
let winEnumer = Services.ww.getWindowEnumerator();
if (winEnumer.hasMoreElements())
data.incrementalGCEnabled = winEnumer.getNext().
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).
data.incrementalGCEnabled = winEnumer.getNext().windowUtils.
isIncrementalGCEnabled();
done(data);
},

Просмотреть файл

@ -15,7 +15,7 @@ function getDocShellOuterWindowId(docShell) {
return docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow)
.getInterface(Ci.nsIDOMWindowUtils)
.windowUtils
.outerWindowID;
}

Просмотреть файл

@ -58,7 +58,7 @@ function getFrameId(window) {
return 0;
}
let utils = window.getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
return utils.outerWindowID;
}

Просмотреть файл

@ -120,9 +120,7 @@ var ContentPolicy = {
let mm = Services.cpmm;
function getWindowId(window) {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
return window.windowUtils.outerWindowID;
}
let node = loadInfo.loadingContext;

Просмотреть файл

@ -40,8 +40,7 @@ var ScrollPositionInternal = {
* given |frame|.
*/
collect(frame) {
let ifreq = frame.QueryInterface(Ci.nsIInterfaceRequestor);
let utils = ifreq.getInterface(Ci.nsIDOMWindowUtils);
let utils = frame.windowUtils;
let scrollX = {}, scrollY = {};
utils.getScrollXY(false /* no layout flush */, scrollX, scrollY);

Просмотреть файл

@ -146,8 +146,7 @@ add_task(async function testDarkPageDetection() {
};
await ContentTask.spawn(browser, null, async function() {
let dwu = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let dwu = content.windowUtils;
let uri = "data:text/css;charset=utf-8," + encodeURIComponent(`
body {
background: maroon radial-gradient(circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
@ -326,8 +325,7 @@ add_task(async function testTooLargeToggle() {
await promiseOpenFindbar(findbar);
await ContentTask.spawn(browser, null, async function() {
let dwu = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let dwu = content.windowUtils;
let uri = "data:text/css;charset=utf-8," + encodeURIComponent(`
body {
min-height: 1234567px;

Просмотреть файл

@ -34,8 +34,7 @@ function CallbackObject(id, callback, mediator) {
}
function RemoteMediator(window) {
window.QueryInterface(Ci.nsIInterfaceRequestor);
let utils = window.getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
this._windowID = utils.currentInnerWindowID;
this.mm = window