| Index: Source/devtools/front_end/sdk/LiveEditSupport.js
|
| diff --git a/Source/devtools/front_end/sdk/LiveEditSupport.js b/Source/devtools/front_end/sdk/LiveEditSupport.js
|
| index 1abd6c1e7d378d17621c9b43d97ed320be2da119..6f64b6b43971dd077f1f685aafaf90ee54d2e8cf 100644
|
| --- a/Source/devtools/front_end/sdk/LiveEditSupport.js
|
| +++ b/Source/devtools/front_end/sdk/LiveEditSupport.js
|
| @@ -30,14 +30,17 @@
|
|
|
| /**
|
| * @constructor
|
| + * @extends {WebInspector.TargetAware}
|
| + * @param {!WebInspector.Target} target
|
| * @param {!WebInspector.Workspace} workspace
|
| */
|
| -WebInspector.LiveEditSupport = function(workspace)
|
| +WebInspector.LiveEditSupport = function(target, workspace)
|
| {
|
| + WebInspector.TargetAware.call(this, target);
|
| this._workspace = workspace;
|
| - this._projectId = "liveedit:";
|
| + this._projectId = "liveedit:" + target.id();
|
| this._projectDelegate = new WebInspector.DebuggerProjectDelegate(workspace, this._projectId, WebInspector.projectTypes.LiveEdit);
|
| - WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
|
| + target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
|
| this._debuggerReset();
|
| }
|
|
|
| @@ -48,7 +51,7 @@ WebInspector.LiveEditSupport.prototype = {
|
| */
|
| uiSourceCodeForLiveEdit: function(uiSourceCode)
|
| {
|
| - var rawLocation = uiSourceCode.uiLocationToRawLocation(WebInspector.targetManager.targets()[0], 0, 0);
|
| + var rawLocation = uiSourceCode.uiLocationToRawLocation(this.target(), 0, 0);
|
| var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Location} */ (rawLocation);
|
| var script = debuggerModelLocation.script();
|
| var uiLocation = script.rawLocationToUILocation(0, 0);
|
| @@ -85,51 +88,55 @@ WebInspector.LiveEditSupport.prototype = {
|
| {
|
| var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.target);
|
| var scriptId = /** @type {string} */ (this._scriptIdForUISourceCode.get(uiSourceCode));
|
| - WebInspector.debuggerModel.setScriptSource(scriptId, uiSourceCode.workingCopy(), innerCallback);
|
| + this.target().debuggerModel.setScriptSource(scriptId, uiSourceCode.workingCopy(), innerCallback.bind(this));
|
|
|
| /**
|
| + * @this {WebInspector.LiveEditSupport}
|
| * @param {?string} error
|
| * @param {!DebuggerAgent.SetScriptSourceError=} errorData
|
| */
|
| function innerCallback(error, errorData)
|
| {
|
| if (error) {
|
| - var script = WebInspector.debuggerModel.scriptForId(scriptId);
|
| - WebInspector.LiveEditSupport.logDetailedError(error, errorData, script);
|
| + var script = this.target().debuggerModel.scriptForId(scriptId);
|
| + WebInspector.LiveEditSupport.logDetailedError(this.target(), error, errorData, script);
|
| return;
|
| }
|
| - WebInspector.LiveEditSupport.logSuccess();
|
| + WebInspector.LiveEditSupport.logSuccess(this.target());
|
| }
|
| - }
|
| + },
|
| +
|
| + __proto__: WebInspector.TargetAware.prototype
|
| }
|
|
|
| /**
|
| - * @param {?string} error
|
| - * @param {!DebuggerAgent.SetScriptSourceError=} errorData
|
| - * @param {!WebInspector.Script=} contextScript
|
| - */
|
| -WebInspector.LiveEditSupport.logDetailedError = function(error, errorData, contextScript)
|
| +* @param {!WebInspector.Target} target
|
| +* @param {?string} error
|
| +* @param {!DebuggerAgent.SetScriptSourceError=} errorData
|
| +* @param {!WebInspector.Script=} contextScript
|
| +*/
|
| +WebInspector.LiveEditSupport.logDetailedError = function(target, error, errorData, contextScript)
|
| {
|
| var warningLevel = WebInspector.ConsoleMessage.MessageLevel.Warning;
|
| if (!errorData) {
|
| if (error)
|
| - WebInspector.messageSink.addMessage(WebInspector.UIString("LiveEdit failed: %s", error), warningLevel);
|
| + target.consoleModel.log(WebInspector.UIString("LiveEdit failed: %s", error), warningLevel, false);
|
| return;
|
| }
|
| var compileError = errorData.compileError;
|
| if (compileError) {
|
| var location = contextScript ? WebInspector.UIString(" at %s:%d:%d", contextScript.sourceURL, compileError.lineNumber, compileError.columnNumber) : "";
|
| var message = WebInspector.UIString("LiveEdit compile failed: %s%s", compileError.message, location);
|
| - WebInspector.messageSink.addErrorMessage(message);
|
| + target.consoleModel.log(message, WebInspector.ConsoleMessage.MessageLevel.Error, false);
|
| } else {
|
| - WebInspector.messageSink.addMessage(WebInspector.UIString("Unknown LiveEdit error: %s; %s", JSON.stringify(errorData), error), warningLevel);
|
| + target.consoleModel.log(WebInspector.UIString("Unknown LiveEdit error: %s; %s", JSON.stringify(errorData), error), warningLevel, false);
|
| }
|
| }
|
|
|
| -WebInspector.LiveEditSupport.logSuccess = function()
|
| +/**
|
| + * @param {!WebInspector.Target} target
|
| + */
|
| +WebInspector.LiveEditSupport.logSuccess = function(target)
|
| {
|
| - WebInspector.messageSink.addMessage(WebInspector.UIString("Recompilation and update succeeded."));
|
| + target.consoleModel.log(WebInspector.UIString("Recompilation and update succeeded."), WebInspector.ConsoleMessage.MessageLevel.Debug, false);
|
| }
|
| -
|
| -/** @type {!WebInspector.LiveEditSupport} */
|
| -WebInspector.liveEditSupport;
|
|
|