diff --git a/browser/devtools/styleeditor/StyleEditorUI.jsm b/browser/devtools/styleeditor/StyleEditorUI.jsm index 157bf18f88e5..0181d464fd5d 100644 --- a/browser/devtools/styleeditor/StyleEditorUI.jsm +++ b/browser/devtools/styleeditor/StyleEditorUI.jsm @@ -435,7 +435,28 @@ StyleEditorUI.prototype = { editor.getSourceEditor().then(() => { editor.sourceEditor.setCursor({line: line, ch: col}); }); - this._view.activeSummary = editor.summary; + + this.getEditorSummary(editor).then((summary) => { + this._view.activeSummary = summary; + }) + }, + + getEditorSummary: function(editor) { + if (editor.summary) { + return promise.resolve(editor.summary); + } + + let deferred = promise.defer(); + let self = this; + + this.on("editor-added", function onAdd(e, selected) { + if (selected == editor) { + self.off("editor-added", onAdd); + deferred.resolve(editor.summary); + } + }); + + return deferred.promise; }, /** diff --git a/browser/devtools/styleinspector/style-inspector.js b/browser/devtools/styleinspector/style-inspector.js index c154a6c40e92..753eea023a7d 100644 --- a/browser/devtools/styleinspector/style-inspector.js +++ b/browser/devtools/styleinspector/style-inspector.js @@ -49,10 +49,11 @@ function RuleViewTool(aInspector, aWindow, aIFrame) // Chrome stylesheets are not listed in the style editor, so show // these sheets in the view source window instead. - if (!sheet || !rule.href || sheet.isSystem) { + if (!sheet || sheet.isSystem) { let contentDoc = this.inspector.selection.document; let viewSourceUtils = this.inspector.viewSourceUtils; - viewSourceUtils.viewSource(rule.href, null, contentDoc, rule.line || 0); + let href = rule.nodeHref || rule.href; + viewSourceUtils.viewSource(href, null, contentDoc, rule.line || 0); return; } diff --git a/toolkit/devtools/server/actors/styles.js b/toolkit/devtools/server/actors/styles.js index fa2223da04f3..e5ebbd292e91 100644 --- a/toolkit/devtools/server/actors/styles.js +++ b/toolkit/devtools/server/actors/styles.js @@ -769,7 +769,12 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, { return this._form.href; } let sheet = this.parentStyleSheet; - return sheet.href || sheet.nodeHref; + return sheet.href; + }, + + get nodeHref() { + let sheet = this.parentStyleSheet; + return sheet ? sheet.nodeHref : ""; }, get location()