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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js

Issue 1668603003: Devtools: Switch JS execution context to match inspected node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (!selectedNode && this._lastValidSelectedNode) 378 if (!selectedNode && this._lastValidSelectedNode)
379 this._selectedPathOnReset = this._lastValidSelectedNode.path(); 379 this._selectedPathOnReset = this._lastValidSelectedNode.path();
380 380
381 this._breadcrumbs.setSelectedNode(selectedNode); 381 this._breadcrumbs.setSelectedNode(selectedNode);
382 382
383 WebInspector.context.setFlavor(WebInspector.DOMNode, selectedNode); 383 WebInspector.context.setFlavor(WebInspector.DOMNode, selectedNode);
384 384
385 if (selectedNode) { 385 if (selectedNode) {
386 selectedNode.setAsInspectedNode(); 386 selectedNode.setAsInspectedNode();
387 this._lastValidSelectedNode = selectedNode; 387 this._lastValidSelectedNode = selectedNode;
388
389 var executionContexts = selectedNode.target().runtimeModel.execution Contexts();
390 for (var context of executionContexts) {
391 var frame = context.target().resourceTreeModel.frameForId(contex t.frameId);
392 if (context.frameId == selectedNode.frameId() || (!selectedNode. frameId() && !frame.parentFrame))
pfeldman 2016/02/06 02:59:05 - What if there is no frame? - In most of the case
samli 2016/02/08 03:53:50 Appears nodes in the top frame don't get a frameId
pfeldman 2016/02/11 21:47:34 nodes don't get frameids, only document nodes do.
samli 2016/02/15 00:40:13 Ok done. PTAL, I'm not sure this is the best way t
393 WebInspector.context.setFlavor(WebInspector.ExecutionContext , context);
394 }
388 } 395 }
389 WebInspector.notifications.dispatchEventToListeners(WebInspector.Notific ationService.Events.SelectedNodeChanged); 396 WebInspector.notifications.dispatchEventToListeners(WebInspector.Notific ationService.Events.SelectedNodeChanged);
390 this._selectedNodeChangedForTest(); 397 this._selectedNodeChangedForTest();
391 }, 398 },
392 399
393 _selectedNodeChangedForTest: function() { }, 400 _selectedNodeChangedForTest: function() { },
394 401
395 _reset: function() 402 _reset: function()
396 { 403 {
397 delete this.currentQuery; 404 delete this.currentQuery;
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 */ 1282 */
1276 wasShown: function() 1283 wasShown: function()
1277 { 1284 {
1278 this._toolbarItem.setToggled(true); 1285 this._toolbarItem.setToggled(true);
1279 this._nodeChanged(); 1286 this._nodeChanged();
1280 WebInspector.ThrottledWidget.prototype.wasShown.call(this); 1287 WebInspector.ThrottledWidget.prototype.wasShown.call(this);
1281 }, 1288 },
1282 1289
1283 __proto__: WebInspector.ThrottledWidget.prototype 1290 __proto__: WebInspector.ThrottledWidget.prototype
1284 } 1291 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/elements/selected-element-changes-execution-context-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698