Index: Source/devtools/front_end/components/ExecutionContextSelector.js |
diff --git a/Source/devtools/front_end/components/ExecutionContextSelector.js b/Source/devtools/front_end/components/ExecutionContextSelector.js |
index 74c40b018ab33d15aee424a98f0659e4e375a969..c073622223c38cf29c55fb39d00ec238efb49312 100644 |
--- a/Source/devtools/front_end/components/ExecutionContextSelector.js |
+++ b/Source/devtools/front_end/components/ExecutionContextSelector.js |
@@ -26,8 +26,6 @@ WebInspector.ExecutionContextSelector.prototype = { |
// Defer selecting default target since we need all clients to get their |
// targetAdded notifications first. |
setImmediate(function() { |
- // FIXME(413886): Execution context for the main thread on the service/shared worker shadow page |
- // should never be sent to frontend. The worker forntend check below could be removed once this is fixed. |
if (!WebInspector.context.flavor(WebInspector.Target) || WebInspector.isWorkerFrontend()) |
WebInspector.context.setFlavor(WebInspector.Target, target); |
}); |
@@ -43,7 +41,7 @@ WebInspector.ExecutionContextSelector.prototype = { |
this._currentExecutionContextGone(); |
var targets = WebInspector.targetManager.targets(); |
- if (WebInspector.context.flavor(WebInspector.Target) === target && targets.length) |
+ if (WebInspector.context.flavor(WebInspector.Target) === target && targets.length && !WebInspector.isWorkerFrontend()) |
WebInspector.context.setFlavor(WebInspector.Target, targets[0]); |
}, |
@@ -85,9 +83,14 @@ WebInspector.ExecutionContextSelector.prototype = { |
*/ |
_onExecutionContextCreated: function(event) |
{ |
- var executionContext = /** @type {!WebInspector.ExecutionContext}*/ (event.data); |
- if (!WebInspector.context.flavor(WebInspector.ExecutionContext)) |
- WebInspector.context.setFlavor(WebInspector.ExecutionContext, executionContext); |
+ var executionContext = /** @type {!WebInspector.ExecutionContext} */ (event.data); |
+ |
+ if (!WebInspector.context.flavor(WebInspector.ExecutionContext)) { |
+ // FIXME(413886): Execution context for the main thread on the service/shared worker shadow page |
+ // should never be sent to frontend. The worker frontend check below could be removed once this is fixed. |
+ if (!WebInspector.isWorkerFrontend() || executionContext.target() !== WebInspector.targetManager.mainTarget()) |
+ WebInspector.context.setFlavor(WebInspector.ExecutionContext, executionContext); |
+ } |
}, |
/** |
@@ -105,6 +108,8 @@ WebInspector.ExecutionContextSelector.prototype = { |
var targets = WebInspector.targetManager.targets(); |
var newContext = null; |
for (var i = 0; i < targets.length; ++i) { |
+ if (WebInspector.isWorkerFrontend() && targets[i] === WebInspector.targetManager.mainTarget()) |
+ continue; |
var executionContexts = targets[i].runtimeModel.executionContexts(); |
if (executionContexts.length) { |
newContext = executionContexts[0]; |