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

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 live edit 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
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 f2331b8913c89994b9ae2f855f63f3babf659da0..56ccaf43fbd36d8955c4d09d2488f859f4447f01 100644
--- a/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
+++ b/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
@@ -280,16 +280,29 @@ 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 targetId = WebInspector.DefaultScriptMapping.targetIdFromProjectId(this._uiSourceCode.project().id());
vsevik 2014/06/26 13:07:29 Let's make projectIdForTargetId public static inst
sergeyv 2014/06/26 14:08:40 Done.
+ var target;
+ var targets = WebInspector.targetManager.targets();
+ for (var i = 0; i < targets.length; ++i) {
+ if (targetId === targets[i].id()) {
+ target = targets[i];
+ break;
+ }
+ }
+ if (!target)
+ return;
+
+ contextMenu.appendItem(liveEditLabel, liveEdit.bind(this, target.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));
}

Powered by Google App Engine
This is Rietveld 408576698