Update mozjs (SpiderMonkey) to 128.0 (#32769)

* Update mozjs

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Fix changed readTransfer callback

https://bugzilla.mozilla.org/show_bug.cgi?id=1842713
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Use NewExternalArrayBuffer from glue

d33454be74
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Fix columnorigin and filename being in latin1

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* fixup newexternalarray

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Float16 (this might require more work for codegen support)

https://bugzilla.mozilla.org/show_bug.cgi?id=1833647
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* js.strict is removed

https://bugzilla.mozilla.org/show_bug.cgi?id=1621603
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* asm options are now somewhere else

https://hg.mozilla.org/mozilla-central/rev/26045c88e3972957087d535e7f259e08857bd2a2
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Comment out offthread compilation

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Set NDK to 26

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Fix 1-origin handling

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Expect `FinalizationRegistry` interface

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Good expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* more expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Add `WeakRef` to interfaces expectation

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* mozjs upgrade: fixes for Android

Android NDK's layout has changed in r26 and 'lib64' no longer exists
under `toolchain/llvm/prebuilt/linux-x86_64`. The libraries that used to
be it are now present in `lib` folder itself.

This patch updates the build configuration to use the `lib` folder
instead when configuring the LIBCLANG_PATH environment variable.

This patch also updates to a newer mozjs version that includes fixes for
linker errors faced on Android (see #32769).

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Patch libz-sys & update mozjs

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* update NDK version in README

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Use servo/mozjs

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update mozjs again

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Samson 2024-07-29 09:20:15 +02:00 committed by GitHub
parent ed8def2896
commit d132a0273d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 524 additions and 240 deletions

View file

@ -70,7 +70,7 @@ jobs:
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
ndk-version: r26c
- name: Setup Key Store for APK Signing
env:
KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}

419
Cargo.lock generated
View file

@ -588,6 +588,16 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952"
[[package]]
name = "calendrical_calculations"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cec493b209a1b81fa32312d7ceca1b547d341c7b5f16a3edbf32b1d8b455bbdf"
dependencies = [
"core_maths",
"displaydoc",
]
[[package]]
name = "calloop"
version = "0.12.4"
@ -815,6 +825,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colored"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
"lazy_static",
"windows-sys 0.48.0",
]
[[package]]
name = "combine"
version = "4.6.7"
@ -1356,6 +1376,42 @@ dependencies = [
"crypto-common",
]
[[package]]
name = "diplomat"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3137c640d2bac491dbfca7f9945c948f888dd8c95bdf7ee6b164fbdfa5d3efc2"
dependencies = [
"diplomat_core",
"proc-macro2",
"quote",
"syn 2.0.72",
]
[[package]]
name = "diplomat-runtime"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29f9efe348e178ba77b6035bc6629138486f8b461654e7ac7ad8afaa61bd4d98"
dependencies = [
"log",
]
[[package]]
name = "diplomat_core"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd7aca1d8f9e7b73ad61785beedc9556ad79f84b15c15abaa7041377e42284c1"
dependencies = [
"lazy_static",
"proc-macro2",
"quote",
"serde",
"smallvec",
"strck_ident",
"syn 2.0.72",
]
[[package]]
name = "dirs-next"
version = "2.0.0"
@ -1745,6 +1801,18 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "fixed_decimal"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0febbeb1118a9ecdee6e4520ead6b54882e843dd0592ad233247dbee84c53db8"
dependencies = [
"displaydoc",
"ryu",
"smallvec",
"writeable",
]
[[package]]
name = "fixedbitset"
version = "0.1.9"
@ -2951,6 +3019,109 @@ dependencies = [
"objc2",
]
[[package]]
name = "icu_calendar"
version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7265b2137f9a36f7634a308d91f984574bbdba8cfd95ceffe1c345552275a8ff"
dependencies = [
"calendrical_calculations",
"displaydoc",
"icu_calendar_data",
"icu_locid",
"icu_locid_transform",
"icu_provider",
"tinystr",
"writeable",
"zerovec",
]
[[package]]
name = "icu_calendar_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e009b7f0151ee6fb28c40b1283594397e0b7183820793e9ace3dcd13db126d0"
[[package]]
name = "icu_capi"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f73a82a8307633c08ca119631cd90b006e448009da2d4466f7d76ca8fedf3b1"
dependencies = [
"diplomat",
"diplomat-runtime",
"fixed_decimal",
"icu_calendar",
"icu_casemap",
"icu_collator",
"icu_collections",
"icu_datetime",
"icu_decimal",
"icu_experimental",
"icu_list",
"icu_locid",
"icu_locid_transform",
"icu_normalizer",
"icu_plurals",
"icu_properties",
"icu_provider",
"icu_provider_adapters",
"icu_segmenter",
"icu_timezone",
"log",
"simple_logger",
"tinystr",
"unicode-bidi",
"writeable",
]
[[package]]
name = "icu_casemap"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff0c8ae9f8d31b12e27fc385ff9ab1f3cd9b17417c665c49e4ec958c37da75f"
dependencies = [
"displaydoc",
"icu_casemap_data",
"icu_collections",
"icu_locid",
"icu_properties",
"icu_provider",
"writeable",
"zerovec",
]
[[package]]
name = "icu_casemap_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d57966d5ab748f74513be4046867f9a20e801e2775d41f91d04a0f560b61f08"
[[package]]
name = "icu_collator"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d370371887d31d56f361c3eaa15743e54f13bc677059c9191c77e099ed6966b2"
dependencies = [
"displaydoc",
"icu_collator_data",
"icu_collections",
"icu_locid_transform",
"icu_normalizer",
"icu_properties",
"icu_provider",
"smallvec",
"utf16_iter",
"utf8_iter",
"zerovec",
]
[[package]]
name = "icu_collator_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ee3f88741364b7d6269cce6827a3e6a8a2cf408a78f766c9224ab479d5e4ae5"
[[package]]
name = "icu_collections"
version = "1.5.0"
@ -2963,6 +3134,111 @@ dependencies = [
"zerovec",
]
[[package]]
name = "icu_datetime"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d115efb85e08df3fd77e77f52e7e087545a783fffba8be80bfa2102f306b1780"
dependencies = [
"displaydoc",
"either",
"fixed_decimal",
"icu_calendar",
"icu_datetime_data",
"icu_decimal",
"icu_locid",
"icu_locid_transform",
"icu_plurals",
"icu_provider",
"icu_timezone",
"smallvec",
"tinystr",
"writeable",
"zerovec",
]
[[package]]
name = "icu_datetime_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ba7e7f7a01269b9afb0a39eff4f8676f693b55f509b3120e43a0350a9f88bea"
[[package]]
name = "icu_decimal"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb8fd98f86ec0448d85e1edf8884e4e318bb2e121bd733ec929a05c0a5e8b0eb"
dependencies = [
"displaydoc",
"fixed_decimal",
"icu_decimal_data",
"icu_locid_transform",
"icu_provider",
"writeable",
]
[[package]]
name = "icu_decimal_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d424c994071c6f5644f999925fc868c85fec82295326e75ad5017bc94b41523"
[[package]]
name = "icu_experimental"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "844ad7b682a165c758065d694bc4d74ac67f176da1c499a04d85d492c0f193b7"
dependencies = [
"displaydoc",
"fixed_decimal",
"icu_collections",
"icu_decimal",
"icu_experimental_data",
"icu_locid",
"icu_locid_transform",
"icu_normalizer",
"icu_pattern",
"icu_plurals",
"icu_properties",
"icu_provider",
"litemap",
"num-bigint",
"num-rational",
"num-traits",
"smallvec",
"tinystr",
"writeable",
"zerofrom",
"zerotrie",
"zerovec",
]
[[package]]
name = "icu_experimental_data"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c178b9a34083fca5bd70d61f647575335e9c197d0f30c38e8ccd187babc69d0"
[[package]]
name = "icu_list"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbfeda1d7775b6548edd4e8b7562304a559a91ed56ab56e18961a053f367c365"
dependencies = [
"displaydoc",
"icu_list_data",
"icu_locid_transform",
"icu_provider",
"regex-automata 0.2.0",
"writeable",
]
[[package]]
name = "icu_list_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1825170d2c6679cb20dbd96a589d034e49f698aed9a2ef4fafc9a0101ed298f"
[[package]]
name = "icu_locid"
version = "1.5.0"
@ -3020,6 +3296,39 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516"
[[package]]
name = "icu_pattern"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7f36aafd098d6717de34e668a8120822275c1fba22b936e757b7de8a2fd7e4"
dependencies = [
"displaydoc",
"either",
"writeable",
"yoke",
"zerofrom",
]
[[package]]
name = "icu_plurals"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba5a70e7c025dbd5c501b0a5c188cd11666a424f0dadcd4f0a95b7dafde3b114"
dependencies = [
"displaydoc",
"fixed_decimal",
"icu_locid_transform",
"icu_plurals_data",
"icu_provider",
"zerovec",
]
[[package]]
name = "icu_plurals_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e3e8f775b215d45838814a090a2227247a7431d74e9156407d9c37f6ef0f208"
[[package]]
name = "icu_properties"
version = "1.5.1"
@ -3032,6 +3341,7 @@ dependencies = [
"icu_properties_data",
"icu_provider",
"tinystr",
"unicode-bidi",
"zerovec",
]
@ -3050,6 +3360,7 @@ dependencies = [
"displaydoc",
"icu_locid",
"icu_provider_macros",
"log",
"stable_deref_trait",
"tinystr",
"writeable",
@ -3058,6 +3369,19 @@ dependencies = [
"zerovec",
]
[[package]]
name = "icu_provider_adapters"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6324dfd08348a8e0374a447ebd334044d766b1839bb8d5ccf2482a99a77c0bc"
dependencies = [
"icu_locid",
"icu_locid_transform",
"icu_provider",
"tinystr",
"zerovec",
]
[[package]]
name = "icu_provider_macros"
version = "1.5.0"
@ -3091,6 +3415,27 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f739ee737260d955e330bc83fdeaaf1631f7fb7ed218761d3c04bb13bb7d79df"
[[package]]
name = "icu_timezone"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa91ba6a585939a020c787235daa8aee856d9bceebd6355e283c0c310bc6de96"
dependencies = [
"displaydoc",
"icu_calendar",
"icu_provider",
"icu_timezone_data",
"tinystr",
"zerotrie",
"zerovec",
]
[[package]]
name = "icu_timezone_data"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c588878c508a3e2ace333b3c50296053e6483c6a7541251b546cc59dcd6ced8e"
[[package]]
name = "ident_case"
version = "1.0.1"
@ -3665,8 +4010,7 @@ dependencies = [
[[package]]
name = "libz-sys"
version = "1.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e"
source = "git+https://github.com/rust-lang/libz-sys.git?rev=f76b7a24ed0a71ef1b8bdac1895e8535cb2cb9c0#f76b7a24ed0a71ef1b8bdac1895e8535cb2cb9c0"
dependencies = [
"cc",
"libc",
@ -3993,7 +4337,7 @@ dependencies = [
[[package]]
name = "mozjs"
version = "0.14.1"
source = "git+https://github.com/servo/mozjs#6e4e55a002f493739c8dbe0f2d2b29b0017d5dd2"
source = "git+https://github.com/servo/mozjs#fb7782899503eb79801e67cf3c2fb819934ef509"
dependencies = [
"bindgen",
"cc",
@ -4006,14 +4350,15 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.115.13-2"
source = "git+https://github.com/servo/mozjs#fb8225ed5eb87c0d6d0b4d6126c11f5bc98687ce"
version = "0.128.0-1"
source = "git+https://github.com/servo/mozjs#fb7782899503eb79801e67cf3c2fb819934ef509"
dependencies = [
"bindgen",
"cc",
"encoding_c",
"encoding_c_mem",
"flate2",
"icu_capi",
"libc",
"libz-sys",
"tar",
@ -4255,6 +4600,16 @@ dependencies = [
"minimal-lexical",
]
[[package]]
name = "num-bigint"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
dependencies = [
"num-integer",
"num-traits",
]
[[package]]
name = "num-complex"
version = "0.2.4"
@ -4297,6 +4652,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
dependencies = [
"num-bigint",
"num-integer",
"num-traits",
]
@ -5018,10 +5374,19 @@ checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-automata 0.4.7",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9368763f5a9b804326f3af749e16f9abf378d227bcdee7634b13d8f17793782"
dependencies = [
"memchr",
]
[[package]]
name = "regex-automata"
version = "0.4.7"
@ -5872,6 +6237,18 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "simple_logger"
version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1"
dependencies = [
"colored",
"log",
"time 0.3.36",
"windows-sys 0.48.0",
]
[[package]]
name = "siphasher"
version = "0.3.11"
@ -6024,6 +6401,22 @@ name = "static_prefs"
version = "0.1.0"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
[[package]]
name = "strck"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be91090ded9d8f979d9fe921777342d37e769e0b6b7296843a7a38247240e917"
[[package]]
name = "strck_ident"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1c3802b169b3858a44667f221c9a0b3136e6019936ea926fc97fbad8af77202"
dependencies = [
"strck",
"unicode-ident",
]
[[package]]
name = "strict-num"
version = "0.1.1"
@ -7869,6 +8262,9 @@ name = "writeable"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
dependencies = [
"either",
]
[[package]]
name = "x11"
@ -8048,6 +8444,17 @@ dependencies = [
"synstructure 0.13.1",
]
[[package]]
name = "zerotrie"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb594dd55d87335c5f60177cee24f19457a5ec10a065e0a3014722ad252d0a1f"
dependencies = [
"displaydoc",
"yoke",
"zerofrom",
]
[[package]]
name = "zerovec"
version = "0.10.4"

View file

@ -187,3 +187,7 @@ strip = true
#
# [patch."https://github.com/servo/<repository>"]
# <crate> = { path = "/path/to/local/checkout" }
# patch libz-sys for https://github.com/rust-lang/libz-sys/pull/199
# until released as 1.1.19 (also remove this in mozjs repo)
libz-sys = { git = "https://github.com/rust-lang/libz-sys.git", rev = "f76b7a24ed0a71ef1b8bdac1895e8535cb2cb9c0" }

View file

@ -47,7 +47,7 @@ For more detailed build instructions, see the Servo book under [Setting up your
- Ensure that the following environment variables are set:
- `ANDROID_SDK_ROOT`
- `ANDROID_NDK_ROOT`: `$ANDROID_SDK_ROOT/ndk/25.2.9519653/`
- `ANDROID_NDK_ROOT`: `$ANDROID_SDK_ROOT/ndk/26.2.11394342/`
`ANDROID_SDK_ROOT` can be any directory (such as `~/android-sdk`).
All of the Android build dependencies will be installed there.
- Install the latest version of the [Android command-line
@ -58,7 +58,7 @@ For more detailed build instructions, see the Servo book under [Setting up your
sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install
"build-tools;33.0.2" \
"emulator" \
"ndk;25.2.9519653" \
"ndk;26.2.11394342" \
"platform-tools" \
"platforms;android-33" \
"system-images;android-33;google_apis;x86_64"

View file

@ -511,12 +511,6 @@ mod gen {
shared_memory: {
enabled: bool,
},
strict: {
debug: {
enabled: bool,
},
enabled: bool,
},
throw_on_asmjs_validation_failure: {
enabled: bool,
},

View file

@ -10,9 +10,8 @@ use std::marker::PhantomData;
use std::ptr;
use std::sync::{Arc, Mutex};
use js::jsapi::{
Heap, JSObject, JS_GetArrayBufferViewBuffer, JS_IsArrayBufferViewObject, NewExternalArrayBuffer,
};
use js::jsapi::glue::NewExternalArrayBuffer;
use js::jsapi::{Heap, JSObject, JS_GetArrayBufferViewBuffer, JS_IsArrayBufferViewObject};
use js::rust::wrappers::DetachArrayBuffer;
use js::rust::{CustomAutoRooterGuard, Handle, MutableHandleObject};
use js::typedarray::{CreateWith, TypedArray, TypedArrayElement, TypedArrayElementCreator};

View file

@ -186,7 +186,7 @@ impl ErrorInfo {
}
let filename = {
let filename = (*report)._base.filename as *const u8;
let filename = (*report)._base.filename.data_ as *const u8;
if !filename.is_null() {
let length = (0..).find(|idx| *filename.offset(*idx) == 0).unwrap();
let filename = from_raw_parts(filename, length as usize);
@ -197,7 +197,7 @@ impl ErrorInfo {
};
let lineno = (*report)._base.lineno;
let column = (*report)._base.column;
let column = (*report)._base.column._base;
let message = {
let message = (*report)._base.message_.data_ as *const u8;

View file

@ -160,6 +160,7 @@ unsafe extern "C" fn write_callback(
unsafe extern "C" fn read_transfer_callback(
cx: *mut JSContext,
_r: *mut JSStructuredCloneReader,
_policy: *const CloneDataPolicy,
tag: u32,
_content: *mut raw::c_void,
extra_data: u64,

View file

@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![allow(unused_imports)]
use core::ffi::c_void;
use std::cell::Cell;
use std::fs::{create_dir_all, read_to_string, File};
@ -19,12 +19,8 @@ use encoding_rs::Encoding;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use js::jsapi::{CanCompileOffThread, CompileToStencilOffThread1, OffThreadToken};
use js::jsval::UndefinedValue;
use js::rust::{
transform_str_to_source_text, CompileOptionsWrapper, FinishOffThreadStencil, HandleObject,
Stencil,
};
use js::rust::{transform_str_to_source_text, CompileOptionsWrapper, HandleObject, Stencil};
use net_traits::request::{
CorsSettings, CredentialsMode, Destination, ParserMetadata, RequestBuilder,
};
@ -74,7 +70,8 @@ use crate::task::TaskCanceller;
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
use crate::task_source::{TaskSource, TaskSourceName};
pub struct OffThreadCompilationContext {
// TODO Implement offthread compilation in mozjs
/*pub struct OffThreadCompilationContext {
script_element: Trusted<HTMLScriptElement>,
script_kind: ExternalScriptKind,
final_url: ServoUrl,
@ -85,14 +82,6 @@ pub struct OffThreadCompilationContext {
fetch_options: ScriptFetchOptions,
}
/// A wrapper to mark OffThreadToken as Send,
/// which should be safe according to
/// mozjs/js/public/OffThreadScriptCompilation.h
struct OffThreadCompilationToken(*mut OffThreadToken);
#[allow(unsafe_code)]
unsafe impl Send for OffThreadCompilationToken {}
#[allow(unsafe_code)]
unsafe extern "C" fn off_thread_compilation_callback(
token: *mut OffThreadToken,
@ -146,7 +135,7 @@ unsafe extern "C" fn off_thread_compilation_callback(
}),
&context.canceller,
);
}
}*/
/// An unique id for script element.
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, PartialEq)]
@ -428,9 +417,10 @@ impl FetchResponseListener for ClassicContext {
let elem = self.elem.root();
let global = elem.global();
let cx = GlobalScope::get_cx();
//let cx = GlobalScope::get_cx();
let _ar = enter_realm(&*global);
/*
let options = unsafe { CompileOptionsWrapper::new(*cx, final_url.as_str(), 1) };
let can_compile_off_thread = pref!(dom.script.asynch) &&
@ -460,15 +450,15 @@ impl FetchResponseListener for ClassicContext {
)
.is_null());
}
} else {
let load = ScriptOrigin::external(
Rc::new(DOMString::from(source_text)),
final_url.clone(),
self.fetch_options.clone(),
ScriptType::Classic,
);
finish_fetching_a_classic_script(&elem, self.kind, self.url.clone(), Ok(load));
}
} else {*/
let load = ScriptOrigin::external(
Rc::new(DOMString::from(source_text)),
final_url.clone(),
self.fetch_options.clone(),
ScriptType::Classic,
);
finish_fetching_a_classic_script(&elem, self.kind, self.url.clone(), Ok(load));
//}
}
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {

View file

@ -110,10 +110,12 @@ pub struct WebGL2RenderingContext {
default_fb_drawbuffer: Cell<u32>,
}
// TODO: This should be in mozjs
// upstream: https://searchfox.org/mozilla-central/source/js/public/ScalarType.h#66
fn typedarray_elem_size(typeid: Type) -> usize {
match typeid {
Type::Int8 | Type::Uint8 | Type::Uint8Clamped => 1,
Type::Int16 | Type::Uint16 => 2,
Type::Int16 | Type::Uint16 | Type::Float16 => 2,
Type::Int32 | Type::Uint32 | Type::Float32 => 4,
Type::Int64 | Type::Float64 => 8,
Type::BigInt64 | Type::BigUint64 => 8,

View file

@ -4965,6 +4965,7 @@ fn array_buffer_type_to_sized_type(type_: Type) -> Option<SizedDataType> {
Type::Int16 => Some(SizedDataType::Int16),
Type::Int32 => Some(SizedDataType::Int32),
Type::Float32 => Some(SizedDataType::Float32),
Type::Float16 |
Type::Float64 |
Type::BigInt64 |
Type::BigUint64 |

View file

@ -25,17 +25,18 @@ use js::glue::{
StreamConsumerNoteResponseURLs, StreamConsumerStreamEnd, StreamConsumerStreamError,
};
use js::jsapi::{
BuildIdCharVector, ContextOptionsRef, DisableIncrementalGC, Dispatchable as JSRunnable,
Dispatchable_MaybeShuttingDown, GCDescription, GCOptions, GCProgress, GCReason,
GetPromiseUserInputEventHandlingState, HandleObject, Heap, InitConsumeStreamCallback,
InitDispatchToEventLoop, JSContext as RawJSContext, JSGCParamKey, JSGCStatus,
JSJitCompilerOption, JSObject, JSSecurityCallbacks, JSTracer, JS_AddExtraGCRootsTracer,
JS_InitDestroyPrincipalsCallback, JS_InitReadPrincipalsCallback, JS_RequestInterruptCallback,
JS_SetGCCallback, JS_SetGCParameter, JS_SetGlobalJitCompilerOption,
JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled, JS_SetSecurityCallbacks,
JobQueue, MimeType, PromiseRejectionHandlingState, PromiseUserInputEventHandlingState,
SetDOMCallbacks, SetGCSliceCallback, SetJobQueue, SetPreserveWrapperCallbacks,
SetProcessBuildIdOp, SetPromiseRejectionTrackerCallback, StreamConsumer as JSStreamConsumer,
AsmJSOption, BuildIdCharVector, ContextOptionsRef, DisableIncrementalGC,
Dispatchable as JSRunnable, Dispatchable_MaybeShuttingDown, GCDescription, GCOptions,
GCProgress, GCReason, GetPromiseUserInputEventHandlingState, HandleObject, Heap,
InitConsumeStreamCallback, InitDispatchToEventLoop, JSContext as RawJSContext, JSGCParamKey,
JSGCStatus, JSJitCompilerOption, JSObject, JSSecurityCallbacks, JSTracer,
JS_AddExtraGCRootsTracer, JS_InitDestroyPrincipalsCallback, JS_InitReadPrincipalsCallback,
JS_RequestInterruptCallback, JS_SetGCCallback, JS_SetGCParameter,
JS_SetGlobalJitCompilerOption, JS_SetOffthreadIonCompilationEnabled,
JS_SetParallelParsingEnabled, JS_SetSecurityCallbacks, JobQueue, MimeType,
PromiseRejectionHandlingState, PromiseUserInputEventHandlingState, SetDOMCallbacks,
SetGCSliceCallback, SetJobQueue, SetPreserveWrapperCallbacks, SetProcessBuildIdOp,
SetPromiseRejectionTrackerCallback, StreamConsumer as JSStreamConsumer,
};
use js::jsval::UndefinedValue;
use js::panic::wrap_panic;
@ -546,7 +547,11 @@ unsafe fn new_rt_and_cx_with_parent(
JSJitCompilerOption::JSJITCOMPILER_ION_ENABLE,
pref!(js.ion.enabled) as u32,
);
cx_opts.set_asmJS_(pref!(js.asmjs.enabled));
cx_opts.compileOptions_.asmJSOption_ = if pref!(js.asmjs.enabled) {
AsmJSOption::Enabled
} else {
AsmJSOption::DisabledByAsmJSPref
};
let wasm_enabled = pref!(js.wasm.enabled);
cx_opts.set_wasm_(wasm_enabled);
if wasm_enabled {
@ -557,8 +562,6 @@ unsafe fn new_rt_and_cx_with_parent(
}
cx_opts.set_wasmBaseline_(pref!(js.wasm.baseline.enabled));
cx_opts.set_wasmIon_(pref!(js.wasm.ion.enabled));
cx_opts.set_strictMode_(pref!(js.strict.enabled));
// TODO: handle js.strict.debug.enabled
// TODO: handle js.throw_on_asmjs_validation_failure (needs new Spidermonkey)
JS_SetGlobalJitCompilerOption(
cx,

View file

@ -45,7 +45,7 @@ let
systemImageTypes = [ "google_apis" ];
abiVersions = [ "x86" "armeabi-v7a" ];
includeNDK = true;
ndkVersion = "25.2.9519653";
ndkVersion = "26.2.11394342";
useGoogleAPIs = false;
useGoogleTVAddOns = false;
includeExtras = [
@ -158,7 +158,7 @@ stdenv.mkDerivation (androidEnvironment // {
# Provide libraries that arent linked against but somehow required
LD_LIBRARY_PATH = lib.makeLibraryPath [
# Fixes missing library errors
zlib xorg.libXcursor xorg.libXrandr xorg.libXi libxkbcommon
xorg.libXcursor xorg.libXrandr xorg.libXi libxkbcommon
# [WARN script::dom::gpu] Could not get GPUAdapter ("NotFound")
# TLA Err: Error: Couldn't request WebGPU adapter.

View file

@ -569,15 +569,15 @@ class CommandBase(object):
android_api = android_platform.replace('android-', '')
# Check if the NDK version is 25
# Check if the NDK version is 26
if not os.path.isfile(path.join(env["ANDROID_NDK_ROOT"], 'source.properties')):
print("ANDROID_NDK should have file `source.properties`.")
print("The environment variable ANDROID_NDK_ROOT may be set at a wrong path.")
sys.exit(1)
with open(path.join(env["ANDROID_NDK_ROOT"], 'source.properties'), encoding="utf8") as ndk_properties:
lines = ndk_properties.readlines()
if lines[1].split(' = ')[1].split('.')[0] != '25':
print("Servo currently only supports NDK r25c.")
if lines[1].split(' = ')[1].split('.')[0] != '26':
print("Servo currently only supports NDK r26c.")
sys.exit(1)
# Android builds also require having the gcc bits on the PATH and various INCLUDE
@ -633,7 +633,7 @@ class CommandBase(object):
env['TARGET_STRIP'] = to_ndk_bin("llvm-strip")
env['RUST_FONTCONFIG_DLOPEN'] = "on"
env["LIBCLANG_PATH"] = path.join(llvm_toolchain, "lib64")
env["LIBCLANG_PATH"] = path.join(llvm_toolchain, "lib")
env["CLANG_PATH"] = to_ndk_bin("clang")
# A cheat-sheet for some of the build errors caused by getting the search path wrong...

View file

@ -91,8 +91,6 @@
"js.offthread_compilation.enabled": true,
"js.parallel_parsing.enabled": true,
"js.shared_memory.enabled": true,
"js.strict.debug.enabled": false,
"js.strict.enabled": false,
"js.throw_on_asmjs_validation_failure.enabled": false,
"js.throw_on_debuggee_would_run.enabled": false,
"js.timers.minimum_duration": 1000,

View file

@ -61,6 +61,9 @@ packages = [
"phf",
"phf_generator",
"phf_shared",
# icu (from mozjs) uses old version
"regex-automata",
]
# Files that are ignored for all tidy and lint checks.
files = [

View file

@ -1,5 +1,5 @@
NDK_TOOLCHAIN_VERSION := clang
APP_MODULES := c++_shared servojni
APP_MODULES := servojni
APP_PLATFORM := android-30
APP_STL := c++_shared
APP_ABI := armeabi-v7a x86 x86_64

View file

@ -1,3 +0,0 @@
[cross-origin-transfer-resizable-arraybuffer.html]
[postMessaging resizable ArrayBuffer to OOPIF]
expected: FAIL

View file

@ -11,39 +11,9 @@
[Object with a getter that throws]
expected: FAIL
[Resizable ArrayBuffer]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL
[Length-tracking TypedArray]
expected: FAIL
[Length-tracking DataView]
expected: FAIL
[Serializing OOB TypedArray throws]
expected: FAIL
[Serializing OOB DataView throws]
expected: FAIL
[Resizable ArrayBuffer is transferable]
expected: FAIL
[Length-tracking TypedArray is transferable]
expected: FAIL
[Length-tracking DataView is transferable]
expected: FAIL
[Transferring OOB TypedArray throws]
expected: FAIL
[Transferring OOB DataView throws]
expected: FAIL
[messagechannel.any.serviceworker.html]
expected: ERROR
@ -109,35 +79,5 @@
[Object with a getter that throws]
expected: FAIL
[Resizable ArrayBuffer]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL
[Length-tracking TypedArray]
expected: FAIL
[Length-tracking DataView]
expected: FAIL
[Serializing OOB TypedArray throws]
expected: FAIL
[Serializing OOB DataView throws]
expected: FAIL
[Resizable ArrayBuffer is transferable]
expected: FAIL
[Length-tracking TypedArray is transferable]
expected: FAIL
[Length-tracking DataView is transferable]
expected: FAIL
[Transferring OOB TypedArray throws]
expected: FAIL
[Transferring OOB DataView throws]
expected: FAIL

View file

@ -56,35 +56,5 @@
[Object with a getter that throws]
expected: FAIL
[Resizable ArrayBuffer]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL
[Length-tracking TypedArray]
expected: FAIL
[Length-tracking DataView]
expected: FAIL
[Serializing OOB TypedArray throws]
expected: FAIL
[Serializing OOB DataView throws]
expected: FAIL
[Resizable ArrayBuffer is transferable]
expected: FAIL
[Length-tracking TypedArray is transferable]
expected: FAIL
[Length-tracking DataView is transferable]
expected: FAIL
[Transferring OOB TypedArray throws]
expected: FAIL
[Transferring OOB DataView throws]
expected: FAIL

View file

@ -1,3 +0,0 @@
[instantiation-error-3.html]
[Test that unresolvable cycles lead to SyntaxError events on window and load events on script]
expected: FAIL

View file

@ -1,3 +0,0 @@
[instantiation-error-4.html]
[Test that loading a graph in which a module is already errored results in an error.]
expected: FAIL

View file

@ -1,3 +0,0 @@
[instantiation-error-5.html]
[Test that loading a graph in which a module is already errored results an error.]
expected: FAIL

View file

@ -1,5 +1,8 @@
[cleanup-prevented-with-reference.optional.any.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL
[cleanup-prevented-with-reference.optional.any.worker.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL

View file

@ -1,5 +1,8 @@
[cleanup-prevented-with-unregister.optional.any.worker.html]
expected: ERROR
[Cleanup might be prevented with an unregister usage]
expected: FAIL
[cleanup-prevented-with-unregister.optional.any.html]
expected: ERROR
[Cleanup might be prevented with an unregister usage]
expected: FAIL

View file

@ -1,5 +1,8 @@
[finalizationregistry-cleanupCallback-gets-a-microtask.optional.any.worker.html]
expected: ERROR
[HostCleanupFinalizationRegistry is an implementation-defined abstract operation that is expected to call CleanupFinalizationRegistry(finalizationRegistry) at some point in the future, if possible.]
expected: FAIL
[finalizationregistry-cleanupCallback-gets-a-microtask.optional.any.html]
expected: ERROR
[HostCleanupFinalizationRegistry is an implementation-defined abstract operation that is expected to call CleanupFinalizationRegistry(finalizationRegistry) at some point in the future, if possible.]
expected: FAIL

View file

@ -1,2 +0,0 @@
[finalizationregistry-cleanupCallback-throws-onerror-interaction.optional.window.html]
expected: ERROR

View file

@ -1,5 +1,8 @@
[gc-has-one-chance-to-call-cleanupCallback-queueMicrotask.optional.any.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL
[gc-has-one-chance-to-call-cleanupCallback-queueMicrotask.optional.any.worker.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL

View file

@ -1,2 +1,3 @@
[gc-has-one-chance-to-call-cleanupCallback-queueMicrotaskMutationObserver.optional.window.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL

View file

@ -1,5 +1,8 @@
[gc-has-one-chance-to-call-cleanupCallback.optional.any.worker.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL
[gc-has-one-chance-to-call-cleanupCallback.optional.any.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL

View file

@ -1,5 +1,8 @@
[reentrancy.optional.any.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL
[reentrancy.optional.any.worker.html]
expected: ERROR
[cleanupCallback has only one optional chance to be called for a GC that cleans up a registered target.]
expected: FAIL

View file

@ -1,5 +1,8 @@
[return-undefined-with-gc.optional.any.html]
expected: ERROR
[Return undefined regardless the result of CleanupFinalizationRegistry]
expected: FAIL
[return-undefined-with-gc.optional.any.worker.html]
expected: ERROR
[Return undefined regardless the result of CleanupFinalizationRegistry]
expected: FAIL

View file

@ -1,5 +1,8 @@
[unregister-cleaned-up-cell.optional.any.html]
expected: ERROR
[Cannot unregister a cell that has been cleaned up]
expected: FAIL
[unregister-cleaned-up-cell.optional.any.worker.html]
expected: ERROR
[Cannot unregister a cell that has been cleaned up]
expected: FAIL

View file

@ -1,5 +0,0 @@
[casts.tentative.any.worker.html]
expected: ERROR
[casts.tentative.any.html]
expected: ERROR

View file

@ -1,5 +0,0 @@
[exported-object.tentative.any.worker.html]
expected: ERROR
[exported-object.tentative.any.html]
expected: ERROR

View file

@ -1,5 +0,0 @@
[i31.tentative.any.html]
expected: ERROR
[i31.tentative.any.worker.html]
expected: ERROR

View file

@ -1,8 +1,10 @@
[garbage-collected.tentative.any.html]
expected: TIMEOUT
[Entangled port is garbage collected, and the close event is fired.]
expected: FAIL
expected: TIMEOUT
[garbage-collected.tentative.any.worker.html]
expected: TIMEOUT
[Entangled port is garbage collected, and the close event is fired.]
expected: FAIL
expected: TIMEOUT

View file

@ -53,38 +53,8 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[Resizable ArrayBuffer]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL
[Length-tracking TypedArray]
expected: FAIL
[Length-tracking DataView]
expected: FAIL
[Serializing OOB TypedArray throws]
expected: FAIL
[Serializing OOB DataView throws]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED
[Resizable ArrayBuffer is transferable]
expected: FAIL
[Length-tracking TypedArray is transferable]
expected: FAIL
[Length-tracking DataView is transferable]
expected: FAIL
[Transferring OOB TypedArray throws]
expected: FAIL
[Transferring OOB DataView throws]
expected: FAIL

View file

@ -10500,7 +10500,7 @@
[]
],
"interfaces.js": [
"e37397aa973f5fb913e5b8097945368c2848bed8",
"8e67ede99ce211fb6fe7891a103e2da9c774cc53",
[]
],
"nested_asap_script.js": [
@ -13441,7 +13441,7 @@
]
],
"interfaces.worker.js": [
"2f048af52b8f807c24cf2b9f6d68e42f1eab2abd",
"b1c7b7e9c5c2f21eafdcd27eafe589e654260628",
[
"mozilla/interfaces.worker.html",
{}

View file

@ -18,6 +18,7 @@ function test_interfaces(interfaceNamesInGlobalScope) {
"Date",
"Error",
"EvalError",
"FinalizationRegistry",
"Float32Array",
"Float64Array",
"Function",
@ -54,6 +55,7 @@ function test_interfaces(interfaceNamesInGlobalScope) {
"Uint8Array",
"Uint8ClampedArray",
"WeakMap",
"WeakRef",
"WeakSet",
"WebAssembly",
];

View file

@ -33,6 +33,7 @@ test_interfaces([
"FileList",
"FileReader",
"FileReaderSync",
"FinalizationRegistry",
"FontFaceSet",
"FormData",
"Headers",
@ -59,6 +60,7 @@ test_interfaces([
"URL",
"URLSearchParams",
"WebSocket",
"WeakRef",
"Worker",
"WorkerGlobalScope",
"WorkerLocation",