mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Reintroduce parent runtimes for worker threads.
This commit is contained in:
parent
644101e1e4
commit
367014a4ea
7 changed files with 49 additions and 14 deletions
|
@ -47,7 +47,7 @@ use js::jsapi::{HandleObject, Heap};
|
|||
use js::jsapi::{JSAutoCompartment, JSContext};
|
||||
use js::panic::maybe_resume_unwind;
|
||||
use js::rust::wrappers::Evaluate2;
|
||||
use js::rust::{get_object_class, CompileOptionsWrapper, Runtime};
|
||||
use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
|
||||
use js::rust::{HandleValue, MutableHandleValue};
|
||||
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -711,6 +711,16 @@ impl GlobalScope {
|
|||
unreachable!();
|
||||
}
|
||||
|
||||
pub fn runtime_handle(&self) -> ParentRuntime {
|
||||
if self.is::<Window>() {
|
||||
ScriptThread::runtime_handle()
|
||||
} else if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
worker.runtime_handle()
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the ["current"] global object.
|
||||
///
|
||||
/// ["current"]: https://html.spec.whatwg.org/multipage/#current
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue