diff options
author | CYBAI <cyb.ai.815@gmail.com> | 2020-07-11 22:44:21 +0900 |
---|---|---|
committer | CYBAI <cyb.ai.815@gmail.com> | 2020-07-18 00:43:34 +0900 |
commit | d1715918f058649b3a637a53c2cd920740b2eb37 (patch) | |
tree | 6f5754a503b246a0a96b2efe8bcab5e33b95a51b /components/script/devtools.rs | |
parent | 99e832a345ae09cdf78b72fb4e37e64194e4cf42 (diff) | |
download | servo-d1715918f058649b3a637a53c2cd920740b2eb37.tar.gz servo-d1715918f058649b3a637a53c2cd920740b2eb37.zip |
Set private reference for classic script
Web developers can use `Dynamic Import` in a classic script; thus, we
need to save the script's private reference so that we can reuse it when
we're going to fetch a dynamic import module for a classic script.
Besides, because it's possible to use different executing context for a
dynamic import module (like `dynamic-import/string-compilation-other-document.html` WPT test),
we can't initialize a module owner at the timing of `SetScriptPrivate`;
thus, if the private module script doesn't hold an owner, we'll use a
DynamicImport owner for it.
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r-- | components/script/devtools.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 2aad7d101c7..cb5dfa27b7f 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -16,6 +16,7 @@ use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::node::{window_from_node, Node, ShadowIncluding}; use crate::realms::enter_realm; +use crate::script_module::ScriptFetchOptions; use crate::script_thread::Documents; use devtools_traits::{AutoMargins, ComputedNodeLayout, TimelineMarkerType}; use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker}; @@ -34,7 +35,14 @@ pub fn handle_evaluate_js(global: &GlobalScope, eval: String, reply: IpcSender<E let cx = global.get_cx(); let _ac = enter_realm(global); rooted!(in(*cx) let mut rval = UndefinedValue()); - global.evaluate_script_on_global_with_result(&eval, "<eval>", rval.handle_mut(), 1); + global.evaluate_script_on_global_with_result( + &eval, + "<eval>", + rval.handle_mut(), + 1, + ScriptFetchOptions::default_classic_script(&global), + global.api_base_url(), + ); if rval.is_undefined() { EvaluateJSReply::VoidValue |