File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,23 @@ explicit JobQueue(JSContext *cx);
3434 */
3535bool init (JSContext *cx);
3636
37+ /* *
38+ * @brief Ask the embedding for the host defined data.
39+ *
40+ * SpiderMonkey doesn't itself have a notion of host defined data as defined
41+ * by the HTML spec, so we need the embedding to provide this. See
42+ * dom/script/ScriptSettings.h for details.
43+ *
44+ * If the embedding has the host defined data, this method should return the
45+ * host defined data via the `data` out parameter and return `true`.
46+ * The object in the `data` out parameter can belong to any compartment.
47+ * If the embedding doesn't need the host defined data, this method should
48+ * set the `data` out parameter to `nullptr` and return `true`.
49+ * If any error happens while generating the host defined data, this method
50+ * should set a pending exception to `cx` and return `false`.
51+ */
52+ bool getHostDefinedData (JSContext *cx, JS::MutableHandle<JSObject *> data) const override ;
53+
3754/* *
3855 * @brief Enqueue a reaction job `job` for `promise`, which was allocated at
3956 * `allocationSite`. Provide `incumbentGlobal` as the incumbent global for
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ JobQueue::JobQueue(JSContext *cx) {
2626 finalizationRegistryCallbacks = new JS::PersistentRooted<FunctionVector>(cx); // Leaks but it's OK since freed at process exit
2727}
2828
29+ bool JobQueue::getHostDefinedData (JSContext *cx, JS::MutableHandle<JSObject *> data) const {
30+ data.set (nullptr ); // We don't need the host defined data
31+ return true ; // `true` indicates no error
32+ }
33+
2934bool JobQueue::enqueuePromiseJob (JSContext *cx,
3035 [[maybe_unused]] JS::HandleObject promise,
3136 JS::HandleObject job,
You can’t perform that action at this time.
0 commit comments