From c9b1f35a3647704ece1e20fbbc299a6f381c66ec Mon Sep 17 00:00:00 2001 From: Samson <16504129+sagudev@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:07:38 +0200 Subject: [PATCH] Update mozjs to a version that includes SpiderMonkey ESR 115 (#30379) * Update mozjs to sm115 * fix module stuff https://phabricator.services.mozilla.com/D163949 * fix always allow cloning https://bugzilla.mozilla.org/show_bug.cgi?id=1774866 * Update expectations toStringTag now works on wasm object due to SM bump --- Cargo.lock | 29 ++++++++++-- .../script/dom/bindings/structuredclone.rs | 2 - components/script/script_module.rs | 44 +++++-------------- .../jsapi/constructor/toStringTag.any.js.ini | 27 ------------ .../jsapi/constructor/toStringTag.any.js.ini | 26 ----------- 5 files changed, 35 insertions(+), 93 deletions(-) delete mode 100644 tests/wpt/meta-legacy-layout/wasm/jsapi/constructor/toStringTag.any.js.ini delete mode 100644 tests/wpt/meta/wasm/jsapi/constructor/toStringTag.any.js.ini diff --git a/Cargo.lock b/Cargo.lock index 88d8d828537..4255f7f8d43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -397,6 +397,27 @@ dependencies = [ "which", ] +[[package]] +name = "bindgen" +version = "0.68.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" +dependencies = [ + "bitflags 2.4.0", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.32", + "which", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -3680,9 +3701,9 @@ checksum = "903970ae2f248d7275214cf8f387f8ba0c4ea7e3d87a320e85493db60ce28616" [[package]] name = "mozjs" version = "0.14.1" -source = "git+https://github.com/servo/mozjs#d7f6f30cb9bfd3e7e4d1ff7d605059369acdf25d" +source = "git+https://github.com/servo/mozjs#72bd691611dc857dba93fa0df41c4f26088411e7" dependencies = [ - "bindgen 0.66.1", + "bindgen 0.68.1", "cc", "lazy_static", "libc", @@ -3694,9 +3715,9 @@ dependencies = [ [[package]] name = "mozjs_sys" version = "0.68.2" -source = "git+https://github.com/servo/mozjs#d7f6f30cb9bfd3e7e4d1ff7d605059369acdf25d" +source = "git+https://github.com/servo/mozjs#72bd691611dc857dba93fa0df41c4f26088411e7" dependencies = [ - "bindgen 0.66.1", + "bindgen 0.68.1", "cc", "encoding_c", "encoding_c_mem", diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index 5de0569bcf7..3ed7c60e500 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -304,7 +304,6 @@ pub fn write( let policy = CloneDataPolicy { allowIntraClusterClonableSharedObjects_: false, allowSharedMemoryObjects_: false, - allowErrorStackFrames_: false, }; let result = JS_WriteStructuredClone( *cx, @@ -381,7 +380,6 @@ pub fn read( &CloneDataPolicy { allowIntraClusterClonableSharedObjects_: false, allowSharedMemoryObjects_: false, - allowErrorStackFrames_: false, }, &STRUCTURED_CLONE_CALLBACKS, sc_holder_ptr as *mut raw::c_void, diff --git a/components/script/script_module.rs b/components/script/script_module.rs index ac829e244b7..b44db1323e1 100644 --- a/components/script/script_module.rs +++ b/components/script/script_module.rs @@ -19,17 +19,16 @@ use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsapi::{ CompileModule1, ExceptionStackBehavior, FinishDynamicModuleImport, GetModuleRequestSpecifier, - GetModuleResolveHook, GetRequestedModules, Handle as RawHandle, HandleObject, - HandleValue as RawHandleValue, Heap, JSAutoRealm, JSContext, JSObject, JSRuntime, JSString, - JS_ClearPendingException, JS_DefineProperty4, JS_IsExceptionPending, JS_NewStringCopyN, - ModuleErrorBehaviour, ModuleEvaluate, ModuleLink, MutableHandleValue, - SetModuleDynamicImportHook, SetModuleMetadataHook, SetModulePrivate, SetModuleResolveHook, - SetScriptPrivateReferenceHooks, ThrowOnModuleEvaluationFailure, Value, JSPROP_ENUMERATE, + GetModuleResolveHook, GetRequestedModuleSpecifier, GetRequestedModulesCount, + Handle as RawHandle, HandleObject, HandleValue as RawHandleValue, Heap, JSAutoRealm, JSContext, + JSObject, JSRuntime, JSString, JS_ClearPendingException, JS_DefineProperty4, + JS_IsExceptionPending, JS_NewStringCopyN, ModuleErrorBehaviour, ModuleEvaluate, ModuleLink, + MutableHandleValue, SetModuleDynamicImportHook, SetModuleMetadataHook, SetModulePrivate, + SetModuleResolveHook, SetScriptPrivateReferenceHooks, ThrowOnModuleEvaluationFailure, Value, + JSPROP_ENUMERATE, }; use js::jsval::{JSVal, PrivateValue, UndefinedValue}; -use js::rust::jsapi_wrapped::{ - GetArrayLength, GetRequestedModuleSpecifier, JS_GetElement, JS_GetPendingException, -}; +use js::rust::jsapi_wrapped::JS_GetPendingException; use js::rust::wrappers::JS_SetPendingException; use js::rust::{ transform_str_to_source_text, CompileOptionsWrapper, Handle, HandleValue, IntoHandle, @@ -568,34 +567,11 @@ impl ModuleTree { let mut specifier_urls = IndexSet::new(); unsafe { - rooted!(in(*cx) let requested_modules = GetRequestedModules(*cx, module_object)); - - let mut length = 0; - - if !GetArrayLength(*cx, requested_modules.handle(), &mut length) { - let module_length_error = - gen_type_error(&global, "Wrong length of requested modules".to_owned()); - - return Err(module_length_error); - } + let length = GetRequestedModulesCount(*cx, module_object); for index in 0..length { - rooted!(in(*cx) let mut element = UndefinedValue()); - - if !JS_GetElement( - *cx, - requested_modules.handle(), - index, - &mut element.handle_mut(), - ) { - let get_element_error = - gen_type_error(&global, "Failed to get requested module".to_owned()); - - return Err(get_element_error); - } - rooted!(in(*cx) let specifier = GetRequestedModuleSpecifier( - *cx, element.handle() + *cx, module_object, index )); let url = ModuleTree::resolve_module_specifier( diff --git a/tests/wpt/meta-legacy-layout/wasm/jsapi/constructor/toStringTag.any.js.ini b/tests/wpt/meta-legacy-layout/wasm/jsapi/constructor/toStringTag.any.js.ini deleted file mode 100644 index db8cdf491d7..00000000000 --- a/tests/wpt/meta-legacy-layout/wasm/jsapi/constructor/toStringTag.any.js.ini +++ /dev/null @@ -1,27 +0,0 @@ -[toStringTag.any.html] - [Object.prototype.toString applied to the namespace object] - expected: FAIL - - [Object.prototype.toString applied after deleting @@toStringTag] - expected: FAIL - - [@@toStringTag exists on the namespace object with the appropriate descriptor] - expected: FAIL - - [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] - expected: FAIL - - -[toStringTag.any.worker.html] - [Object.prototype.toString applied to the namespace object] - expected: FAIL - - [Object.prototype.toString applied after deleting @@toStringTag] - expected: FAIL - - [@@toStringTag exists on the namespace object with the appropriate descriptor] - expected: FAIL - - [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] - expected: FAIL - diff --git a/tests/wpt/meta/wasm/jsapi/constructor/toStringTag.any.js.ini b/tests/wpt/meta/wasm/jsapi/constructor/toStringTag.any.js.ini deleted file mode 100644 index 1a96ace92c4..00000000000 --- a/tests/wpt/meta/wasm/jsapi/constructor/toStringTag.any.js.ini +++ /dev/null @@ -1,26 +0,0 @@ -[toStringTag.any.html] - [Object.prototype.toString applied after deleting @@toStringTag] - expected: FAIL - - [@@toStringTag exists on the namespace object with the appropriate descriptor] - expected: FAIL - - [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] - expected: FAIL - - [Object.prototype.toString applied to the namespace object] - expected: FAIL - - -[toStringTag.any.worker.html] - [Object.prototype.toString applied after deleting @@toStringTag] - expected: FAIL - - [@@toStringTag exists on the namespace object with the appropriate descriptor] - expected: FAIL - - [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] - expected: FAIL - - [Object.prototype.toString applied to the namespace object] - expected: FAIL