Skip to content

Commit 518ee8d

Browse files
authored
Upgrade to SpiderMonkey 140 (#607)
* Update SpiderMonkey Signed-off-by: Josh Matthews <[email protected]> * Update patches. Signed-off-by: Josh Matthews <[email protected]> * Apply patches. Signed-off-by: Josh Matthews <[email protected]> * Update jsglue. Signed-off-by: Josh Matthews <[email protected]> * Update wrappers. Signed-off-by: Josh Matthews <[email protected]> * Update README. Signed-off-by: Josh Matthews <[email protected]> * Update package version. Signed-off-by: Josh Matthews <[email protected]> * Wrap new Dispatchable ownership in a layer of opaque pointers. Signed-off-by: Josh Matthews <[email protected]> * Upgrade NDK to 28b. Signed-off-by: Josh Matthews <[email protected]> * Format jsglue. Signed-off-by: Josh Matthews <[email protected]> * Fetch mozjs source from github release. Reenable integrity check. Signed-off-by: Josh Matthews <[email protected]> * Update upgrade steps in README for new integrity job requirements. Signed-off-by: Josh Matthews <[email protected]> * Show git diff when integrity check fails. Signed-off-by: Josh Matthews <[email protected]> * Remove vendored jinja2 module. Signed-off-by: Josh Matthews <[email protected]> * Update jinja2 removal patch to use lowercase directory name. Signed-off-by: Josh Matthews <[email protected]> * Address review comments. Signed-off-by: Josh Matthews <[email protected]> * Fix documentation. Signed-off-by: Josh Matthews <[email protected]> --------- Signed-off-by: Josh Matthews <[email protected]>
1 parent a51d878 commit 518ee8d

File tree

1,894 files changed

+63631
-62057
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,894 files changed

+63631
-62057
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ jobs:
189189
uses: nttld/setup-ndk@v1
190190
id: setup-ndk
191191
with:
192-
ndk-version: r28
192+
ndk-version: r28b
193193
- name: Install Rust
194194
uses: dtolnay/rust-toolchain@master
195195
id: toolchain
@@ -285,21 +285,21 @@ jobs:
285285
with:
286286
clang-format-version: "18"
287287
exclude-regex: mozjs-sys\/mozjs
288-
#- name: Get mozjs
289-
# run: |
290-
# bash ./mozjs-sys/etc/get_mozjs.sh
291-
#- name: Apply patch
292-
# run: |
293-
# python3 ./mozjs-sys/etc/update.py --no-commit mozjs.tar.xz
294-
# # Run `git add` here to force CRLF converted into LF
295-
# # so that we can check diff properly in next run
296-
# git add --all mozjs-sys
297-
#- name: Check patch integrity
298-
# working-directory: ./mozjs-sys
299-
# # Because we've added files in previous run, we need to
300-
# # check diff with `--staged`.
301-
# run: |
302-
# git diff --staged --no-ext-diff --quiet --exit-code
288+
- name: Get mozjs
289+
run: |
290+
bash ./mozjs-sys/etc/get_mozjs.sh
291+
- name: Apply patch
292+
run: |
293+
python3 ./mozjs-sys/etc/update.py --no-commit mozjs.tar.xz
294+
# Run `git add` here to force CRLF converted into LF
295+
# so that we can check diff properly in next run
296+
git add --all mozjs-sys
297+
- name: Check patch integrity
298+
working-directory: ./mozjs-sys
299+
# Because we've added files in previous run, we need to
300+
# check diff with `--staged`.
301+
run: |
302+
git diff --staged --no-ext-diff --exit-code
303303
- name: Detect need for mozjs-sys version bump
304304
if: ${{ github.event_name == 'pull_request' }}
305305
id: changes

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ that are battle-tested in [Servo](https://servo.org/), split in two crates:
66
- `mozjs-sys`: SpiderMonkey and low-level Rust bindings to its C++ API.
77
- `mozjs`: Higher-level bindings to the SpiderMonkey API.
88

9-
Mozjs is currently tracking SpiderMonkey on [mozilla-release](https://searchfox.org/mozilla-release/source/) branch
10-
(currently version 137.0).
9+
Mozjs is currently tracking SpiderMonkey on [mozilla-esr140](https://searchfox.org/mozilla-esr140/source/) branch
10+
(currently version 140.0).
1111

1212
## Building from Pre-built Archive
1313

@@ -159,7 +159,11 @@ In order to upgrade to a new version of SpiderMonkey:
159159

160160
6. Run `./mozjs/src/generate_wrappers.sh` to regenerate wrappers.
161161

162-
7. Build and test the bindings as above, then submit a PR!
162+
7. Build and test the bindings as above.
163+
164+
8. Create a new release on github with the .tar.xz that you saved earlier. Name the new tag `mozjs-source-${COMMIT}` where `${COMMIT}` is the value stored in `mozjs/etc/COMMIT`.
165+
166+
9. Submit a PR!
163167

164168
8. Send companion PR to servo, as SpiderMonkey bump PR will not be merged
165169
until it's tested against servo.

mozjs-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mozjs_sys"
33
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
44
repository.workspace = true
5-
version = "0.137.0-3"
5+
version = "0.140.0-0"
66
authors = ["Mozilla"]
77
links = "mozjs"
88
license.workspace = true

mozjs-sys/etc/COMMIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7a8941c8c2cbdd3a4d352d8b732f7b5eeefbfd2d
1+
19b003833fc9bb146efa9bc665a536765e8899d1

mozjs-sys/etc/filters.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@
3333
- /Cargo.toml
3434
- /modules/zlib
3535

36+
# Remove unused python dependency that also causes problems with case-sensitive filesystems.
37+
- /third_party/python/Jinja2
38+
- /third_party/python/jinja2
39+
3640
# Include the rest.
3741
+ /*

mozjs-sys/etc/get_mozjs.sh

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
REPO=mozilla-release
8-
97
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
10-
# get commit and appropriet mozjs tar
8+
# get commit and appropriate mozjs tar
119
COMMIT=$( cat $SCRIPT_DIR/COMMIT )
1210
echo "Commit $COMMIT"
13-
job_id=$(curl "https://treeherder.mozilla.org/api/project/$REPO/push/?revision=$COMMIT" | jq '.results[0].id')
14-
echo "Job id $job_id"
15-
task_id=$(curl "https://treeherder.mozilla.org/api/jobs/?push_id=$job_id" | jq -r '.results[] | select(.[] == "spidermonkey-sm-package-linux64/opt") | .[14]')
16-
echo "Task id $task_id"
17-
tar_file=$(curl "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/$task_id/runs/0/artifacts" | jq -r '.artifacts[] | select(.name | contains("tar.xz")) | .name')
18-
echo "Tar at https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/$task_id/runs/0/artifacts/$tar_file"
19-
curl -L --output mozjs.tar.xz "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/$task_id/runs/0/artifacts/$tar_file"
11+
tar_file=$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/servo/mozjs/releases/tags/mozjs-source-$COMMIT | jq -r '.assets[] | select(.name | contains("tar.xz")) | .browser_download_url')
12+
echo "Tar at $tar_file"
13+
curl -L --output mozjs.tar.xz $tar_file
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
REPO=mozilla-release
8+
9+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
10+
# get commit and appropriate mozjs tar
11+
COMMIT=$( cat $SCRIPT_DIR/COMMIT )
12+
echo "Commit $COMMIT"
13+
job_id=$(curl "https://treeherder.mozilla.org/api/project/$REPO/push/?revision=$COMMIT" | jq '.results[0].id')
14+
echo "Job id $job_id"
15+
task_id=$(curl "https://treeherder.mozilla.org/api/jobs/?push_id=$job_id" | jq -r '.results[] | select(.[] == "spidermonkey-sm-package-linux64/opt") | .[14]')
16+
echo "Task id $task_id"
17+
tar_file=$(curl "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/$task_id/runs/0/artifacts" | jq -r '.artifacts[] | select(.name | contains("tar.xz")) | .name')
18+
echo "Tar at https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/$task_id/runs/0/artifacts/$tar_file"
19+
curl -L --output mozjs.tar.xz "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/$task_id/runs/0/artifacts/$tar_file"

mozjs-sys/etc/patches/0032-macos-sdk-min-14-2.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ index 8a97d952d..5b538f0a1 100755
66
)
77

88
def mac_sdk_min_version():
9-
- return "15.2"
9+
- return "15.4"
1010
+ return "14.2"
1111

1212
@depends(

mozjs-sys/etc/patches/0033-no-zlib.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ index 804b9a375..87ccc508d 100755
6161
-
6262
-option(
6363
- env="USE_LIBZ_RS",
64-
- default=milestone.is_nightly,
64+
- default=milestone.is_early_beta_or_earlier,
6565
- help="Use libz-rs-sys instead of zlib",
6666
- when=toolkit & ~with_system_zlib_option,
6767
-)

mozjs-sys/etc/patches/0038-more-bindgen-fixes.patch

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ diff --git a/js/public/CompileOptions.h b/js/public/CompileOptions.h
22
index 810f5e29e..e6b7ab797 100644
33
--- a/js/public/CompileOptions.h
44
+++ b/js/public/CompileOptions.h
5-
@@ -123,7 +123,7 @@ class JS_PUBLIC_API ReadOnlyDecodeOptions;
5+
@@ -123,6 +123,6 @@ class JS_PUBLIC_API ReadOnlyDecodeOptions;
66

77
// Compilation-specific part of JS::ContextOptions which is supposed to be
88
// configured by user prefs.
99
-class JS_PUBLIC_API PrefableCompileOptions {
1010
+class JS_PUBLIC_API __attribute__((__packed__)) PrefableCompileOptions {
1111
public:
1212
PrefableCompileOptions()
13-
: importAttributes_(false),

0 commit comments

Comments
 (0)