diff --git a/browser/devtools/styleeditor/StyleEditorUI.jsm b/browser/devtools/styleeditor/StyleEditorUI.jsm index e4dbad35c2a0..72cabc642db1 100644 --- a/browser/devtools/styleeditor/StyleEditorUI.jsm +++ b/browser/devtools/styleeditor/StyleEditorUI.jsm @@ -123,8 +123,15 @@ StyleEditorUI.prototype = { let hUtils = toolbox.highlighterUtils; if (hUtils.hasCustomHighlighter(SELECTOR_HIGHLIGHTER_TYPE)) { - this._highlighter = - yield hUtils.getHighlighterByType(SELECTOR_HIGHLIGHTER_TYPE); + try { + this._highlighter = + yield hUtils.getHighlighterByType(SELECTOR_HIGHLIGHTER_TYPE); + } catch (e) { + // The selectorHighlighter can't always be instantiated, for example + // it doesn't work with XUL windows (until bug 1094959 gets fixed). + console.warn("The selectorHighlighter couldn't be instantiated, " + + "elements matching hovered selectors will not be highlighted"); + } } }.bind(this)).then(() => { this.createUI(); diff --git a/browser/devtools/styleeditor/test/browser.ini b/browser/devtools/styleeditor/test/browser.ini index 7453910603fb..b7b49b40e2a0 100644 --- a/browser/devtools/styleeditor/test/browser.ini +++ b/browser/devtools/styleeditor/test/browser.ini @@ -73,3 +73,4 @@ skip-if = e10s # Bug 1055333 - style editor tests disabled with e10s [browser_styleeditor_sourcemap_watching.js] skip-if = e10s # Bug 1055333 - style editor tests disabled with e10s [browser_styleeditor_transition_rule.js] +[browser_styleeditor_xul.js] diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_xul.js b/browser/devtools/styleeditor/test/browser_styleeditor_xul.js new file mode 100644 index 000000000000..77d0438cad5d --- /dev/null +++ b/browser/devtools/styleeditor/test/browser_styleeditor_xul.js @@ -0,0 +1,20 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that the style-editor initializes correctly for XUL windows. + +waitForExplicitFinish(); + +const TEST_URL = "about:config"; + +let test = asyncTest(function*() { + let tab = yield addTab(TEST_URL); + let target = TargetFactory.forTab(tab); + + let toolbox = yield gDevTools.showToolbox(target, "styleeditor"); + let panel = toolbox.getCurrentPanel(); + yield panel.UI.once("editor-added"); + + ok(panel, "The style-editor panel did initialize correctly for the XUL window"); +});