MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / cb

Function cb

src/common/browser.js:60–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 const stackInfo = new SafeError(`callstack before invoking ${func.name || 'chrome API'}:`);
59 // A single parameter `result` is fine because we don't use API that return more
60 const cb = result => {
61 const runtimeErr = chrome.runtime.lastError;
62 const err = runtimeErr || (
63 preprocessorFunc
64 ? preprocessorFunc(resolve, result)
65 : resolve(result)
66 );
67 // Prefer `reject` over `throw` which stops debugger in 'pause on exceptions' mode
68 if (err) {
69 if (!runtimeErr) stackInfo[STACK] = `${err[1]}\n${stackInfo[STACK]}`;
70 stackInfo[MESSAGE] = runtimeErr ? err[MESSAGE] : `${err[0]}`;
71 stackInfo.isRuntime = !!runtimeErr;
72 reject(stackInfo);
73 }
74 };
75 if (process.env.IS_INJECTED) {
76 safePush(args, cb); /* global safePush */
77 try {

Callers 10

fireFunction · 0.70
onceFnFunction · 0.70
onElementFunction · 0.50
util-task.jsFile · 0.50
HttpRequestedFunction · 0.50
gmCookieInvokerFunction · 0.50
webAddElementFunction · 0.50
bufferContentsFunction · 0.50
endStreamFunction · 0.50
string.jsFile · 0.50

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected