pub unsafe fn start(
cx: *mut JSContext,
promise_val: Value,
profile: Option<StealthProfile>,
method: Method,
url: String,
headers: Vec<(String, String)>,
body: Option<Vec<u8>>,
)Expand description
Schedule an async fetch via AsyncHTTP::init + HTTPThread::schedule.
The caller must have already created the pending Promise via
JS::NewPromiseObject(cx, null), pass it here as promise_val
(an Object JSVal), and then set args.rval() to the same value before
returning from the extern-C trampoline.
This function:
- Heap-roots the Promise value (GUARD-A: SM GC safety across ticks).
- Creates
AsyncHTTP::initwith TLS fingerprint injection. - Schedules via
HTTPThread::schedule(single epoll thread, O(1) OS threads). ref_concurrentlyon the event loop (keepalive while fetch is in flight).- Pushes a
PendingFetchonto the JS-thread registry.
§Safety
cxmust be a liveJSContext*on the current thread.promise_valmust be an Object JSVal holding a pending Promise.