diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 7000d88449aa..dfd623a77af9 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -760,6 +760,7 @@ void ClientLayerManager::GetBackendName(nsAString& aName) { switch (mForwarder->GetCompositorBackendType()) { + case LayersBackend::LAYERS_NONE: aName.AssignLiteral("None"); return; case LayersBackend::LAYERS_BASIC: aName.AssignLiteral("Basic"); return; case LayersBackend::LAYERS_OPENGL: aName.AssignLiteral("OpenGL"); return; case LayersBackend::LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return; diff --git a/gfx/tests/browser/browser.ini b/gfx/tests/browser/browser.ini new file mode 100644 index 000000000000..0a1902f0eabb --- /dev/null +++ b/gfx/tests/browser/browser.ini @@ -0,0 +1,4 @@ +[DEFAULT] +support-files = + +[browser_windowless_troubleshoot_crash.js] diff --git a/gfx/tests/browser/browser_windowless_troubleshoot_crash.js b/gfx/tests/browser/browser_windowless_troubleshoot_crash.js new file mode 100644 index 000000000000..78008a951f0c --- /dev/null +++ b/gfx/tests/browser/browser_windowless_troubleshoot_crash.js @@ -0,0 +1,43 @@ +let { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); + +add_task(function* test_windowlessBrowserTroubleshootCrash() { + 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) { + Services.obs.removeObserver(listener, "content-document-global-created", false); + resolve(); + } + } + } + Services.obs.addObserver(listener, "content-document-global-created", false); + }); + webNav.loadURI("about:blank", 0, null, null, null); + + yield onLoaded; + + let winUtils = webNav.document.defaultView. + QueryInterface(Ci.nsIInterfaceRequestor). + getInterface(Ci.nsIDOMWindowUtils); + is(winUtils.layerManagerType, "None", "windowless browser's layerManagerType should be 'None'"); + + ok(true, "not crashed"); + + var Troubleshoot = Cu.import("resource://gre/modules/Troubleshoot.jsm", {}).Troubleshoot; + var data = yield new Promise((resolve, reject) => { + Troubleshoot.snapshot((data) => { + resolve(data); + }); + }); + + ok(data.graphics.windowLayerManagerType !== "None", "windowless browser window should not set windowLayerManagerType to 'None'"); +}); diff --git a/gfx/tests/moz.build b/gfx/tests/moz.build index b985130de0c3..696ca9a9b086 100644 --- a/gfx/tests/moz.build +++ b/gfx/tests/moz.build @@ -6,3 +6,4 @@ XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini'] +BROWSER_CHROME_MANIFESTS += ['browser/browser.ini'] diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index 159bc66b9b7a..bf7f872db884 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -307,11 +307,15 @@ var dataProviders = { data.numAcceleratedWindows = 0; let winEnumer = Services.ww.getWindowEnumerator(); while (winEnumer.hasMoreElements()) { - data.numTotalWindows++; let winUtils = winEnumer.getNext(). QueryInterface(Ci.nsIInterfaceRequestor). getInterface(Ci.nsIDOMWindowUtils); try { + // NOTE: windowless browser's windows should not be reported in the graphics troubleshoot report + if (winUtils.layerManagerType == "None") { + continue; + } + data.numTotalWindows++; data.windowLayerManagerType = winUtils.layerManagerType; data.windowLayerManagerRemote = winUtils.layerManagerRemote; data.supportsHardwareH264 = winUtils.supportsHardwareH264Decoding;