| Index: Source/devtools/front_end/sdk/CSSStyleModel.js
|
| diff --git a/Source/devtools/front_end/sdk/CSSStyleModel.js b/Source/devtools/front_end/sdk/CSSStyleModel.js
|
| index 359c415192c44743492841d72ff4231d651a778b..d1bf067504dcdea229afc57724777e20ec780ed9 100644
|
| --- a/Source/devtools/front_end/sdk/CSSStyleModel.js
|
| +++ b/Source/devtools/front_end/sdk/CSSStyleModel.js
|
| @@ -557,17 +557,18 @@ WebInspector.CSSStyleModel.prototype = {
|
| * @param {!CSSAgent.StyleSheetId} styleSheetId
|
| * @param {string} newText
|
| * @param {boolean} majorChange
|
| - * @param {?function(?Protocol.Error)} userCallback
|
| + * @return {!Promise.<?Protocol.Error>}
|
| */
|
| - setStyleSheetText: function(styleSheetId, newText, majorChange, userCallback)
|
| + setStyleSheetText: function(styleSheetId, newText, majorChange)
|
| {
|
| var header = this._styleSheetIdToHeader.get(styleSheetId);
|
| console.assert(header);
|
| this._pendingCommandsMajorState.push(majorChange);
|
| - header.setContent(newText, callback.bind(this));
|
| + return header._setContentPromise(newText).then(callback.bind(this));
|
|
|
| /**
|
| * @param {?Protocol.Error} error
|
| + * @return {?Protocol.Error}
|
| * @this {WebInspector.CSSStyleModel}
|
| */
|
| function callback(error)
|
| @@ -576,8 +577,7 @@ WebInspector.CSSStyleModel.prototype = {
|
| if (!error && majorChange)
|
| this._domModel.markUndoableState();
|
|
|
| - if (!error && userCallback)
|
| - userCallback(error);
|
| + return error;
|
| }
|
| },
|
|
|
| @@ -1807,18 +1807,18 @@ WebInspector.CSSStyleSheetHeader.prototype = {
|
|
|
| /**
|
| * @param {string} newText
|
| - * @param {function(?Protocol.Error)} callback
|
| + * @return {!Promise.<?Protocol.Error>}
|
| */
|
| - setContent: function(newText, callback)
|
| + _setContentPromise: function(newText)
|
| {
|
| newText = this._trimSourceURL(newText);
|
| if (this.hasSourceURL)
|
| newText += "\n/*# sourceURL=" + this.sourceURL + " */";
|
| - this._cssModel._agent.setStyleSheetText(this.id, newText, extractProtocolError)
|
| - .then(callback);
|
| + return this._cssModel._agent.setStyleSheetText(this.id, newText, extractProtocolError);
|
|
|
| /**
|
| * @param {?Protocol.Error} error
|
| + * @return {?Protocol.Error}
|
| */
|
| function extractProtocolError(error)
|
| {
|
| @@ -1827,6 +1827,17 @@ WebInspector.CSSStyleSheetHeader.prototype = {
|
| },
|
|
|
| /**
|
| + * @param {string} newText
|
| + * @param {function(?Protocol.Error)} callback
|
| + */
|
| + setContent: function(newText, callback)
|
| + {
|
| + this._setContentPromise(newText)
|
| + .catchException(null)
|
| + .then(callback);
|
| + },
|
| +
|
| + /**
|
| * @return {boolean}
|
| */
|
| isViaInspector: function()
|
|
|