aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_module.rs
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-09-20 18:07:38 +0200
committerGitHub <noreply@github.com>2023-09-20 16:07:38 +0000
commitc9b1f35a3647704ece1e20fbbc299a6f381c66ec (patch)
tree63b3eab3c8f05d6cc6219a8e95f23861dce0698e /components/script/script_module.rs
parentc2502120cf51f335c24f444d0f8f3cba8d328431 (diff)
downloadservo-c9b1f35a3647704ece1e20fbbc299a6f381c66ec.tar.gz
servo-c9b1f35a3647704ece1e20fbbc299a6f381c66ec.zip
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
Diffstat (limited to 'components/script/script_module.rs')
-rw-r--r--components/script/script_module.rs44
1 files changed, 10 insertions, 34 deletions
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(