MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / registerModule

Function registerModule

packages/wasm/src/registry.ts:43–74  ·  view source on GitHub ↗
(module: WebAssembly.Module, url: string)

Source from the content-addressed store, hash-verified

41 * Records a module and returns the created debug image.
42 */
43export function registerModule(module: WebAssembly.Module, url: string): DebugImage | null {
44 const { buildId, debugFile } = getModuleInfo(module);
45 if (!buildId) {
46 return null;
47 }
48
49 const oldIdx = getImage(url);
50 if (oldIdx >= 0) {
51 IMAGES.splice(oldIdx, 1);
52 }
53
54 let debugFileUrl = null;
55 if (debugFile) {
56 try {
57 debugFileUrl = new URL(debugFile, url).href;
58 } catch {
59 // debugFile could be a blob URL which causes the URL constructor to throw
60 // for now we just ignore this case
61 }
62 }
63
64 const image: DebugImage = {
65 type: 'wasm',
66 code_id: buildId,
67 code_file: url,
68 debug_file: debugFileUrl,
69 debug_id: `${buildId.padEnd(32, '0').slice(0, 32)}0`,
70 };
71
72 IMAGES.push(image);
73 return image;
74}
75
76/**
77 * Returns all known images.

Callers 2

registerModuleAndForwardFunction · 0.90
patchWebAssemblyFunction · 0.90

Calls 4

getModuleInfoFunction · 0.85
getImageFunction · 0.85
sliceMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected