2015-11-11 09:08:00 +03:00
|
|
|
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
|
|
|
|
2017-06-22 13:51:42 +03:00
|
|
|
add_task(async function test_windowlessBrowserTroubleshootCrash() {
|
2015-11-11 09:08:00 +03:00
|
|
|
let webNav = Services.appShell.createWindowlessBrowser(false);
|
|
|
|
|
|
|
|
let onLoaded = new Promise((resolve, reject) => {
|
|
|
|
let docShell = webNav.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIDocShell);
|
|
|
|
let listener = {
|
|
|
|
observe(contentWindow, topic, data) {
|
|
|
|
let observedDocShell = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIWebNavigation)
|
|
|
|
.QueryInterface(Ci.nsIDocShellTreeItem)
|
|
|
|
.sameTypeRootTreeItem
|
|
|
|
.QueryInterface(Ci.nsIDocShell);
|
|
|
|
if (docShell === observedDocShell) {
|
2017-01-12 00:27:42 +03:00
|
|
|
Services.obs.removeObserver(listener, "content-document-global-created");
|
2015-11-11 09:08:00 +03:00
|
|
|
resolve();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-04-14 22:51:38 +03:00
|
|
|
Services.obs.addObserver(listener, "content-document-global-created");
|
2015-11-11 09:08:00 +03:00
|
|
|
});
|
|
|
|
webNav.loadURI("about:blank", 0, null, null, null);
|
|
|
|
|
2017-06-22 13:51:42 +03:00
|
|
|
await onLoaded;
|
2015-11-11 09:08:00 +03:00
|
|
|
|
|
|
|
let winUtils = webNav.document.defaultView.
|
|
|
|
QueryInterface(Ci.nsIInterfaceRequestor).
|
|
|
|
getInterface(Ci.nsIDOMWindowUtils);
|
2017-01-24 16:03:08 +03:00
|
|
|
try {
|
2017-02-12 22:38:34 +03:00
|
|
|
is(winUtils.layerManagerType, "Basic", "windowless browser's layerManagerType should be 'Basic'");
|
2017-01-24 16:03:08 +03:00
|
|
|
} catch (e) {
|
|
|
|
// The windowless browser may not have a layermanager at all yet, and that's ok.
|
|
|
|
// The troubleshooting code similarly skips over windows with no layer managers.
|
|
|
|
}
|
2015-11-11 09:08:00 +03:00
|
|
|
ok(true, "not crashed");
|
|
|
|
|
|
|
|
var Troubleshoot = Cu.import("resource://gre/modules/Troubleshoot.jsm", {}).Troubleshoot;
|
2017-06-22 13:51:42 +03:00
|
|
|
var data = await new Promise((resolve, reject) => {
|
2015-11-11 09:08:00 +03:00
|
|
|
Troubleshoot.snapshot((data) => {
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
ok(data.graphics.windowLayerManagerType !== "None", "windowless browser window should not set windowLayerManagerType to 'None'");
|
2016-01-16 00:30:15 +03:00
|
|
|
|
|
|
|
webNav.close();
|
2015-11-11 09:08:00 +03:00
|
|
|
});
|