mirror of
https://github.com/servo/servo.git
synced 2025-06-17 12:54:28 +00:00
Use JS_GetScriptPrivate to get a mutated return value
Because MSVC uses a different calling conventions for functions that return non-POD values, we need to use the new exposed wrapper function so that `GetScriptPrivate` can be handled correctly on Windows.
This commit is contained in:
parent
08723b0e37
commit
419cd53561
2 changed files with 7 additions and 4 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -3572,7 +3572,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs"
|
name = "mozjs"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#0caf5549cddbb34ad16abf35fb6bfbff824a4d14"
|
source = "git+https://github.com/servo/rust-mozjs#716dede8811ed525d9aab1e44cea392609b35d0a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|
|
@ -79,15 +79,15 @@ use ipc_channel::ipc::{self, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::glue::{IsWrapper, UnwrapObjectDynamic};
|
use js::glue::{IsWrapper, UnwrapObjectDynamic};
|
||||||
use js::jsapi::Compile1;
|
use js::jsapi::Compile1;
|
||||||
|
use js::jsapi::SetScriptPrivate;
|
||||||
use js::jsapi::{CurrentGlobalOrNull, GetNonCCWObjectGlobal};
|
use js::jsapi::{CurrentGlobalOrNull, GetNonCCWObjectGlobal};
|
||||||
use js::jsapi::{GetScriptPrivate, SetScriptPrivate};
|
|
||||||
use js::jsapi::{HandleObject, Heap};
|
use js::jsapi::{HandleObject, Heap};
|
||||||
use js::jsapi::{JSContext, JSObject};
|
use js::jsapi::{JSContext, JSObject};
|
||||||
use js::jsval::PrivateValue;
|
use js::jsval::PrivateValue;
|
||||||
use js::jsval::{JSVal, UndefinedValue};
|
use js::jsval::{JSVal, UndefinedValue};
|
||||||
use js::panic::maybe_resume_unwind;
|
use js::panic::maybe_resume_unwind;
|
||||||
use js::rust::transform_str_to_source_text;
|
use js::rust::transform_str_to_source_text;
|
||||||
use js::rust::wrappers::JS_ExecuteScript;
|
use js::rust::wrappers::{JS_ExecuteScript, JS_GetScriptPrivate};
|
||||||
use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
|
use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
|
||||||
use js::rust::{HandleValue, MutableHandleValue};
|
use js::rust::{HandleValue, MutableHandleValue};
|
||||||
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
||||||
|
@ -2603,9 +2603,12 @@ impl GlobalScope {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rooted!(in(*cx) let mut script_private = UndefinedValue());
|
||||||
|
JS_GetScriptPrivate(*compiled_script, script_private.handle_mut());
|
||||||
|
|
||||||
// When `ScriptPrivate` for the compiled script is undefined,
|
// When `ScriptPrivate` for the compiled script is undefined,
|
||||||
// we need to set it so that it can be used in dynamic import context.
|
// we need to set it so that it can be used in dynamic import context.
|
||||||
if GetScriptPrivate(*compiled_script).is_undefined() {
|
if script_private.is_undefined() {
|
||||||
debug!("Set script private for {}", script_base_url);
|
debug!("Set script private for {}", script_base_url);
|
||||||
|
|
||||||
let module_script_data = Rc::new(ModuleScript::new(
|
let module_script_data = Rc::new(ModuleScript::new(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue