OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 /** | 30 /** |
31 * @implements {SDK.TargetManager.Observer} | 31 * @implements {SDK.TargetManager.Observer} |
32 * @unrestricted | 32 * @unrestricted |
33 */ | 33 */ |
34 Bindings.NetworkProjectManager = class { | 34 Bindings.NetworkProjectManager = class extends Common.Object { |
35 /** | 35 /** |
36 * @param {!SDK.TargetManager} targetManager | 36 * @param {!SDK.TargetManager} targetManager |
37 * @param {!Workspace.Workspace} workspace | 37 * @param {!Workspace.Workspace} workspace |
38 */ | 38 */ |
39 constructor(targetManager, workspace) { | 39 constructor(targetManager, workspace) { |
| 40 super(); |
40 this._workspace = workspace; | 41 this._workspace = workspace; |
41 targetManager.observeTargets(this); | 42 targetManager.observeTargets(this); |
42 } | 43 } |
43 | 44 |
44 /** | 45 /** |
45 * @override | 46 * @override |
46 * @param {!SDK.Target} target | 47 * @param {!SDK.Target} target |
47 */ | 48 */ |
48 targetAdded(target) { | 49 targetAdded(target) { |
49 new Bindings.NetworkProject(target, this._workspace, SDK.ResourceTreeModel.f
romTarget(target)); | 50 new Bindings.NetworkProject(target, this._workspace, SDK.ResourceTreeModel.f
romTarget(target)); |
50 } | 51 } |
51 | 52 |
52 /** | 53 /** |
53 * @override | 54 * @override |
54 * @param {!SDK.Target} target | 55 * @param {!SDK.Target} target |
55 */ | 56 */ |
56 targetRemoved(target) { | 57 targetRemoved(target) { |
57 Bindings.NetworkProject.forTarget(target)._dispose(); | 58 Bindings.NetworkProject.forTarget(target)._dispose(); |
58 } | 59 } |
59 }; | 60 }; |
60 | 61 |
| 62 /** @implements {Common.Emittable} */ |
| 63 Bindings.NetworkProjectManager.FrameAttributionChangedEvent = class { |
| 64 /** |
| 65 * @param {!Workspace.UISourceCode} uiSourceCode |
| 66 */ |
| 67 constructor(uiSourceCode) { |
| 68 this.uiSourceCode = uiSourceCode; |
| 69 } |
| 70 }; |
| 71 |
| 72 |
61 /** | 73 /** |
62 * @unrestricted | 74 * @unrestricted |
63 */ | 75 */ |
64 Bindings.NetworkProject = class extends SDK.SDKObject { | 76 Bindings.NetworkProject = class extends SDK.SDKObject { |
65 /** | 77 /** |
66 * @param {!SDK.Target} target | 78 * @param {!SDK.Target} target |
67 * @param {!Workspace.Workspace} workspace | 79 * @param {!Workspace.Workspace} workspace |
68 * @param {?SDK.ResourceTreeModel} resourceTreeModel | 80 * @param {?SDK.ResourceTreeModel} resourceTreeModel |
69 */ | 81 */ |
70 constructor(target, workspace, resourceTreeModel) { | 82 constructor(target, workspace, resourceTreeModel) { |
(...skipping 15 matching lines...) Expand all Loading... |
86 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._mainFrameNa
vigated, this)); | 98 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._mainFrameNa
vigated, this)); |
87 } | 99 } |
88 | 100 |
89 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | 101 var debuggerModel = SDK.DebuggerModel.fromTarget(target); |
90 if (debuggerModel) { | 102 if (debuggerModel) { |
91 this._eventListeners.push( | 103 this._eventListeners.push( |
92 debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSo
urce, this._parsedScriptSource, this), | 104 debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSo
urce, this._parsedScriptSource, this), |
93 debuggerModel.addEventListener( | 105 debuggerModel.addEventListener( |
94 SDK.DebuggerModel.Events.FailedToParseScriptSource, this._parsedSc
riptSource, this)); | 106 SDK.DebuggerModel.Events.FailedToParseScriptSource, this._parsedSc
riptSource, this)); |
95 } | 107 } |
96 var cssModel = target.model(SDK.CSSModel); | |
97 if (cssModel) { | |
98 this._eventListeners.push( | |
99 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this._s
tyleSheetAdded, this), | |
100 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this.
_styleSheetRemoved, this)); | |
101 } | |
102 this._eventListeners.push(target.targetManager().addEventListener( | 108 this._eventListeners.push(target.targetManager().addEventListener( |
103 SDK.TargetManager.Events.SuspendStateChanged, this._suspendStateChanged,
this)); | 109 SDK.TargetManager.Events.SuspendStateChanged, this._suspendStateChanged,
this)); |
104 } | 110 } |
105 | 111 |
106 /** | 112 /** |
107 * @param {!SDK.Target} target | 113 * @param {!SDK.Target} target |
108 * @param {?SDK.ResourceTreeFrame} frame | 114 * @param {?SDK.ResourceTreeFrame} frame |
109 * @param {boolean} isContentScripts | 115 * @param {boolean} isContentScripts |
110 * @return {string} | 116 * @return {string} |
111 */ | 117 */ |
(...skipping 18 matching lines...) Expand all Loading... |
130 } | 136 } |
131 | 137 |
132 /** | 138 /** |
133 * @param {!Workspace.Project} project | 139 * @param {!Workspace.Project} project |
134 * @return {?SDK.ResourceTreeFrame} | 140 * @return {?SDK.ResourceTreeFrame} |
135 */ | 141 */ |
136 static frameForProject(project) { | 142 static frameForProject(project) { |
137 return project[Bindings.NetworkProject._frameSymbol] || null; | 143 return project[Bindings.NetworkProject._frameSymbol] || null; |
138 } | 144 } |
139 | 145 |
| 146 static framesForUISourceCode(uiSourceCode) { |
| 147 return uiSourceCode[Bindings.NetworkProject._frameSymbol] || []; |
| 148 } |
| 149 |
140 /** | 150 /** |
141 * @param {!Workspace.UISourceCode} uiSourceCode | 151 * @param {!Workspace.UISourceCode} uiSourceCode |
142 * @return {?SDK.Target} target | 152 * @return {?SDK.Target} target |
143 */ | 153 */ |
144 static targetForUISourceCode(uiSourceCode) { | 154 static targetForUISourceCode(uiSourceCode) { |
145 return uiSourceCode[Bindings.NetworkProject._targetSymbol] || null; | 155 return uiSourceCode.project()[Bindings.NetworkProject._targetSymbol] || null
; |
146 } | 156 } |
147 | 157 |
148 /** | 158 /** |
149 * @param {!Workspace.UISourceCode} uiSourceCode | 159 * @param {!Workspace.UISourceCode} uiSourceCode |
150 * @return {string} | 160 * @return {string} |
151 */ | 161 */ |
152 static uiSourceCodeMimeType(uiSourceCode) { | 162 static uiSourceCodeMimeType(uiSourceCode) { |
153 if (uiSourceCode[Bindings.NetworkProject._scriptSymbol] || uiSourceCode[Bind
ings.NetworkProject._styleSheetSymbol]) | 163 if (uiSourceCode[Bindings.NetworkProject._useExplicitMimeType]) |
154 return uiSourceCode.contentType().canonicalMimeType(); | 164 return uiSourceCode.contentType().canonicalMimeType(); |
155 | 165 |
156 var resource = uiSourceCode[Bindings.NetworkProject._resourceSymbol]; | 166 var resource = uiSourceCode[Bindings.NetworkProject._resourceSymbol]; |
157 if (resource) | 167 if (resource) |
158 return resource.mimeType; | 168 return resource.mimeType; |
159 var mimeType = Common.ResourceType.mimeFromURL(uiSourceCode.url()); | 169 var mimeType = Common.ResourceType.mimeFromURL(uiSourceCode.url()); |
160 return mimeType || uiSourceCode.contentType().canonicalMimeType(); | 170 return mimeType || uiSourceCode.contentType().canonicalMimeType(); |
161 } | 171 } |
162 | 172 |
163 /** | 173 /** |
164 * @param {?SDK.ResourceTreeFrame} frame | 174 * @param {?SDK.ResourceTreeFrame} frame |
165 * @param {boolean} isContentScripts | 175 * @param {boolean} isContentScripts |
166 * @return {!Bindings.ContentProviderBasedProject} | 176 * @return {!Bindings.ContentProviderBasedProject} |
167 */ | 177 */ |
168 _workspaceProject(frame, isContentScripts) { | 178 _workspaceProject(frame, isContentScripts) { |
169 var projectId = Bindings.NetworkProject.projectId(this.target(), frame, isCo
ntentScripts); | 179 var projectId = Bindings.NetworkProject.projectId(this.target(), frame, isCo
ntentScripts); |
170 var projectType = isContentScripts ? Workspace.projectTypes.ContentScripts :
Workspace.projectTypes.Network; | 180 var projectType = isContentScripts ? Workspace.projectTypes.ContentScripts :
Workspace.projectTypes.Network; |
171 | 181 |
172 var project = this._workspaceProjects.get(projectId); | 182 var project = this._workspaceProjects.get(projectId); |
173 if (project) | 183 if (project) |
174 return project; | 184 return project; |
175 | 185 |
176 project = new Bindings.ContentProviderBasedProject( | 186 project = new Bindings.ContentProviderBasedProject( |
177 this._workspace, projectId, projectType, '', false /* isServiceProject *
/); | 187 this._workspace, projectId, projectType, '', false /* isServiceProject *
/); |
178 project[Bindings.NetworkProject._targetSymbol] = this.target(); | 188 project[Bindings.NetworkProject._targetSymbol] = this.target(); |
179 project[Bindings.NetworkProject._frameSymbol] = frame; | |
180 this._workspaceProjects.set(projectId, project); | 189 this._workspaceProjects.set(projectId, project); |
181 return project; | 190 return project; |
182 } | 191 } |
183 | 192 |
184 /** | 193 /** |
| 194 * @param {!Workspace.Project} project |
| 195 * @param {!SDK.Target} target |
| 196 */ |
| 197 static connectProjectToTarget(project, target) { |
| 198 project[Bindings.NetworkProject._targetSymbol] = target; |
| 199 } |
| 200 |
| 201 /** |
| 202 * @param {!Workspace.UISourceCode} uiSourceCode |
| 203 * @param {!SDK.ResourceTreeFrame} frame |
| 204 */ |
| 205 static connectFrameToUISourceCode(uiSourceCode, frame) { |
| 206 var frames = uiSourceCode[Bindings.NetworkProject._frameSymbol]; |
| 207 if (!frames) { |
| 208 frames = []; |
| 209 uiSourceCode[Bindings.NetworkProject._frameSymbol] = frames; |
| 210 } |
| 211 frames.push(frame); |
| 212 Bindings.networkProjectManager.emit(new Bindings.NetworkProjectManager.Frame
AttributionChangedEvent(uiSourceCode)); |
| 213 } |
| 214 |
| 215 /** |
| 216 * @param {!Workspace.UISourceCode} uiSourceCode |
| 217 * @param {!SDK.ResourceTreeFrame} frame |
| 218 */ |
| 219 static disconnectFrameFromUISourceCode(uiSourceCode, frame) { |
| 220 var frames = uiSourceCode[Bindings.NetworkProject._frameSymbol]; |
| 221 var frameIndex = frames.indexOf(frame); |
| 222 if (frameIndex === -1) |
| 223 return; |
| 224 frames.splice(frameIndex, 1); |
| 225 if (!frames.length) |
| 226 uiSourceCode[Bindings.NetworkProject._frameSymbol] = null; |
| 227 Bindings.networkProjectManager.emit(new Bindings.NetworkProjectManager.Frame
AttributionChangedEvent(uiSourceCode)); |
| 228 } |
| 229 |
| 230 /** |
| 231 * @param {!Workspace.UISourceCode} uiSourceCode |
| 232 */ |
| 233 static useExplicitMimeType(uiSourceCode) { |
| 234 uiSourceCode[Bindings.NetworkProject._useExplicitMimeType] = true; |
| 235 } |
| 236 |
| 237 /** |
185 * @param {!Common.ContentProvider} contentProvider | 238 * @param {!Common.ContentProvider} contentProvider |
186 * @param {?SDK.ResourceTreeFrame} frame | 239 * @param {?SDK.ResourceTreeFrame} frame |
187 * @param {boolean} isContentScript | 240 * @param {boolean} isContentScript |
188 * @param {?number} contentSize | 241 * @param {?number} contentSize |
189 * @return {!Workspace.UISourceCode} | 242 * @return {!Workspace.UISourceCode} |
190 */ | 243 */ |
191 addFile(contentProvider, frame, isContentScript, contentSize) { | 244 addFile(contentProvider, frame, isContentScript, contentSize) { |
192 var uiSourceCode = this._createFile(contentProvider, frame, isContentScript
|| false); | 245 var uiSourceCode = this._createFile(contentProvider, frame, isContentScript
|| false); |
193 var metadata = typeof contentSize === 'number' ? new Workspace.UISourceCodeM
etadata(null, contentSize) : null; | 246 var metadata = typeof contentSize === 'number' ? new Workspace.UISourceCodeM
etadata(null, contentSize) : null; |
194 this._addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadata); | 247 this._addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadata); |
195 return uiSourceCode; | 248 return uiSourceCode; |
196 } | 249 } |
197 | 250 |
198 /** | |
199 * @param {?SDK.ResourceTreeFrame} frame | |
200 * @param {string} url | |
201 */ | |
202 _removeFileForURL(frame, url) { | |
203 var project = this._workspaceProjects.get(Bindings.NetworkProject.projectId(
this.target(), frame, false)); | |
204 if (!project) | |
205 return; | |
206 project.removeFile(url); | |
207 } | |
208 | |
209 _populate() { | 251 _populate() { |
210 /** | 252 /** |
211 * @param {!SDK.ResourceTreeFrame} frame | 253 * @param {!SDK.ResourceTreeFrame} frame |
212 * @this {Bindings.NetworkProject} | 254 * @this {Bindings.NetworkProject} |
213 */ | 255 */ |
214 function populateFrame(frame) { | 256 function populateFrame(frame) { |
215 for (var i = 0; i < frame.childFrames.length; ++i) | 257 for (var i = 0; i < frame.childFrames.length; ++i) |
216 populateFrame.call(this, frame.childFrames[i]); | 258 populateFrame.call(this, frame.childFrames[i]); |
217 | 259 |
218 var resources = frame.resources(); | 260 var resources = frame.resources(); |
(...skipping 24 matching lines...) Expand all Loading... |
243 var script = /** @type {!SDK.Script} */ (event.data); | 285 var script = /** @type {!SDK.Script} */ (event.data); |
244 if (!script.sourceURL || script.isLiveEdit() || (script.isInlineScript() &&
!script.hasSourceURL)) | 286 if (!script.sourceURL || script.isLiveEdit() || (script.isInlineScript() &&
!script.hasSourceURL)) |
245 return; | 287 return; |
246 // Filter out embedder injected content scripts. | 288 // Filter out embedder injected content scripts. |
247 if (script.isContentScript() && !script.hasSourceURL) { | 289 if (script.isContentScript() && !script.hasSourceURL) { |
248 var parsedURL = new Common.ParsedURL(script.sourceURL); | 290 var parsedURL = new Common.ParsedURL(script.sourceURL); |
249 if (!parsedURL.isValid) | 291 if (!parsedURL.isValid) |
250 return; | 292 return; |
251 } | 293 } |
252 var uiSourceCode = this._createFile(script, SDK.ResourceTreeFrame.fromScript
(script), script.isContentScript()); | 294 var uiSourceCode = this._createFile(script, SDK.ResourceTreeFrame.fromScript
(script), script.isContentScript()); |
253 uiSourceCode[Bindings.NetworkProject._scriptSymbol] = script; | 295 uiSourceCode[Bindings.NetworkProject._useExplicitMimeType] = true; |
254 var resource = SDK.ResourceTreeModel.resourceForURL(uiSourceCode.url()); | 296 var frame = SDK.ResourceTreeFrame.fromScript(script); |
255 this._addUISourceCodeWithProvider(uiSourceCode, script, this._resourceMetada
ta(resource)); | 297 var metadata = frame ? Bindings.resourceMetadata(frame.resourceForURL(uiSour
ceCode.url())) : null; |
| 298 this._addUISourceCodeWithProvider(uiSourceCode, script, metadata); |
256 } | 299 } |
257 | 300 |
258 /** | 301 /** |
259 * @param {!Common.Event} event | |
260 */ | |
261 _styleSheetAdded(event) { | |
262 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); | |
263 if (header.isInline && !header.hasSourceURL && header.origin !== 'inspector'
) | |
264 return; | |
265 if (!header.resourceURL()) | |
266 return; | |
267 | |
268 var originalContentProvider = header.originalContentProvider(); | |
269 var uiSourceCode = this._createFile(originalContentProvider, SDK.ResourceTre
eFrame.fromStyleSheet(header), false); | |
270 uiSourceCode[Bindings.NetworkProject._styleSheetSymbol] = header; | |
271 var resource = SDK.ResourceTreeModel.resourceForURL(uiSourceCode.url()); | |
272 this._addUISourceCodeWithProvider(uiSourceCode, originalContentProvider, thi
s._resourceMetadata(resource)); | |
273 } | |
274 | |
275 /** | |
276 * @param {!Common.Event} event | |
277 */ | |
278 _styleSheetRemoved(event) { | |
279 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); | |
280 if (header.isInline && !header.hasSourceURL && header.origin !== 'inspector'
) | |
281 return; | |
282 | |
283 this._removeFileForURL(SDK.ResourceTreeFrame.fromStyleSheet(header), header.
resourceURL()); | |
284 } | |
285 | |
286 /** | |
287 * @param {!Common.Event} event | 302 * @param {!Common.Event} event |
288 */ | 303 */ |
289 _resourceAdded(event) { | 304 _resourceAdded(event) { |
290 var resource = /** @type {!SDK.Resource} */ (event.data); | 305 var resource = /** @type {!SDK.Resource} */ (event.data); |
291 this._addResource(resource); | 306 this._addResource(resource); |
292 } | 307 } |
293 | 308 |
294 /** | 309 /** |
295 * @param {!SDK.Resource} resource | 310 * @param {!SDK.Resource} resource |
296 */ | 311 */ |
(...skipping 13 matching lines...) Expand all Loading... |
310 if ((resourceType === Common.resourceTypes.Image || resourceType === Common.
resourceTypes.Font) && | 325 if ((resourceType === Common.resourceTypes.Image || resourceType === Common.
resourceTypes.Font) && |
311 resource.contentURL().startsWith('data:')) | 326 resource.contentURL().startsWith('data:')) |
312 return; | 327 return; |
313 | 328 |
314 // Never load document twice. | 329 // Never load document twice. |
315 if (this._workspace.uiSourceCodeForURL(resource.url)) | 330 if (this._workspace.uiSourceCodeForURL(resource.url)) |
316 return; | 331 return; |
317 | 332 |
318 var uiSourceCode = this._createFile(resource, SDK.ResourceTreeFrame.fromReso
urce(resource), false); | 333 var uiSourceCode = this._createFile(resource, SDK.ResourceTreeFrame.fromReso
urce(resource), false); |
319 uiSourceCode[Bindings.NetworkProject._resourceSymbol] = resource; | 334 uiSourceCode[Bindings.NetworkProject._resourceSymbol] = resource; |
320 this._addUISourceCodeWithProvider(uiSourceCode, resource, this._resourceMeta
data(resource)); | 335 this._addUISourceCodeWithProvider(uiSourceCode, resource, Bindings.resourceM
etadata(resource)); |
321 } | 336 } |
322 | 337 |
323 /** | 338 /** |
324 * @param {!Common.Event} event | 339 * @param {!Common.Event} event |
325 */ | 340 */ |
326 _frameWillNavigate(event) { | 341 _frameWillNavigate(event) { |
327 var frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data); | 342 var frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data); |
328 var project = this._workspaceProject(frame, false); | 343 var project = this._workspaceProject(frame, false); |
329 for (var resource of frame.resources()) | 344 for (var resource of frame.resources()) |
330 project.removeUISourceCode(resource.url); | 345 project.removeUISourceCode(resource.url); |
(...skipping 20 matching lines...) Expand all Loading... |
351 /** | 366 /** |
352 * @param {!Common.ContentProvider} contentProvider | 367 * @param {!Common.ContentProvider} contentProvider |
353 * @param {?SDK.ResourceTreeFrame} frame | 368 * @param {?SDK.ResourceTreeFrame} frame |
354 * @param {boolean} isContentScript | 369 * @param {boolean} isContentScript |
355 * @return {!Workspace.UISourceCode} | 370 * @return {!Workspace.UISourceCode} |
356 */ | 371 */ |
357 _createFile(contentProvider, frame, isContentScript) { | 372 _createFile(contentProvider, frame, isContentScript) { |
358 var url = contentProvider.contentURL(); | 373 var url = contentProvider.contentURL(); |
359 var project = this._workspaceProject(frame, isContentScript); | 374 var project = this._workspaceProject(frame, isContentScript); |
360 var uiSourceCode = project.createUISourceCode(url, contentProvider.contentTy
pe()); | 375 var uiSourceCode = project.createUISourceCode(url, contentProvider.contentTy
pe()); |
361 uiSourceCode[Bindings.NetworkProject._targetSymbol] = this.target(); | 376 uiSourceCode[Bindings.NetworkProject._frameSymbol] = [frame]; |
362 return uiSourceCode; | 377 return uiSourceCode; |
363 } | 378 } |
364 | 379 |
365 /** | |
366 * @param {?SDK.Resource} resource | |
367 * @return {?Workspace.UISourceCodeMetadata} | |
368 */ | |
369 _resourceMetadata(resource) { | |
370 if (!resource || (typeof resource.contentSize() !== 'number' && !resource.la
stModified())) | |
371 return null; | |
372 return new Workspace.UISourceCodeMetadata(resource.lastModified(), resource.
contentSize()); | |
373 } | |
374 | |
375 _dispose() { | 380 _dispose() { |
376 this._reset(); | 381 this._reset(); |
377 Common.EventTarget.removeEventListeners(this._eventListeners); | 382 Common.EventTarget.removeEventListeners(this._eventListeners); |
378 delete this.target()[Bindings.NetworkProject._networkProjectSymbol]; | 383 delete this.target()[Bindings.NetworkProject._networkProjectSymbol]; |
379 } | 384 } |
380 | 385 |
381 _reset() { | 386 _reset() { |
382 for (var project of this._workspaceProjects.values()) | 387 for (var project of this._workspaceProjects.values()) |
383 project.removeProject(); | 388 project.removeProject(); |
384 this._workspaceProjects.clear(); | 389 this._workspaceProjects.clear(); |
(...skipping 19 matching lines...) Expand all Loading... |
404 * @return {?Workspace.UISourceCode} | 409 * @return {?Workspace.UISourceCode} |
405 */ | 410 */ |
406 static uiSourceCodeForStyleURL(workspace, url, header) { | 411 static uiSourceCodeForStyleURL(workspace, url, header) { |
407 var frame = SDK.ResourceTreeFrame.fromStyleSheet(header); | 412 var frame = SDK.ResourceTreeFrame.fromStyleSheet(header); |
408 return workspace.uiSourceCode(Bindings.NetworkProject.projectId(header.targe
t(), frame, false), url); | 413 return workspace.uiSourceCode(Bindings.NetworkProject.projectId(header.targe
t(), frame, false), url); |
409 } | 414 } |
410 }; | 415 }; |
411 | 416 |
412 Bindings.NetworkProject._networkProjectSymbol = Symbol('networkProject'); | 417 Bindings.NetworkProject._networkProjectSymbol = Symbol('networkProject'); |
413 Bindings.NetworkProject._resourceSymbol = Symbol('resource'); | 418 Bindings.NetworkProject._resourceSymbol = Symbol('resource'); |
414 Bindings.NetworkProject._scriptSymbol = Symbol('script'); | 419 Bindings.NetworkProject._useExplicitMimeType = Symbol('useExplicitMimeType'); |
415 Bindings.NetworkProject._styleSheetSymbol = Symbol('styleSheet'); | |
416 Bindings.NetworkProject._targetSymbol = Symbol('target'); | 420 Bindings.NetworkProject._targetSymbol = Symbol('target'); |
417 Bindings.NetworkProject._frameSymbol = Symbol('frame'); | 421 Bindings.NetworkProject._frameSymbol = Symbol('frame'); |
OLD | NEW |