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

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

Issue 653413002: DevTools: Fix the way executionContext and target are selected in worker frontend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698