aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorCYBAI <cyb.ai.815@gmail.com>2020-07-11 22:44:21 +0900
committerCYBAI <cyb.ai.815@gmail.com>2020-07-18 00:43:34 +0900
commitd1715918f058649b3a637a53c2cd920740b2eb37 (patch)
tree6f5754a503b246a0a96b2efe8bcab5e33b95a51b /components/script/timers.rs
parent99e832a345ae09cdf78b72fb4e37e64194e4cf42 (diff)
downloadservo-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/timers.rs')
-rw-r--r--components/script/timers.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 5e236f07494..ebc0bd8874c 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -12,6 +12,7 @@ use crate::dom::eventsource::EventSourceTimeoutCallback;
use crate::dom::globalscope::GlobalScope;
use crate::dom::testbinding::TestBindingCallback;
use crate::dom::xmlhttprequest::XHRTimeoutCallback;
+use crate::script_module::ScriptFetchOptions;
use crate::script_thread::ScriptThread;
use euclid::Length;
use ipc_channel::ipc::IpcSender;
@@ -541,7 +542,13 @@ impl JsTimerTask {
let global = this.global();
let cx = global.get_cx();
rooted!(in(*cx) let mut rval = UndefinedValue());
- global.evaluate_js_on_global_with_result(code_str, rval.handle_mut());
+ // FIXME(cybai): Use base url properly by saving private reference for timers (#27260)
+ global.evaluate_js_on_global_with_result(
+ code_str,
+ rval.handle_mut(),
+ ScriptFetchOptions::default_classic_script(&global),
+ global.api_base_url(),
+ );
},
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
let arguments = self.collect_heap_args(arguments);