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..a451c59a9b6a60315eb0ea58849abd7013332d5c 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,22 +88,25 @@ 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); |
+ var script = this.target().debuggerModel.scriptForId(scriptId); |
WebInspector.LiveEditSupport.logDetailedError(error, errorData, script); |
return; |
} |
WebInspector.LiveEditSupport.logSuccess(); |
} |
- } |
+ }, |
+ |
+ __proto__: WebInspector.TargetAware.prototype |
} |
/** |
@@ -130,6 +136,3 @@ WebInspector.LiveEditSupport.logSuccess = function() |
{ |
WebInspector.messageSink.addMessage(WebInspector.UIString("Recompilation and update succeeded.")); |
} |
- |
-/** @type {!WebInspector.LiveEditSupport} */ |
-WebInspector.liveEditSupport; |