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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js

Issue 2649923007: Revert of Show service worker navigation preload requests in DevTools Network tab (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 SDK.SubTargetsManager = class extends SDK.SDKModel { 7 SDK.SubTargetsManager = class extends SDK.SDKModel {
8 /** 8 /**
9 * @param {!SDK.Target} target 9 * @param {!SDK.Target} target
10 */ 10 */
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 */ 123 */
124 targetInfo(target) { 124 targetInfo(target) {
125 return target[SDK.SubTargetsManager._InfoSymbol] || null; 125 return target[SDK.SubTargetsManager._InfoSymbol] || null;
126 } 126 }
127 127
128 /** 128 /**
129 * @param {string} type 129 * @param {string} type
130 * @return {number} 130 * @return {number}
131 */ 131 */
132 _capabilitiesForType(type) { 132 _capabilitiesForType(type) {
133 if (type === 'worker') { 133 if (type === 'worker')
134 var capabilities = SDK.Target.Capability.JS | SDK.Target.Capability.Log; 134 return SDK.Target.Capability.JS | SDK.Target.Capability.Log;
135 var parentTargetInfo = this.targetInfo(this.target());
136 var mainIsServiceWorker =
137 !this.target().parentTarget() && this.target().hasTargetCapability() & & !this.target().hasJSCapability();
138 if ((parentTargetInfo && parentTargetInfo.type === 'service_worker') || ma inIsServiceWorker)
139 capabilities |= SDK.Target.Capability.Network;
140 return capabilities;
141 }
142 if (type === 'service_worker') 135 if (type === 'service_worker')
143 return SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Tar get.Capability.Target; 136 return SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Tar get.Capability.Target;
144 if (type === 'iframe') { 137 if (type === 'iframe') {
145 return SDK.Target.Capability.Browser | SDK.Target.Capability.DOM | SDK.Tar get.Capability.JS | 138 return SDK.Target.Capability.Browser | SDK.Target.Capability.DOM | SDK.Tar get.Capability.JS |
146 SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Target .Capability.Target; 139 SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Target .Capability.Target;
147 } 140 }
148 if (type === 'node') 141 if (type === 'node')
149 return SDK.Target.Capability.JS; 142 return SDK.Target.Capability.JS;
150 return 0; 143 return 0;
151 } 144 }
(...skipping 11 matching lines...) Expand all
163 targetName = parsedURL ? parsedURL.lastPathComponentWithFragment() : '#' + (++this._lastAnonymousTargetId); 156 targetName = parsedURL ? parsedURL.lastPathComponentWithFragment() : '#' + (++this._lastAnonymousTargetId);
164 } 157 }
165 var target = SDK.targetManager.createTarget( 158 var target = SDK.targetManager.createTarget(
166 targetName, this._capabilitiesForType(targetInfo.type), this._createConn ection.bind(this, targetInfo.id), 159 targetName, this._capabilitiesForType(targetInfo.type), this._createConn ection.bind(this, targetInfo.id),
167 this.target()); 160 this.target());
168 target[SDK.SubTargetsManager._InfoSymbol] = targetInfo; 161 target[SDK.SubTargetsManager._InfoSymbol] = targetInfo;
169 this._attachedTargets.set(targetInfo.id, target); 162 this._attachedTargets.set(targetInfo.id, target);
170 163
171 // Only pause new worker if debugging SW - we are going through the pause on start checkbox. 164 // Only pause new worker if debugging SW - we are going through the pause on start checkbox.
172 var mainIsServiceWorker = 165 var mainIsServiceWorker =
173 !this.target().parentTarget() && this.target().hasTargetCapability() && !this.target().hasJSCapability(); 166 !this.target().parentTarget() && this.target().hasTargetCapability() && !this.target().hasBrowserCapability();
174 if (mainIsServiceWorker && waitingForDebugger) 167 if (mainIsServiceWorker && waitingForDebugger)
175 target.debuggerAgent().pause(); 168 target.debuggerAgent().pause();
176 target.runtimeAgent().runIfWaitingForDebugger(); 169 target.runtimeAgent().runIfWaitingForDebugger();
177 } 170 }
178 171
179 /** 172 /**
180 * @param {string} targetId 173 * @param {string} targetId
181 * @param {!Protocol.InspectorBackend.Connection.Params} params 174 * @param {!Protocol.InspectorBackend.Connection.Params} params
182 * @return {!Protocol.InspectorBackend.Connection} 175 * @return {!Protocol.InspectorBackend.Connection}
183 */ 176 */
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 this.type = payload.type; 351 this.type = payload.type;
359 this.canActivate = this.type === 'page' || this.type === 'iframe'; 352 this.canActivate = this.type === 'page' || this.type === 'iframe';
360 if (this.type === 'node') 353 if (this.type === 'node')
361 this.title = Common.UIString('Node: %s', this.url); 354 this.title = Common.UIString('Node: %s', this.url);
362 else if (this.type === 'page' || this.type === 'iframe') 355 else if (this.type === 'page' || this.type === 'iframe')
363 this.title = payload.title; 356 this.title = payload.title;
364 else 357 else
365 this.title = Common.UIString('Worker: %s', this.url); 358 this.title = Common.UIString('Worker: %s', this.url);
366 } 359 }
367 }; 360 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698