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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js

Issue 2250473002: DevTools: Repick execution context when frames are loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename fire event Created 4 years, 4 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 | « no previous file | third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
index 932dcbc00cef7719f1f8fd76a23e6c4d1625b5ca..b125843899c717a267da67d777c1b71cb88ec7cc 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
@@ -16,6 +16,7 @@ WebInspector.ExecutionContextSelector = function(targetManager, context)
targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextCreated, this._onExecutionContextCreated, this);
targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this);
+ targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextOrderChanged, this._onExecutionContextOrderChanged, this);
this._targetManager = targetManager;
this._context = context;
}
@@ -141,12 +142,7 @@ WebInspector.ExecutionContextSelector.prototype = {
*/
_onExecutionContextCreated: function(event)
{
- var executionContext = /** @type {!WebInspector.ExecutionContext} */ (event.data);
- if (!this._context.flavor(WebInspector.ExecutionContext) || this._shouldSwitchToContext(executionContext)) {
- this._ignoreContextChanged = true;
- this._context.setFlavor(WebInspector.ExecutionContext, executionContext);
- this._ignoreContextChanged = false;
- }
+ this._switchContextIfNecessary(/** @type {!WebInspector.ExecutionContext} */ (event.data));
},
/**
@@ -159,6 +155,34 @@ WebInspector.ExecutionContextSelector.prototype = {
this._currentExecutionContextGone();
},
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _onExecutionContextOrderChanged: function(event)
+ {
+ var runtimeModel = /** @type {!WebInspector.RuntimeModel} */ (event.data);
+ var executionContexts = runtimeModel.executionContexts();
+ for (var i = 0; i < executionContexts.length; i++) {
+ if (this._switchContextIfNecessary(executionContexts[i]))
+ break;
+ }
+ },
+
+ /**
+ * @param {!WebInspector.ExecutionContext} executionContext
+ * @return {boolean}
+ */
+ _switchContextIfNecessary: function(executionContext)
+ {
+ if (!this._context.flavor(WebInspector.ExecutionContext) || this._shouldSwitchToContext(executionContext)) {
+ this._ignoreContextChanged = true;
+ this._context.setFlavor(WebInspector.ExecutionContext, executionContext);
+ this._ignoreContextChanged = false;
+ return true;
+ }
+ return false;
+ },
+
_currentExecutionContextGone: function()
{
var targets = this._targetManager.targets(WebInspector.Target.Capability.JS);
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698