@@ -87,7 +87,7 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
87
87
resourceTreeModel . addEventListener ( SDK . ResourceTreeModel . Events . FrameDetached , this . _frameDetached , this ) ) ;
88
88
}
89
89
90
- var debuggerModel = SDK . DebuggerModel . fromTarget ( target ) ;
90
+ var debuggerModel = target . model ( SDK . DebuggerModel ) ;
91
91
if ( debuggerModel ) {
92
92
this . _eventListeners . push (
93
93
debuggerModel . addEventListener ( SDK . DebuggerModel . Events . ParsedScriptSource , this . _parsedScriptSource , this ) ,
@@ -106,12 +106,12 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
106
106
107
107
/**
108
108
* @param {!SDK.Target } target
109
- * @param {?SDK.ResourceTreeFrame } frame
109
+ * @param {string } frameId
110
110
* @param {boolean } isContentScripts
111
111
* @return {string }
112
112
*/
113
- static projectId ( target , frame , isContentScripts ) {
114
- return target . id ( ) + ':' + ( frame ? frame . id : '' ) + ':' + ( isContentScripts ? 'contentscripts' : '' ) ;
113
+ static projectId ( target , frameId , isContentScripts ) {
114
+ return target . id ( ) + ':' + frameId + ':' + ( isContentScripts ? 'contentscripts' : '' ) ;
115
115
}
116
116
117
117
/**
@@ -162,12 +162,12 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
162
162
}
163
163
164
164
/**
165
- * @param {?SDK.ResourceTreeFrame } frame
165
+ * @param {string } frameId
166
166
* @param {boolean } isContentScripts
167
167
* @return {!Bindings.ContentProviderBasedProject }
168
168
*/
169
- _workspaceProject ( frame , isContentScripts ) {
170
- var projectId = Bindings . NetworkProject . projectId ( this . target ( ) , frame , isContentScripts ) ;
169
+ _workspaceProject ( frameId , isContentScripts ) {
170
+ var projectId = Bindings . NetworkProject . projectId ( this . target ( ) , frameId , isContentScripts ) ;
171
171
var projectType = isContentScripts ? Workspace . projectTypes . ContentScripts : Workspace . projectTypes . Network ;
172
172
173
173
var project = this . _workspaceProjects . get ( projectId ) ;
@@ -177,31 +177,32 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
177
177
project = new Bindings . ContentProviderBasedProject (
178
178
this . _workspace , projectId , projectType , '' , false /* isServiceProject */ ) ;
179
179
project [ Bindings . NetworkProject . _targetSymbol ] = this . target ( ) ;
180
- project [ Bindings . NetworkProject . _frameSymbol ] = frame ;
180
+ project [ Bindings . NetworkProject . _frameSymbol ] =
181
+ frameId && this . _resourceTreeModel ? this . _resourceTreeModel . frameForId ( frameId ) : null ;
181
182
this . _workspaceProjects . set ( projectId , project ) ;
182
183
return project ;
183
184
}
184
185
185
186
/**
186
187
* @param {!Common.ContentProvider } contentProvider
187
- * @param {?SDK.ResourceTreeFrame } frame
188
+ * @param {string } frameId
188
189
* @param {boolean } isContentScript
189
190
* @param {?number } contentSize
190
191
* @return {!Workspace.UISourceCode }
191
192
*/
192
- addFile ( contentProvider , frame , isContentScript , contentSize ) {
193
- var uiSourceCode = this . _createFile ( contentProvider , frame , isContentScript || false ) ;
193
+ addSourceMapFile ( contentProvider , frameId , isContentScript , contentSize ) {
194
+ var uiSourceCode = this . _createFile ( contentProvider , frameId , isContentScript || false ) ;
194
195
var metadata = typeof contentSize === 'number' ? new Workspace . UISourceCodeMetadata ( null , contentSize ) : null ;
195
196
this . _addUISourceCodeWithProvider ( uiSourceCode , contentProvider , metadata ) ;
196
197
return uiSourceCode ;
197
198
}
198
199
199
200
/**
200
- * @param {?SDK.ResourceTreeFrame } frame
201
+ * @param {string } frameId
201
202
* @param {string } url
202
203
*/
203
- _removeFileForURL ( frame , url ) {
204
- var project = this . _workspaceProjects . get ( Bindings . NetworkProject . projectId ( this . target ( ) , frame , false ) ) ;
204
+ _removeFileForURL ( frameId , url ) {
205
+ var project = this . _workspaceProjects . get ( Bindings . NetworkProject . projectId ( this . target ( ) , frameId , false ) ) ;
205
206
if ( ! project )
206
207
return ;
207
208
project . removeFile ( url ) ;
@@ -251,8 +252,9 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
251
252
return ;
252
253
}
253
254
var originalContentProvider = script . originalContentProvider ( ) ;
254
- var uiSourceCode =
255
- this . _createFile ( originalContentProvider , SDK . ResourceTreeFrame . fromScript ( script ) , script . isContentScript ( ) ) ;
255
+ var executionContext = script . executionContext ( ) ;
256
+ var frameId = executionContext ? executionContext . frameId || '' : '' ;
257
+ var uiSourceCode = this . _createFile ( originalContentProvider , frameId , script . isContentScript ( ) ) ;
256
258
uiSourceCode [ Bindings . NetworkProject . _scriptSymbol ] = script ;
257
259
var resource = SDK . ResourceTreeModel . resourceForURL ( uiSourceCode . url ( ) ) ;
258
260
this . _addUISourceCodeWithProvider ( uiSourceCode , originalContentProvider , this . _resourceMetadata ( resource ) ) ;
@@ -269,7 +271,7 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
269
271
return ;
270
272
271
273
var originalContentProvider = header . originalContentProvider ( ) ;
272
- var uiSourceCode = this . _createFile ( originalContentProvider , SDK . ResourceTreeFrame . fromStyleSheet ( header ) , false ) ;
274
+ var uiSourceCode = this . _createFile ( originalContentProvider , header . frameId , false ) ;
273
275
uiSourceCode [ Bindings . NetworkProject . _styleSheetSymbol ] = header ;
274
276
var resource = SDK . ResourceTreeModel . resourceForURL ( uiSourceCode . url ( ) ) ;
275
277
this . _addUISourceCodeWithProvider ( uiSourceCode , originalContentProvider , this . _resourceMetadata ( resource ) ) ;
@@ -283,7 +285,7 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
283
285
if ( header . isInline && ! header . hasSourceURL && header . origin !== 'inspector' )
284
286
return ;
285
287
286
- this . _removeFileForURL ( SDK . ResourceTreeFrame . fromStyleSheet ( header ) , header . resourceURL ( ) ) ;
288
+ this . _removeFileForURL ( header . frameId , header . resourceURL ( ) ) ;
287
289
}
288
290
289
291
/**
@@ -314,14 +316,13 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
314
316
resource . contentURL ( ) . startsWith ( 'data:' ) )
315
317
return ;
316
318
317
- var frame = SDK . ResourceTreeFrame . fromResource ( resource ) ;
318
319
// Never load document twice.
319
- var projectId = Bindings . NetworkProject . projectId ( this . target ( ) , frame , false ) ;
320
+ var projectId = Bindings . NetworkProject . projectId ( this . target ( ) , resource . frameId , false ) ;
320
321
var project = this . _workspaceProjects . get ( projectId ) ;
321
322
if ( project && project . uiSourceCodeForURL ( resource . url ) )
322
323
return ;
323
324
324
- var uiSourceCode = this . _createFile ( resource , frame , false ) ;
325
+ var uiSourceCode = this . _createFile ( resource , resource . frameId , false ) ;
325
326
uiSourceCode [ Bindings . NetworkProject . _resourceSymbol ] = resource ;
326
327
this . _addUISourceCodeWithProvider ( uiSourceCode , resource , this . _resourceMetadata ( resource ) ) ;
327
328
}
@@ -330,10 +331,10 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
330
331
* @param {!SDK.ResourceTreeFrame } frame
331
332
*/
332
333
_removeFrameResources ( frame ) {
333
- var project = this . _workspaceProject ( frame , false ) ;
334
+ var project = this . _workspaceProject ( frame . id , false ) ;
334
335
for ( var resource of frame . resources ( ) )
335
336
project . removeUISourceCode ( resource . url ) ;
336
- project = this . _workspaceProject ( frame , true ) ;
337
+ project = this . _workspaceProject ( frame . id , true ) ;
337
338
for ( var resource of frame . resources ( ) )
338
339
project . removeUISourceCode ( resource . url ) ;
339
340
}
@@ -370,13 +371,13 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
370
371
371
372
/**
372
373
* @param {!Common.ContentProvider } contentProvider
373
- * @param {?SDK.ResourceTreeFrame } frame
374
+ * @param {string } frameId
374
375
* @param {boolean } isContentScript
375
376
* @return {!Workspace.UISourceCode }
376
377
*/
377
- _createFile ( contentProvider , frame , isContentScript ) {
378
+ _createFile ( contentProvider , frameId , isContentScript ) {
378
379
var url = contentProvider . contentURL ( ) ;
379
- var project = this . _workspaceProject ( frame , isContentScript ) ;
380
+ var project = this . _workspaceProject ( frameId , isContentScript ) ;
380
381
var uiSourceCode = project . createUISourceCode ( url , contentProvider . contentType ( ) ) ;
381
382
uiSourceCode [ Bindings . NetworkProject . _targetSymbol ] = this . target ( ) ;
382
383
return uiSourceCode ;
@@ -412,9 +413,10 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
412
413
*/
413
414
static uiSourceCodeForScriptURL ( workspace , url , script ) {
414
415
var target = script . debuggerModel . target ( ) ;
415
- var frame = SDK . ResourceTreeFrame . fromScript ( script ) ;
416
- return workspace . uiSourceCode ( Bindings . NetworkProject . projectId ( target , frame , false ) , url ) ||
417
- workspace . uiSourceCode ( Bindings . NetworkProject . projectId ( target , frame , true ) , url ) ;
416
+ var executionContext = script . executionContext ( ) ;
417
+ var frameId = executionContext ? executionContext . frameId || '' : '' ;
418
+ return workspace . uiSourceCode ( Bindings . NetworkProject . projectId ( target , frameId , false ) , url ) ||
419
+ workspace . uiSourceCode ( Bindings . NetworkProject . projectId ( target , frameId , true ) , url ) ;
418
420
}
419
421
420
422
/**
@@ -424,8 +426,7 @@ Bindings.NetworkProject = class extends SDK.SDKObject {
424
426
* @return {?Workspace.UISourceCode }
425
427
*/
426
428
static uiSourceCodeForStyleURL ( workspace , url , header ) {
427
- var frame = SDK . ResourceTreeFrame . fromStyleSheet ( header ) ;
428
- return workspace . uiSourceCode ( Bindings . NetworkProject . projectId ( header . target ( ) , frame , false ) , url ) ;
429
+ return workspace . uiSourceCode ( Bindings . NetworkProject . projectId ( header . target ( ) , header . frameId , false ) , url ) ;
429
430
}
430
431
} ;
431
432
0 commit comments