From 7f8cdd617a489ef4d2735c579228aa7a5a8d31a4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:43:27 +0000 Subject: [PATCH 1/3] chore(deps): upgrade SpiderMonkey to `b66436b1a867396fd24a9e6dd7c114cb95dbd9f8` --- mozcentral.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mozcentral.version b/mozcentral.version index 9f4b8194..468214a9 100644 --- a/mozcentral.version +++ b/mozcentral.version @@ -1 +1 @@ -a283127a5d0aa005c54d339e8ca27414b55f079b \ No newline at end of file +b66436b1a867396fd24a9e6dd7c114cb95dbd9f8 \ No newline at end of file From dcfbb349fb1a1830f77155b0a05ed49afd2bdd14 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Tue, 3 Dec 2024 17:53:25 +0000 Subject: [PATCH 2/3] fix(JobQueue): the `JobQueue::getIncumbentGlobal` method has been removed from the definition in new SpiderMonkey version --- include/JobQueue.hh | 9 --------- src/JobQueue.cc | 4 ---- 2 files changed, 13 deletions(-) diff --git a/include/JobQueue.hh b/include/JobQueue.hh index 36a6d810..a4ad4ecb 100644 --- a/include/JobQueue.hh +++ b/include/JobQueue.hh @@ -34,15 +34,6 @@ explicit JobQueue(JSContext *cx); */ bool init(JSContext *cx); -/** - * @brief Ask the embedding for the incumbent global. - * - * SpiderMonkey doesn't itself have a notion of incumbent globals as defined - * by the HTML spec, so we need the embedding to provide this. See - * dom/script/ScriptSettings.h for details. - */ -JSObject *getIncumbentGlobal(JSContext *cx) override; - /** * @brief Enqueue a reaction job `job` for `promise`, which was allocated at * `allocationSite`. Provide `incumbentGlobal` as the incumbent global for diff --git a/src/JobQueue.cc b/src/JobQueue.cc index 6dcb548f..a4ddaa61 100644 --- a/src/JobQueue.cc +++ b/src/JobQueue.cc @@ -26,10 +26,6 @@ JobQueue::JobQueue(JSContext *cx) { finalizationRegistryCallbacks = new JS::PersistentRooted(cx); // Leaks but it's OK since freed at process exit } -JSObject *JobQueue::getIncumbentGlobal(JSContext *cx) { - return JS::CurrentGlobalOrNull(cx); -} - bool JobQueue::enqueuePromiseJob(JSContext *cx, [[maybe_unused]] JS::HandleObject promise, JS::HandleObject job, From d830f9d4a6a8ca929ef5293496fb5e63c6a2bb1d Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Tue, 3 Dec 2024 18:03:21 +0000 Subject: [PATCH 3/3] feat(JobQueue): implement the new `JobQueue::getHostDefinedData` method on `JobQueue` for the new SpiderMonkey version --- include/JobQueue.hh | 17 +++++++++++++++++ src/JobQueue.cc | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/include/JobQueue.hh b/include/JobQueue.hh index a4ad4ecb..36734f92 100644 --- a/include/JobQueue.hh +++ b/include/JobQueue.hh @@ -34,6 +34,23 @@ explicit JobQueue(JSContext *cx); */ bool init(JSContext *cx); +/** + * @brief Ask the embedding for the host defined data. + * + * SpiderMonkey doesn't itself have a notion of host defined data as defined + * by the HTML spec, so we need the embedding to provide this. See + * dom/script/ScriptSettings.h for details. + * + * If the embedding has the host defined data, this method should return the + * host defined data via the `data` out parameter and return `true`. + * The object in the `data` out parameter can belong to any compartment. + * If the embedding doesn't need the host defined data, this method should + * set the `data` out parameter to `nullptr` and return `true`. + * If any error happens while generating the host defined data, this method + * should set a pending exception to `cx` and return `false`. + */ +bool getHostDefinedData(JSContext *cx, JS::MutableHandle data) const override; + /** * @brief Enqueue a reaction job `job` for `promise`, which was allocated at * `allocationSite`. Provide `incumbentGlobal` as the incumbent global for diff --git a/src/JobQueue.cc b/src/JobQueue.cc index a4ddaa61..928746fd 100644 --- a/src/JobQueue.cc +++ b/src/JobQueue.cc @@ -26,6 +26,11 @@ JobQueue::JobQueue(JSContext *cx) { finalizationRegistryCallbacks = new JS::PersistentRooted(cx); // Leaks but it's OK since freed at process exit } +bool JobQueue::getHostDefinedData(JSContext *cx, JS::MutableHandle data) const { + data.set(nullptr); // We don't need the host defined data + return true; // `true` indicates no error +} + bool JobQueue::enqueuePromiseJob(JSContext *cx, [[maybe_unused]] JS::HandleObject promise, JS::HandleObject job,