Bug 1476145 part 8. Stop using getInterface(nsIDOMWindowUtils) in various test code. r=kmag

This commit is contained in:
Boris Zbarsky 2018-07-24 19:47:43 -04:00
Родитель d5546b23ee
Коммит 75abc43e0d
63 изменённых файлов: 81 добавлений и 188 удалений

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

@ -71,7 +71,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=995943
var gGoCount = 0;
function go() {
debug("Invoking go for window with id: " + window.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID);
debug("Invoking go for window with id: " + window.windowUtils.currentInnerWindowID);
is(++gGoCount, 1, "Should only call go once!");
checkLoadFileURI('http://example.com', false).then(
pushPrefs.bind(null, [['capability.policy.policynames', ' somepolicy '],

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

@ -188,9 +188,7 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
win.document.body.textContent.trim() == popup_body) &&
win.document.readyState == "complete") {
var util = win.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var windowId = util.outerWindowID;
var windowId = win.windowUtils.outerWindowID;
if (!contains(windowId, finishedWindows)) {
finishedWindows.push(windowId);
frameFinished();

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

@ -8,8 +8,7 @@
<script class="testbody" type="application/javascript">
var utils = SpecialPowers.wrap(window)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(window);
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;

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

@ -311,8 +311,7 @@ async function waitUntilApzStable() {
if (!topWin) {
topWin = Services.wm.getMostRecentWindow('navigator:geckoview');
}
var topUtils = topWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var topUtils = topWin.windowUtils;
var repaintDone = function() {
Services.obs.removeObserver(repaintDone, "apz-repaints-flushed");

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

@ -25,9 +25,7 @@ add_task(async function test_windowlessBrowserTroubleshootCrash() {
await onLoaded;
let winUtils = webNav.document.defaultView.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
let winUtils = webNav.document.defaultView.windowUtils;
try {
is(winUtils.layerManagerType, "Basic", "windowless browser's layerManagerType should be 'Basic'");
} catch (e) {

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

@ -23,8 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1274663
var windows = SpecialPowers.Services.ww.getWindowEnumerator();
var windowutils;
while (windows.hasMoreElements()) {
windowutils = windows.getNext().QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowutils = windows.getNext().windowUtils;
}
const PAGE_WIDTH = 200;

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

@ -38,8 +38,7 @@ function runTest() {
var webrenderWindows = 0;
var layerManagerLog = [];
while (windows.hasMoreElements()) {
windowutils = windows.getNext().QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowutils = windows.getNext().windowUtils;
try {
if (windowutils.layerManagerType != "Basic") {
acceleratedWindows++;

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

@ -15,8 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=503926
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
var gWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var gWindowUtils = window.windowUtils;
var passed = false;
var obj = { QueryInterface: function() { passed = true; } }
gWindowUtils.xpconnectArgument(obj);

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

@ -32,8 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=503926
/** Test for Bug 503926 **/
function go() {
var gWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var gWindowUtils = window.windowUtils;
// Try with a chrome object.
var passed = false;

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

@ -30,8 +30,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
is(o, XPCNativeWrapper.unwrap(o), "unwrap on a random object returns it");
var win = $('ifr').contentWindow;
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
is(utils.getClassName(win), "Proxy", "win is a Proxy");
ok("x" in XPCNativeWrapper.unwrap(win), "actually unwrapped");
is(utils.getClassName(XPCNativeWrapper.unwrap(win)), "Proxy",

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

@ -20,8 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
<script type="application/javascript"><![CDATA[
var sandbox = new Cu.Sandbox("about:blank");
var test_utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var test_utils = window.windowUtils;
function getCOW(x) {
if (typeof x != 'object' && typeof x != 'function')

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

@ -23,8 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const utils = window.windowUtils;
function checkCrossOriginSandbox(sandbox)
{

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

@ -18,8 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
<script type="application/javascript"><![CDATA[
function checkWrapped(obj) {
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
is(utils.getClassName(obj), "Proxy", "right type of wrapper");
}

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

@ -19,8 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=484459
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
SimpleTest.waitForExplicitFinish();
var util = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var util = window.windowUtils;
var weakUtil = Cu.getWeakReference(util);
util = null;

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

@ -41,9 +41,7 @@ function go() {
return;
}
let winID = w.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
let winID = w.windowUtils.outerWindowID;
// Remove the frame. This will nuke the WindowProxy wrapper from our chrome
// document's global, so evaluating 'this' in it will return a dead wrapper
// once the window is destroyed.

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

@ -23,8 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
function go() {
var win = $('ifr').contentWindow;
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
is(utils.getClassName(window), "Proxy", "our window is wrapped correctly")
is(utils.getClassName(location), "Location", "chrome doesn't have location wrappers")
is(utils.getClassName(win), "Proxy", "win is an Proxy");

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

@ -41,8 +41,7 @@ async function openPage(enableDialogs) {
ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver(doc => {
if (content && doc == content.document) {
content.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils)[name]();
content.windowUtils[name]();
}
}, "document-element-inserted");
});

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

@ -91,8 +91,7 @@ function runTests()
}
function compareCanvases() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
return window.windowUtils
.compareCanvases(document.getElementsByTagName("canvas")[0],
document.getElementsByTagName("canvas")[1],
{}) == 0;

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

@ -39,8 +39,7 @@ function doTest() {
function continueTest() {
var ifrwindow = document.getElementById("contentFrame").contentWindow;
ifrwindow.focus();
var utils = ifrwindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = ifrwindow.windowUtils;
var rect = ifrwindow.document.body.getBoundingClientRect();
var x = rect.left + (rect.width/2);
var y = rect.top + (rect.height/2);

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

@ -14,8 +14,7 @@
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
function startTest() {
// Do a scroll to ensure we trigger activity heuristics.

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

@ -45,8 +45,7 @@
isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased" + testInfo());
function testLeafLayersPartitionWindow() {
var success = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
var success = win.windowUtils
.leafLayersPartitionWindow();
// "[leafLayersPartitionWindow()] Always returns true in non-DEBUG builds."
// To prevent random failures on Windows, try to run this again after a timeout.

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

@ -18,8 +18,7 @@
SimpleTest.waitForExplicitFinish();
var t = document.getElementById("t");
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
function startTest() {
// Do a couple of transform changes to ensure we've triggered activity heuristics

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

@ -19,8 +19,7 @@ SimpleTest.waitForExplicitFinish();
var t = document.getElementById("t");
var e = document.getElementById("e");
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
function startTest() {
// Do a scroll to ensure we trigger activity heuristics.

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

@ -31,8 +31,7 @@
</body>
<script>
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
var initialPaintCount = 0;

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

@ -132,8 +132,7 @@ class AccessibleCaretSelectionModeTestCase(MarionetteTestCase):
target_y = rect['y'] + (y if y is not None else rect['height'] // 2)
self.marionette.execute_script('''
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
utils.sendTouchEventToWindow('touchstart', [0],
[arguments[0]], [arguments[1]],
[1], [1], [0], [1], 1, 0);

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

@ -44,9 +44,7 @@ function theTest() {
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var gWindowUtils = SpecialPowers.wrap(window)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var gWindowUtils = SpecialPowers.getDOMWindowUtils(window);
var nativeMouseDown;
var nativeMouseUp;

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

@ -14,8 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=708874
/** Test for Bug 708874 - API for locking pseudo-class state of an element **/
var DOMWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var DOMWindowUtils = window.windowUtils;
var defaultColor = "rgb(0, 0, 0)";
var disabledColor = "rgb(40, 0, 0)";

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

@ -10,15 +10,12 @@
<body onload=run()>
<p><span id=s1 class=blue><b></b></span><span id=s2 class=red><b></b></span></p>
<script>
var windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
function run() {
windowUtils.postRestyleSelfEvent(document.querySelector("p"));
window.windowUtils.postRestyleSelfEvent(document.querySelector("p"));
document.querySelectorAll("span")[0].className = "";
document.querySelectorAll("b")[0].className = "inline-block";
document.querySelectorAll("span")[1].className = "blue";
windowUtils.postRestyleSelfEvent(document.querySelectorAll("b")[1]);
window.windowUtils.postRestyleSelfEvent(document.querySelectorAll("b")[1]);
document.body.offsetTop;

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

@ -14,7 +14,7 @@
<pre id="test">
<script type="application/javascript">
var winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
var winUtils = window.windowUtils;
function startTest() {
// load some styles at the agent level

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

@ -23,9 +23,7 @@ let gSSService = SpecialPowers.Cc["@mozilla.org/content/style-sheet-service;1"]
function test(win, sheet) {
let cs = win.getComputedStyle(win.document.body);
is(cs.getPropertyValue('color'), "rgb(0, 0, 0)", "should have default color");
var windowUtils = SpecialPowers.wrap(win)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var windowUtils = SpecialPowers.getDOMWindowUtils(win);
windowUtils.addSheet(sheet, SpecialPowers.Ci.nsIDOMWindowUtils.USER_SHEET);
is(cs.getPropertyValue('color'), "rgb(255, 0, 0)", "should have changed color to red");
}

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

@ -61,18 +61,14 @@ function removeAuthorSheet(win, style)
function loadSheet(win, style, type)
{
var uri = gIOService.newURI(getUri(style));
var windowUtils = SpecialPowers.wrap(win)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var windowUtils = SpecialPowers.getDOMWindowUtils(win);
windowUtils.loadSheet(uri, windowUtils[type]);
}
function removeSheet(win, style, type)
{
var uri = gIOService.newURI(getUri(style));
var windowUtils = SpecialPowers.wrap(win)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var windowUtils = SpecialPowers.getDOMWindowUtils(win);
windowUtils.removeSheet(uri, windowUtils[type]);
}

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

@ -6,9 +6,7 @@
let io = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService);
let utils = SpecialPowers.wrap(window)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
let utils = SpecialPowers.getDOMWindowUtils(window);
function load_sheet(sheet_text, level) {
if (level != "AGENT_SHEET" && level != "USER_SHEET" && level != "AUTHOR_SHEET") {

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

@ -65,8 +65,7 @@ function webNavigation() {
}
function windowUtilsForWindow(w) {
return w.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
return w.windowUtils;
}
function windowUtils() {
@ -497,8 +496,7 @@ function FlushRendering(aFlushMode) {
var anyPendingPaintsGeneratedInDescendants = false;
function flushWindow(win) {
var utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = win.windowUtils;
var afterPaintWasPending = utils.isMozAfterPaintPending;
var root = win.document.documentElement;

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

@ -280,7 +280,7 @@ function InitAndStartRefTests()
}
#endif
g.windowUtils = g.containingWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
g.windowUtils = g.containingWindow.windowUtils;
if (!g.windowUtils || !g.windowUtils.compareCanvases)
throw "nsIDOMWindowUtils inteface missing";

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

@ -56,8 +56,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=987230
let mouseDown = isWindows ? 2 : 1;
let mouseUp = isWindows ? 4 : 2;
let mouseMove = isWindows ? 1 : 5;
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
let scale = utils.screenPixelsPerCSSPixel;

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

@ -3701,9 +3701,7 @@ GeckoDriver.prototype.commands = {
};
function getOuterWindowId(win) {
return win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
return win.windowUtils.outerWindowID;
}
/**

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

@ -28,8 +28,7 @@ function getDOMWindowUtils(win) {
}
// this assumes we are operating in chrome space
return win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
return win.windowUtils;
}
event.MouseEvents = {

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

@ -111,8 +111,7 @@ action.Chain.prototype.emitMouseEvent = function (
`clickCount: ${clickCount}`);
let win = doc.defaultView;
let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let domUtils = win.windowUtils;
let mods;
if (typeof modifiers != "undefined") {

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

@ -7,8 +7,7 @@
"use strict";
const winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const winUtil = content.windowUtils;
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
@ -343,8 +342,7 @@ const loadListener = {
observe(subject, topic) {
const win = curContainer.frame;
const winID = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
const curWinID = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
const curWinID = win.windowUtils.outerWindowID;
logger.debug(`Received observer notification ${topic} for ${winID}`);
@ -704,9 +702,7 @@ function emitTouchEvent(type, touch) {
// we get here if we're not in asyncPacZoomEnabled land, or if we're
// the main process
let domWindowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
domWindowUtils.sendTouchEvent(
win.windowUtils.sendTouchEvent(
type,
[touch.identifier],
[touch.clientX],
@ -1569,12 +1565,10 @@ function flushRendering() {
let content = curContainer.frame;
let anyPendingPaintsGeneratedInDescendants = false;
let windowUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let windowUtils = content.windowUtils;
function flushWindow(win) {
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = win.windowUtils;
let afterPaintWasPending = utils.isMozAfterPaintPending;
let root = win.document.documentElement;
@ -1611,8 +1605,7 @@ async function reftestWait(url, remote) {
let win = curContainer.frame;
let document = curContainer.frame.document;
let windowUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let windowUtils = content.windowUtils;
let reftestWait = false;

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

@ -52,9 +52,7 @@ class Windows(BaseLib):
let win = Services.focus.activeWindow;
if (win) {
return win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.outerWindowID.toString();
return win.windowUtils.outerWindowID.toString();
}
return null;

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

@ -88,8 +88,7 @@ reftest.Runner = class {
let found = this.driver.findWindow([reftestWin], () => true);
await this.driver.setWindowHandle(found, true);
this.windowUtils = reftestWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
this.windowUtils = reftestWin.windowUtils;
this.reftestWin = reftestWin;
return reftestWin;
}

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

@ -725,8 +725,7 @@ Tester.prototype = {
}));
}
let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let winUtils = window.windowUtils;
if (winUtils.isTestControllingRefreshes) {
this.currentTest.addResult(new testResult({
name: "test left refresh driver under test control",

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

@ -1283,9 +1283,7 @@ function _getDOMWindowUtils(aWindow = window)
// If documentURIObject exists or `window` is a stub object, we're in
// a chrome scope, so don't bother trying to go through SpecialPowers.
if (!window.document || window.document.documentURIObject) {
return aWindow
.QueryInterface(_EU_Ci.nsIInterfaceRequestor)
.getInterface(_EU_Ci.nsIDOMWindowUtils);
return aWindow.windowUtils;
}
// we need parent.SpecialPowers for:
@ -1300,9 +1298,7 @@ function _getDOMWindowUtils(aWindow = window)
}
// TODO: this is assuming we are in chrome space
return aWindow
.QueryInterface(_EU_Ci.nsIInterfaceRequestor)
.getInterface(_EU_Ci.nsIDOMWindowUtils);
return aWindow.windowUtils;
}
function _defineConstant(name, value) {

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

@ -226,8 +226,6 @@ MockFilePickerInstance.prototype = {
};
},
get domFileOrDirectoryEnumerator() {
this.parent.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
return {
index: 0,
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),

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

@ -12,9 +12,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
function SpecialPowers(window) {
this.window = Cu.getWeakReference(window);
this._windowID = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
this._windowID = window.windowUtils.currentInnerWindowID;
this._encounteredCrashDumpFiles = [];
this._unexpectedCrashDumpFiles = { };
this._crashDumpDir = null;

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

@ -57,8 +57,7 @@ function bindDOMWindowUtils(aWindow) {
if (!aWindow)
return undefined;
var util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var util = aWindow.windowUtils;
return wrapPrivileged(util);
}

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function _contentPaintHandler() {
var utils = content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
var utils = content.windowUtils;
if (utils.isMozAfterPaintPending) {
addEventListener("MozAfterPaint", function afterpaint(e) {
removeEventListener("MozAfterPaint", afterpaint, true);

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

@ -146,10 +146,7 @@ function plInit() {
}
}
if (forceCC &&
!window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.garbageCollect) {
if (forceCC && !window.windowUtils.garbageCollect) {
forceCC = false;
}
@ -422,9 +419,7 @@ var plNextPage = async function() {
if (doNextPage) {
if (forceCC) {
var tccstart = new Date();
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.garbageCollect();
window.windowUtils.garbageCollect();
var tccend = new Date();
report.recordCCTime(tccend - tccstart);
@ -536,9 +531,7 @@ function plLoadHandlerCapturing(evt) {
};
content.contentWindow.wrappedJSObject.plGarbageCollect = function() {
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.garbageCollect();
window.windowUtils.garbageCollect();
};
content.removeEventListener("load", plLoadHandlerCapturing, true);
@ -562,8 +555,7 @@ function plWaitForPaintingCapturing() {
if (gPaintListener)
return;
var utils = gPaintWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = gPaintWindow.windowUtils;
if (utils.isMozAfterPaintPending && useMozAfterPaint) {
if (!gPaintListener)
@ -619,8 +611,7 @@ function plLoadHandler(evt) {
// This is called after we have received a load event, now we wait for painted
function waitForPainted() {
var utils = gPaintWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = gPaintWindow.windowUtils;
if (!utils.isMozAfterPaintPending || !useMozAfterPaint) {
_loadHandler();

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

@ -14,9 +14,7 @@ const TalosContent = {
},
forceGC() {
content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.garbageCollect();
content.windowUtils.garbageCollect();
sendAsyncMessage("Talos:ForceGC:OK");
},
};

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

@ -300,17 +300,13 @@ TalosPowersService.prototype = {
// arg: ignored. return: handle (number) for use with stopFrameTimeRecording
startFrameTimeRecording(arg, callback, win) {
var rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.startFrameTimeRecording();
var rv = win.windowUtils.startFrameTimeRecording();
callback(rv);
},
// arg: handle from startFrameTimeRecording. return: array with composition intervals
stopFrameTimeRecording(arg, callback, win) {
var rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.stopFrameTimeRecording(arg);
var rv = win.windowUtils.stopFrameTimeRecording(arg);
callback(rv);
},

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

@ -164,8 +164,7 @@ Damp.prototype = {
},
async waitForPendingPaints(window) {
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
window.performance.mark("pending paints.start");
while (utils.isMozAfterPaintPending) {
await new Promise(done => {

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

@ -160,9 +160,7 @@ function forceGC(win, browser) {
// something into TalosPowers instead.
browser.messageManager.loadFrameScript("chrome://pageloader/content/talos-content.js", false);
win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.garbageCollect();
win.windowUtils.garbageCollect();
return new Promise((resolve) => {
let mm = browser.messageManager;

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

@ -215,9 +215,7 @@ Tart.prototype = {
}
startRecordTimestamp = window.performance.now();
if (self.USE_RECORDING_API) {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.startFrameTimeRecording();
return window.windowUtils.startFrameTimeRecording();
}
_recording = [];
@ -250,8 +248,7 @@ Tart.prototype = {
}
if (self.USE_RECORDING_API) {
var paints = {};
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
return window.windowUtils
.stopFrameTimeRecording(recordingHandle, paints);
}

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

@ -166,8 +166,7 @@ add_task(async function test_mouse_drag() {
let left = rect.left;
let top = rect.top;
let utils = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let utils = contentWindow.windowUtils;
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
utils.sendMouseEvent("mousemove", left, top, 0, 1, 0, false, 0, 0);
// Wait for a turn of the event loop since the synthetic mouse event

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

@ -43,8 +43,7 @@ function onTestsFinished() {
function openContextMenuFor(element) {
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
var tbX = (window.mozInnerScreenX + 10) * utils.screenPixelsPerCSSPixel;
var tbY = (window.mozInnerScreenY + 10) * utils.screenPixelsPerCSSPixel;

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

@ -58,8 +58,7 @@
// Force a menu to update itself. All of the menus parents will be updated
// as well. An empty string will force a complete menu system reload.
function forceUpdateNativeMenuAt(location) {
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
try {
utils.forceUpdateNativeMenuAt(location);
}
@ -71,8 +70,7 @@
var executedCommandID = "";
function testItem(location, targetID) {
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
var correctCommandHandler = false;
try {
utils.activateNativeMenuItemAt(location);

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

@ -116,8 +116,7 @@
printDebug("sending event: " + x + ", " + y + " (" + msg + ")\n");
gCurrentMouseX = x;
gCurrentMouseY = y;
var utils = win.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = win.windowUtils;
var callbackFunc = function() {
clearExpectedEvents();
callback();
@ -401,8 +400,7 @@
eventListenOnce(rightElem, "popupshown", callback);
gCurrentMouseX = 410;
gCurrentMouseY = 180;
var utils = right.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = right.windowUtils;
utils.sendNativeMouseEvent(410, 180, NSMouseMoved, 0, null);
},
// Now the tooltip is visible.
@ -655,8 +653,7 @@
eventListenOnce(rightElem, "popupshown", callback);
gCurrentMouseX = 410;
gCurrentMouseY = 180;
var utils = right.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = right.windowUtils;
utils.sendNativeMouseEvent(410, 180, NSMouseMoved, 0, null);
},
// Now the tooltip is visible.

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

@ -27,8 +27,7 @@ var gLeftWindow, gRightWindow, gIFrame;
var gExpectedEvents = [];
function moveMouseTo(x, y, andThen) {
var utils = gLeftWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = gLeftWindow.windowUtils;
utils.sendNativeMouseEvent(x, y, NSMouseMoved, 0, gLeftWindow.documentElement);
SimpleTest.executeSoon(andThen);
}

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

@ -127,9 +127,7 @@ function hitEventLoop(aFunc, aTimes)
}
}
var gUtils = window.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var gUtils = window.windowUtils;
var gFM = Cc["@mozilla.org/focus-manager;1"].
getService(Ci.nsIFocusManager);
const kIMEEnabledSupported = navigator.platform.indexOf("Mac") == 0 ||
@ -1358,9 +1356,7 @@ function runTestPasswordFieldOnDialog()
{
ok(true, "onPasswordFieldFocus is called");
passwordField.removeEventListener("focus", onPasswordFieldFocus);
var utils = dialog.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var utils = dialog.windowUtils;
is(utils.IMEStatus, utils.IME_STATUS_PASSWORD,
"IME isn't disabled on a password field of password dialog");
synthesizeKey("VK_ESCAPE", { }, dialog);

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

@ -28,8 +28,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=835044
<![CDATA[
SimpleTest.waitForExplicitFinish();
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
let utils = window.windowUtils;
let panel = document.getElementById('thepanel');
let nativeMouseMove;
let rect;

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

@ -31,9 +31,7 @@ SimpleTest.waitForExplicitFinish();
var gPlugin = document.getElementById("plugin");
var gUtils = window.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
var gUtils = window.windowUtils;
function* doTest() {
gPlugin.focus();

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

@ -107,9 +107,7 @@ function observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
function runTests()
{
var utils =
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var utils = window.windowUtils;
var fm =
Cc["@mozilla.org/focus-manager;1"]
.getService(Ci.nsIFocusManager);

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

@ -131,8 +131,7 @@ function getWindowUtils(aWindow)
if (!aWindow) {
aWindow = window;
}
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(nsIDOMWindowUtils);
return aWindow.windowUtils;
}
function getPointInScreen(aElement, aWindow)