Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2511)

Unified Diff: Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 352953002: DevTools: properly support targets in LiveEditSupport (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/sdk/Target.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sources/JavaScriptSourceFrame.js
diff --git a/Source/devtools/front_end/sources/JavaScriptSourceFrame.js b/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
index 018bf7dced863929f7361df00afed52850bbe8b2..f783d3b27039b332b6b71218b75100140ceaf7da 100644
--- a/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
+++ b/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
@@ -280,16 +280,21 @@ WebInspector.JavaScriptSourceFrame.prototype = {
// FIXME: Change condition above to explicitly check that current uiSourceCode is created by default debugger mapping
// and move the code adding this menu item to generic context menu provider for UISourceCode.
var liveEditLabel = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Live edit" : "Live Edit");
- contextMenu.appendItem(liveEditLabel, liveEdit.bind(this));
+ var liveEditSupport = WebInspector.LiveEditSupport.liveEditSupportForUISourceCode(this._uiSourceCode);
+ if (!liveEditSupport)
+ return;
+
+ contextMenu.appendItem(liveEditLabel, liveEdit.bind(this, liveEditSupport));
contextMenu.appendSeparator();
}
/**
* @this {WebInspector.JavaScriptSourceFrame}
+ * @param {!WebInspector.LiveEditSupport} liveEditSupport
*/
- function liveEdit()
+ function liveEdit(liveEditSupport)
{
- var liveEditUISourceCode = WebInspector.liveEditSupport.uiSourceCodeForLiveEdit(this._uiSourceCode);
+ var liveEditUISourceCode = liveEditSupport.uiSourceCodeForLiveEdit(this._uiSourceCode);
WebInspector.Revealer.reveal(liveEditUISourceCode.uiLocation(lineNumber));
}
@@ -309,13 +314,45 @@ WebInspector.JavaScriptSourceFrame.prototype = {
_workingCopyCommitted: function(event)
{
+
+ var liveEditError;
+ var liveEditErrorData;
+ var contextScript;
+ var succeededEdits = 0;
+ var failedEdits = 0;
+
+ /**
+ * @param {?string} error
+ * @param {!DebuggerAgent.SetScriptSourceError=} errorData
+ * @param {!WebInspector.Script=} script
+ */
+ function liveEditCallback(error, errorData, script)
+ {
+ if (error) {
+ liveEditError = error;
+ liveEditErrorData = errorData;
+ contextScript = script;
+ failedEdits++;
+ } else
+ succeededEdits++;
+
+ if (succeededEdits + failedEdits !== scriptFiles.length)
+ return;
+
+ if (!failedEdits)
+ WebInspector.LiveEditSupport.logSuccess();
+ else
+ WebInspector.LiveEditSupport.logDetailedError(liveEditError, liveEditErrorData, contextScript)
+
+ }
+
if (this._supportsEnabledBreakpointsWhileEditing())
return;
if (this._scriptFileForTarget.size()) {
this._hasCommittedLiveEdit = true;
var scriptFiles = this._scriptFileForTarget.values();
for (var i = 0; i < scriptFiles.length; ++i)
- scriptFiles[i].commitLiveEdit();
+ scriptFiles[i].commitLiveEdit(liveEditCallback);
return;
}
this._restoreBreakpointsAfterEditing();
« no previous file with comments | « Source/devtools/front_end/sdk/Target.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698