MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / frameIdForScript

Function frameIdForScript

front_end/core/sdk/Script.ts:491–502  ·  view source on GitHub ↗
(script: Script)

Source from the content-addressed store, hash-verified

489const frameIdSymbol = Symbol('frameid');
490
491function frameIdForScript(script: Script): Protocol.Page.FrameId|null {
492 const executionContext = script.executionContext();
493 if (executionContext) {
494 return executionContext.frameId || null;
495 }
496 // This is to overcome compilation cache which doesn't get reset.
497 const resourceTreeModel = script.debuggerModel.target().model(ResourceTreeModel);
498 if (!resourceTreeModel?.mainFrame) {
499 return null;
500 }
501 return resourceTreeModel.mainFrame.id;
502}
503
504export const sourceURLRegex = /^[\x20\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/;
505

Callers 1

frameIdMethod · 0.85

Calls 3

targetMethod · 0.65
executionContextMethod · 0.45
modelMethod · 0.45

Tested by

no test coverage detected