Bug 1661138 - Make WPT print reftests not open new windows. r=jgraham,marionette-reviewers

As it's too slow (specially on Android and WebRender) and causes tests
to timeout semi-randomly.

In order to do that, implement nsIBrowserDOMWindow in the reftest
window, in a way that keeps the existing behavior for all other things
we care about.

While at it, remove the renderroot attribute which is just leftover (no
longer exists).

Differential Revision: https://phabricator.services.mozilla.com/D91186
This commit is contained in:
Emilio Cobos Álvarez 2020-09-25 09:15:48 +00:00
Родитель 9abdc0cc16
Коммит 309f9b7e7b
4 изменённых файлов: 77 добавлений и 6 удалений

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

@ -7,9 +7,7 @@
hidechrome="true"
onload="OnRefTestLoad();"
onunload="OnRefTestUnload();"
style="background:white; overflow:hidden"
renderroot="content"
>
style="background:white; overflow:hidden">
<script type="application/ecmascript" src="resource://reftest/reftest.jsm" />
<!-- The reftest browser element is dynamically created, here -->
</window>

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

@ -37,6 +37,7 @@ marionette.jar:
content/proxy.js (proxy.js)
content/reftest.js (reftest.js)
content/reftest.xhtml (reftest.xhtml)
content/reftest-content.js (reftest-content.js)
content/server.js (server.js)
content/stream-utils.js (stream-utils.js)
content/sync.js (sync.js)

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

@ -0,0 +1,72 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
XPCOMUtils.defineLazyScriptGetter(
this,
"PrintUtils",
"chrome://global/content/printUtils.js"
);
// This is an implementation of nsIBrowserDOMWindow that handles only opening
// print browsers, because the "open a new window fallback" is just too slow
// in some cases and causes timeouts.
function BrowserDOMWindow() {}
BrowserDOMWindow.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsIBrowserDOMWindow"]),
_maybeOpen(aOpenWindowInfo, aWhere) {
if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_PRINT_BROWSER) {
return PrintUtils.startPrintWindow(
aOpenWindowInfo.parent,
aOpenWindowInfo
);
}
return null;
},
createContentWindow(
aURI,
aOpenWindowInfo,
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp
) {
return this._maybeOpen(aOpenWindowInfo, aWhere)?.browsingContext;
},
openURI(aURI, aOpenWindowInfo, aWhere, aFlags, aTriggeringPrincipal, aCsp) {
return this._maybeOpen(aOpenWindowInfo, aWhere)?.browsingContext;
},
createContentWindowInFrame(aURI, aParams, aWhere, aFlags, aName) {
return this._maybeOpen(aParams.openWindowInfo, aWhere);
},
openURIInFrame(aURI, aParams, aWhere, aFlags, aName) {
return this._maybeOpen(aParams.openWindowInfo, aWhere);
},
canClose() {
return true;
},
get tabCount() {
return 1;
},
isTabContentWindow(win) {
// This method is probably not needed anymore: bug 1602915
// In any case this gives us the default behavior.
return false;
},
};
window.browserDOMWindow = new BrowserDOMWindow();

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

@ -1,6 +1,6 @@
<window id="reftest"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
hidechrome="true"
style="background-color:white; overflow:hidden"
renderroot="content">
</window>
style="background-color:white; overflow:hidden">
<script src="reftest-content.js"></script>
</window>