зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1500072 - Add browserLoader reference on window when flags.testing is true;r=ochameau
Depends on D19582 Differential Revision: https://phabricator.services.mozilla.com/D19638 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2b3455d14f
Коммит
a2cbcb26b8
|
@ -17,10 +17,10 @@ const TEST_URL = "data:text/html;charset=UTF-8,<div>Webconsole modules load test
|
|||
|
||||
add_task(async function() {
|
||||
const toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole");
|
||||
const hud = toolbox.getCurrentPanel().hud;
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
|
||||
// Retrieve the browser loader dedicated to the WebConsole.
|
||||
const webconsoleLoader = hud.ui.browserLoader;
|
||||
const webconsoleLoader = panel._frameWindow.getBrowserLoaderForWindow();
|
||||
const loaders = [loader.provider.loader, webconsoleLoader.loader];
|
||||
|
||||
runMetricsTest({
|
||||
|
|
|
@ -188,6 +188,10 @@ function BrowserLoaderBuilder({ baseURI, window, useOnlyShared, commonLibRequire
|
|||
|
||||
const mainModule = loaders.Module(baseURI, joinURI(baseURI, "main.js"));
|
||||
this.loader = loaders.Loader(opts);
|
||||
// When running tests, expose the BrowserLoader instance for metrics tests.
|
||||
if (flags.testing) {
|
||||
window.getBrowserLoaderForWindow = () => this;
|
||||
}
|
||||
this.require = loaders.Require(this.loader, mainModule);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,5 +102,6 @@ function testWithRegularDevtoolsModule() {
|
|||
function test() {
|
||||
testWithChromeScheme();
|
||||
testWithRegularDevtoolsModule();
|
||||
delete window.getBrowserLoaderForWindow;
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -12,14 +12,9 @@ this.WebConsoleWrapper = function(parentNode, hud, toolbox, owner, document) {
|
|||
// Initialize module loader and load all modules of the new inline
|
||||
// preview feature. The entire code-base doesn't need any extra
|
||||
// privileges and runs entirely in content scope.
|
||||
const browserLoader = BrowserLoader({
|
||||
const WebConsoleWrapper = BrowserLoader({
|
||||
baseURI: "resource://devtools/client/webconsole/",
|
||||
window,
|
||||
});
|
||||
|
||||
// Expose the browserLoader instance on the webconsole hud for metrics tests.
|
||||
hud.browserLoader = browserLoader;
|
||||
|
||||
const WebConsoleWrapper = browserLoader.require("./webconsole-wrapper");
|
||||
}).require("./webconsole-wrapper");
|
||||
return new WebConsoleWrapper(parentNode, hud, toolbox, owner, document);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче