Skip to content

Commit 02528c5

Browse files
authored
Upgrade SpiderMonkey to mozilla-central commit 250be4ca3c669db9a397456402f68249aa15d8d5
Merge pull request #459 from Distributive-Network/chore/upgrade-spidermonkey-to-250be4c
2 parents 26e1406 + aaa7e4d commit 02528c5

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

include/JobQueue.hh

+11-3
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ explicit JobQueue(JSContext *cx);
3535
bool init(JSContext *cx);
3636

3737
/**
38-
* @brief Ask the embedding for the incumbent global.
38+
* @brief Ask the embedding for the host defined data.
3939
*
40-
* SpiderMonkey doesn't itself have a notion of incumbent globals as defined
40+
* SpiderMonkey doesn't itself have a notion of host defined data as defined
4141
* by the HTML spec, so we need the embedding to provide this. See
4242
* 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`.
4351
*/
44-
JSObject *getIncumbentGlobal(JSContext *cx) override;
52+
bool getHostDefinedData(JSContext *cx, JS::MutableHandle<JSObject *> data) const override;
4553

4654
/**
4755
* @brief Enqueue a reaction job `job` for `promise`, which was allocated at

mozcentral.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4bdfb2c22e6e4b5600f66612c6d6121fe99769a1
1+
250be4ca3c669db9a397456402f68249aa15d8d5

setup.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ cd firefox-source
5454
# Apply patching
5555
# making it work for both GNU and BSD (macOS) versions of sed
5656
sed -i'' -e 's/os not in ("WINNT", "OSX", "Android")/os not in ("WINNT", "Android")/' ./build/moz.configure/pkg.configure # use pkg-config on macOS
57-
sed -i'' -e '/"WindowsDllMain.cpp"/d' ./mozglue/misc/moz.build # https://discourse.mozilla.org/t/105671, https://bugzilla.mozilla.org/show_bug.cgi?id=1751561
58-
sed -i'' -e '/"winheap.cpp"/d' ./memory/mozalloc/moz.build # https://bugzilla.mozilla.org/show_bug.cgi?id=1802675
5957
sed -i'' -e 's/bool Unbox/JS_PUBLIC_API bool Unbox/g' ./js/public/Class.h # need to manually add JS_PUBLIC_API to js::Unbox until it gets fixed in Spidermonkey
6058
sed -i'' -e 's/bool js::Unbox/JS_PUBLIC_API bool js::Unbox/g' ./js/src/vm/JSObject.cpp # same here
6159
sed -i'' -e 's/shared_lib = self._pretty_path(libdef.output_path, backend_file)/shared_lib = libdef.lib_name/' ./python/mozbuild/mozbuild/backend/recursivemake.py # would generate a Makefile to install the binary files from an invalid path prefix
@@ -66,6 +64,7 @@ sed -i'' -e 's/return !IsIteratorHelpersEnabled()/return false/' ./js/src/vm/Glo
6664
sed -i'' -e '/MOZ_CRASH_UNSAFE_PRINTF/,/__PRETTY_FUNCTION__);/d' ./mfbt/LinkedList.h # would crash in Debug Build: in `~LinkedList()` it should have removed all this list's elements before the list's destruction
6765
sed -i'' -e '/MOZ_ASSERT(stackRootPtr == nullptr);/d' ./js/src/vm/JSContext.cpp # would assert false in Debug Build since we extensively use `new JS::Rooted`
6866
sed -i'' -e 's/"-fuse-ld=ld"/"-ld64" if c_compiler.version > "14.0.0" else "-fuse-ld=ld"/' ./build/moz.configure/toolchain.configure # XCode 15 changed the linker behaviour. See https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking
67+
sed -i'' -e 's/defined(XP_WIN)/defined(_WIN32)/' ./mozglue/baseprofiler/public/BaseProfilerUtils.h # this header file is introduced to js/Debug.h in https://phabricator.services.mozilla.com/D221102, but it would be compiled without XP_WIN in this building configuration
6968

7069
cd js/src
7170
mkdir -p _build
@@ -79,7 +78,11 @@ mkdir -p ../../../../_spidermonkey_install/
7978
--disable-jemalloc \
8079
--disable-tests \
8180
$(if [[ "$OSTYPE" == "darwin"* ]]; then echo "--enable-linker=ld64"; fi) \
82-
--enable-optimize
81+
--enable-optimize \
82+
--disable-explicit-resource-management
83+
# disable-explicit-resource-management: Disable the `using` syntax that is enabled by default in SpiderMonkey nightly, otherwise the header files will disagree with the compiled lib .so file
84+
# when it's using a `IF_EXPLICIT_RESOURCE_MANAGEMENT` macro, e.g., the `enum JSProtoKey` index would be off by 1 (header `JSProto_Uint8Array` 27 will be interpreted as `JSProto_Int8Array` in lib as lib has an extra element)
85+
# https://bugzilla.mozilla.org/show_bug.cgi?id=1940342
8386
make -j$CPUS
8487
echo "Done building spidermonkey"
8588

src/JobQueue.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ JobQueue::JobQueue(JSContext *cx) {
2626
finalizationRegistryCallbacks = new JS::PersistentRooted<FunctionVector>(cx); // Leaks but it's OK since freed at process exit
2727
}
2828

29-
JSObject *JobQueue::getIncumbentGlobal(JSContext *cx) {
30-
return JS::CurrentGlobalOrNull(cx);
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
3132
}
3233

3334
bool JobQueue::enqueuePromiseJob(JSContext *cx,

0 commit comments

Comments
 (0)