From 63f9ca53ff59dfc724f41f35e69a40a22bd3c7c0 Mon Sep 17 00:00:00 2001 From: Sami Jaktholm Date: Sat, 28 Mar 2015 07:22:50 +0200 Subject: [PATCH] Bug 1148893 - Return the style sheet selection promise to the caller. r=ejpbruel --- browser/devtools/styleeditor/StyleEditorUI.jsm | 8 ++++++-- browser/devtools/styleeditor/styleeditor-panel.js | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/browser/devtools/styleeditor/StyleEditorUI.jsm b/browser/devtools/styleeditor/StyleEditorUI.jsm index b4b4929b4c80..72746964212f 100644 --- a/browser/devtools/styleeditor/StyleEditorUI.jsm +++ b/browser/devtools/styleeditor/StyleEditorUI.jsm @@ -632,7 +632,8 @@ StyleEditorUI.prototype = { * @param {number} col * Column number to jump to * @return {Promise} - * Promise that will resolve when the editor is selected. + * Promise that will resolve when the editor is selected and ready + * to be used. */ _selectEditor: function(editor, line, col) { line = line || 0; @@ -707,6 +708,9 @@ StyleEditorUI.prototype = { * Line to which the caret should be moved (zero-indexed). * @param {Number} [col] * Column to which the caret should be moved (zero-indexed). + * @return {Promise} + * Promise that will resolve when the editor is selected and ready + * to be used. */ selectStyleSheet: function(stylesheet, line, col) { this._styleSheetToSelect = { @@ -717,7 +721,7 @@ StyleEditorUI.prototype = { /* Switch to the editor for this sheet, if it exists yet. Otherwise each editor will be checked when it's created. */ - this.switchToSelectedSheet(); + return this.switchToSelectedSheet(); }, diff --git a/browser/devtools/styleeditor/styleeditor-panel.js b/browser/devtools/styleeditor/styleeditor-panel.js index 3949d444db1d..b807057c83db 100644 --- a/browser/devtools/styleeditor/styleeditor-panel.js +++ b/browser/devtools/styleeditor/styleeditor-panel.js @@ -110,12 +110,15 @@ StyleEditorPanel.prototype = { * Line number to jump to after selecting. One-indexed * @param {number} col * Column number to jump to after selecting. One-indexed + * @return {Promise} + * Promise that will resolve when the editor is selected and ready + * to be used. */ selectStyleSheet: function(href, line, col) { if (!this._debuggee || !this.UI) { return; } - this.UI.selectStyleSheet(href, line - 1, col ? col - 1 : 0); + return this.UI.selectStyleSheet(href, line - 1, col ? col - 1 : 0); }, /**