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

Method loadTextContent

front_end/core/sdk/Script.ts:190–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188 }
189
190 private async loadTextContent(): Promise<TextUtils.ContentData.ContentData> {
191 const result = await this.debuggerModel.target().debuggerAgent().invoke_getScriptSource({scriptId: this.scriptId});
192 if (result.getError()) {
193 throw new Error(result.getError());
194 }
195 const {scriptSource, bytecode} = result;
196 if (bytecode) {
197 return new TextUtils.ContentData.ContentData(bytecode, /* isBase64 */ true, 'application/wasm');
198 }
199 let content: string = scriptSource || '';
200 if (this.hasSourceURL && Common.ParsedURL.schemeIs(this.sourceURL, 'snippet:')) {
201 // TODO(crbug.com/1330846): Find a better way to establish the snippet automapping binding then adding
202 // a sourceURL comment before evaluation and removing it here.
203 content = Script.trimSourceURLComment(content);
204 }
205 return new TextUtils.ContentData.ContentData(content, /* isBase64 */ false, 'text/javascript');
206 }
207
208 private async loadWasmContent(): Promise<TextUtils.ContentData.ContentDataOrError> {
209 if (!this.isWasm()) {

Callers 2

loadWasmContentMethod · 0.95
#requestContentMethod · 0.95

Calls 5

debuggerAgentMethod · 0.80
getErrorMethod · 0.80
trimSourceURLCommentMethod · 0.80
targetMethod · 0.65

Tested by

no test coverage detected