Bug 1106079 - Avoid highlighter excpetions on XUL windows to break the style-editor; r=past

This commit is contained in:
Patrick Brosset 2014-11-28 17:57:19 +01:00
Родитель ab05e7e7fb
Коммит 30dce5a4e4
3 изменённых файлов: 30 добавлений и 2 удалений

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

@ -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();

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

@ -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]

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

@ -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");
});