| Index: third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js
|
| index b0750a35c3a56ec8735a6f22f0e9e52b95a033cc..01e473d910df32197230e1dd63bd464670543630 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js
|
| @@ -20,13 +20,15 @@ WebInspector.SubTargetsManager = function(target)
|
| this._connections = new Map();
|
|
|
| this._agent.setAutoAttach(true /* autoAttach */, true /* waitForDebuggerOnStart */);
|
| - this._agent.setAttachToFrames(Runtime.experiments.isEnabled("autoAttachToCrossProcessSubframes"));
|
| + if (Runtime.experiments.isEnabled("autoAttachToCrossProcessSubframes"))
|
| + this._agent.setAttachToFrames(true);
|
|
|
| if (Runtime.experiments.isEnabled("nodeDebugging") && !target.parentTarget()) {
|
| var defaultLocations = [{host: "localhost", port: 9229}];
|
| this._agent.setRemoteLocations(defaultLocations);
|
| this._agent.setDiscoverTargets(true);
|
| }
|
| + WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.MainFrameNavigated, this._mainFrameNavigated, this);
|
| };
|
|
|
| /** @enum {symbol} */
|
| @@ -135,11 +137,11 @@ WebInspector.SubTargetsManager.prototype = {
|
| if (type === "worker")
|
| return WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log;
|
| if (type === "service_worker")
|
| - return WebInspector.Target.Capability.Log | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
|
| + return WebInspector.Target.Capability.Log | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Target;
|
| if (type === "iframe")
|
| return WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM |
|
| WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log |
|
| - WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
|
| + WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Target;
|
| if (type === "node")
|
| return WebInspector.Target.Capability.JS;
|
| return 0;
|
| @@ -163,7 +165,7 @@ WebInspector.SubTargetsManager.prototype = {
|
| this._attachedTargets.set(targetInfo.id, target);
|
|
|
| // Only pause new worker if debugging SW - we are going through the pause on start checkbox.
|
| - var mainIsServiceWorker = !this.target().parentTarget() && this.target().hasWorkerCapability() && !this.target().hasBrowserCapability();
|
| + var mainIsServiceWorker = !this.target().parentTarget() && this.target().hasTargetCapability() && !this.target().hasBrowserCapability();
|
| if (mainIsServiceWorker && waitingForDebugger)
|
| target.debuggerAgent().pause();
|
| target.runtimeAgent().runIfWaitingForDebugger();
|
| @@ -226,6 +228,24 @@ WebInspector.SubTargetsManager.prototype = {
|
| // All the work is done in _detachedFromTarget.
|
| },
|
|
|
| + /**
|
| + * @param {!WebInspector.Event} event
|
| + */
|
| + _mainFrameNavigated: function(event)
|
| + {
|
| + if (event.data.target() !== this.target())
|
| + return;
|
| +
|
| + var idsToDetach = [];
|
| + for (var targetId of this._attachedTargets.keys()) {
|
| + var target = this._attachedTargets.get(targetId);
|
| + var targetInfo = this.targetInfo(target);
|
| + if (targetInfo.type === "worker")
|
| + idsToDetach.push(targetId);
|
| + }
|
| + idsToDetach.forEach(id => this._detachedFromTarget(id));
|
| + },
|
| +
|
| __proto__: WebInspector.SDKModel.prototype
|
| };
|
|
|
|
|