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

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