MCPcopy Create free account
hub / github.com/Snapchat/Valdi / doCancel

Method doCancel

valdi/src/valdi/runtime/JavaScript/JSPromise.cpp:208–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206 callContext.setThisValue(jsValue);
207
208 jsEntry.jsContext.callObjectAsFunction(thenCallback.get(), callContext);
209}
210
211void JSPromise::doCancel(const JavaScriptEntryParameters& jsEntry) {
212 auto jsValue = _jsValue.getJsValue(jsEntry.jsContext, jsEntry.exceptionTracker);
213 if (!jsEntry.exceptionTracker) {
214 return;
215 }
216
217 auto cancelCallback = JSPromiseCancel::getFromJSPromise(jsEntry.jsContext, jsValue, jsEntry.exceptionTracker);
218
219 if (!jsEntry.exceptionTracker || jsEntry.jsContext.isValueUndefined(cancelCallback.get())) {
220 return;
221 }
222
223 JSFunctionCallContext callContext(jsEntry.jsContext, nullptr, 0, jsEntry.exceptionTracker);
224 callContext.setThisValue(jsValue);
225
226 jsEntry.jsContext.callObjectAsFunction(cancelCallback.get(), callContext);
227}

Callers 1

cancelMethod · 0.95

Calls 5

getJsValueMethod · 0.80
setThisValueMethod · 0.80
getMethod · 0.65
isValueUndefinedMethod · 0.45
callObjectAsFunctionMethod · 0.45

Tested by

no test coverage detected