aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_module.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2021-01-24 14:07:10 -0500
committerJosh Matthews <josh@joshmatthews.net>2021-02-18 09:35:45 -0500
commit5c4939599e2793154569b19db87be8cc05ca9269 (patch)
treed159222463bf786b64f6e1a30b443e631f4e1b4c /components/script/script_module.rs
parent4c82d3cb861d00e63a08fb987631817bfc7ce07c (diff)
downloadservo-5c4939599e2793154569b19db87be8cc05ca9269.tar.gz
servo-5c4939599e2793154569b19db87be8cc05ca9269.zip
Update mozjs.
Diffstat (limited to 'components/script/script_module.rs')
-rw-r--r--components/script/script_module.rs34
1 files changed, 23 insertions, 11 deletions
diff --git a/components/script/script_module.rs b/components/script/script_module.rs
index bbd17ec57a3..1535b1dd96f 100644
--- a/components/script/script_module.rs
+++ b/components/script/script_module.rs
@@ -45,17 +45,17 @@ use js::jsapi::Handle as RawHandle;
use js::jsapi::HandleObject;
use js::jsapi::HandleValue as RawHandleValue;
use js::jsapi::Value;
-use js::jsapi::{CompileModuleDontInflate, ExceptionStackBehavior, FinishDynamicModuleImport};
+use js::jsapi::{CompileModule1, ExceptionStackBehavior, FinishDynamicModuleImport};
+use js::jsapi::{DynamicImportStatus, SetModuleDynamicImportHook, SetScriptPrivateReferenceHooks};
use js::jsapi::{GetModuleResolveHook, JSRuntime, SetModuleResolveHook};
use js::jsapi::{GetRequestedModules, SetModuleMetadataHook};
use js::jsapi::{Heap, JSContext, JS_ClearPendingException, SetModulePrivate};
use js::jsapi::{JSAutoRealm, JSObject, JSString};
use js::jsapi::{JS_DefineProperty4, JS_IsExceptionPending, JS_NewStringCopyN, JSPROP_ENUMERATE};
use js::jsapi::{ModuleEvaluate, ModuleInstantiate};
-use js::jsapi::{SetModuleDynamicImportHook, SetScriptPrivateReferenceHooks};
use js::jsval::{JSVal, PrivateValue, UndefinedValue};
+use js::rust::jsapi_wrapped::{GetArrayLength, JS_GetElement};
use js::rust::jsapi_wrapped::{GetRequestedModuleSpecifier, JS_GetPendingException};
-use js::rust::jsapi_wrapped::{JS_GetArrayLength, JS_GetElement};
use js::rust::transform_str_to_source_text;
use js::rust::wrappers::JS_SetPendingException;
use js::rust::CompileOptionsWrapper;
@@ -425,7 +425,7 @@ impl ModuleTree {
unsafe { CompileOptionsWrapper::new(*global.get_cx(), url.as_str(), 1) };
unsafe {
- rooted!(in(*global.get_cx()) let mut module_script = CompileModuleDontInflate(
+ rooted!(in(*global.get_cx()) let mut module_script = CompileModule1(
*global.get_cx(),
compile_options.ptr,
&mut transform_str_to_source_text(&module_script_text),
@@ -558,7 +558,7 @@ impl ModuleTree {
let mut length = 0;
- if !JS_GetArrayLength(*global.get_cx(), requested_modules.handle(), &mut length) {
+ if !GetArrayLength(*global.get_cx(), requested_modules.handle(), &mut length) {
let module_length_error =
gen_type_error(&global, "Wrong length of requested modules".to_owned());
@@ -995,26 +995,38 @@ impl ModuleOwner {
};
// Ensure any failures related to importing this dynamic module are immediately reported.
- match (network_error, existing_rethrow_error, execution_err) {
+ let status = match (network_error, existing_rethrow_error, execution_err) {
(Some(_), _, _) => unsafe {
let err = gen_type_error(&global, "Dynamic import failed".to_owned());
- JS_SetPendingException(*cx, err.handle(), ExceptionStackBehavior::Capture)
+ JS_SetPendingException(*cx, err.handle(), ExceptionStackBehavior::Capture);
+ DynamicImportStatus::Failed
},
(None, _, Some(execution_err)) => unsafe {
- JS_SetPendingException(*cx, execution_err.handle(), ExceptionStackBehavior::Capture)
+ JS_SetPendingException(
+ *cx,
+ execution_err.handle(),
+ ExceptionStackBehavior::Capture,
+ );
+ DynamicImportStatus::Failed
},
(None, Some(rethrow_error), _) => unsafe {
- JS_SetPendingException(*cx, rethrow_error.handle(), ExceptionStackBehavior::Capture)
+ JS_SetPendingException(
+ *cx,
+ rethrow_error.handle(),
+ ExceptionStackBehavior::Capture,
+ );
+ DynamicImportStatus::Failed
},
// do nothing if there's no errors
- (None, None, None) => {},
- }
+ (None, None, None) => DynamicImportStatus::Ok,
+ };
debug!("Finishing dynamic import for {:?}", module_identity);
unsafe {
FinishDynamicModuleImport(
*cx,
+ status,
module.referencing_private.handle(),
module.specifier.handle(),
module.promise.reflector().get_jsobject().into_handle(),