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

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

Issue 2137773002: [DevTools] Replace the target type with capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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: 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 442321322d2a0efb5c1c9d7d100a069045bed320..0573f25821a0397dcc42abb781b457ca9949d3bc 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
@@ -10,7 +10,7 @@
*/
WebInspector.ExecutionContextSelector = function(targetManager, context)
{
- targetManager.observeTargets(this);
+ targetManager.observeTargets(this, WebInspector.Target.Capability.JS);
context.addFlavorChangeListener(WebInspector.ExecutionContext, this._executionContextChanged, this);
context.addFlavorChangeListener(WebInspector.Target, this._targetChanged, this);
@@ -28,8 +28,6 @@ WebInspector.ExecutionContextSelector.prototype = {
*/
targetAdded: function(target)
{
- if (!target.hasJSContext())
- return;
// Defer selecting default target since we need all clients to get their
// targetAdded notifications first.
setImmediate(deferred.bind(this));
@@ -51,13 +49,11 @@ WebInspector.ExecutionContextSelector.prototype = {
*/
targetRemoved: function(target)
{
- if (!target.hasJSContext())
- return;
var currentExecutionContext = this._context.flavor(WebInspector.ExecutionContext);
if (currentExecutionContext && currentExecutionContext.target() === target)
this._currentExecutionContextGone();
- var targets = this._targetManager.targetsWithJSContext();
+ var targets = this._targetManager.targets(WebInspector.Target.Capability.JS);
if (this._context.flavor(WebInspector.Target) === target && targets.length)
this._context.setFlavor(WebInspector.Target, targets[0]);
},
@@ -165,11 +161,9 @@ WebInspector.ExecutionContextSelector.prototype = {
_currentExecutionContextGone: function()
{
- var targets = this._targetManager.targetsWithJSContext();
+ var targets = this._targetManager.targets(WebInspector.Target.Capability.JS);
var newContext = null;
for (var i = 0; i < targets.length && !newContext; ++i) {
- if (targets[i].isServiceWorker())
- continue;
var executionContexts = targets[i].runtimeModel.executionContexts();
for (var executionContext of executionContexts) {
if (this._isMainFrameContext(executionContext)) {

Powered by Google App Engine
This is Rietveld 408576698