mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
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.
This commit is contained in:
parent
99e832a345
commit
d1715918f0
10 changed files with 204 additions and 71 deletions
|
@ -11,6 +11,7 @@ use crate::dom::paintworkletglobalscope::PaintWorkletTask;
|
|||
use crate::dom::testworkletglobalscope::TestWorkletGlobalScope;
|
||||
use crate::dom::testworkletglobalscope::TestWorkletTask;
|
||||
use crate::dom::worklet::WorkletExecutor;
|
||||
use crate::script_module::ScriptFetchOptions;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_thread::MainThreadScriptMsg;
|
||||
use crossbeam_channel::Sender;
|
||||
|
@ -88,10 +89,14 @@ impl WorkletGlobalScope {
|
|||
|
||||
/// Evaluate a JS script in this global.
|
||||
pub fn evaluate_js(&self, script: &str) -> bool {
|
||||
debug!("Evaluating Dom.");
|
||||
debug!("Evaluating Dom in a worklet.");
|
||||
rooted!(in (*self.globalscope.get_cx()) let mut rval = UndefinedValue());
|
||||
self.globalscope
|
||||
.evaluate_js_on_global_with_result(&*script, rval.handle_mut())
|
||||
self.globalscope.evaluate_js_on_global_with_result(
|
||||
&*script,
|
||||
rval.handle_mut(),
|
||||
ScriptFetchOptions::default_classic_script(&self.globalscope),
|
||||
self.globalscope.api_base_url(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Register a paint worklet to the script thread.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue