mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Make GlobalScope.get_cx a static method.
This commit is contained in:
parent
4998c65c42
commit
f79e1e327d
39 changed files with 132 additions and 127 deletions
|
@ -9,6 +9,7 @@ use crate::dom::bindings::iterable::{Iterable, IterableIterator};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot, Root};
|
||||
use crate::dom::bindings::trace::JSTraceable;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::realms::AlreadyInRealm;
|
||||
use crate::script_runtime::JSContext;
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use js::rust::HandleObject;
|
||||
|
@ -22,7 +23,7 @@ where
|
|||
U: DerivedFrom<GlobalScope>,
|
||||
{
|
||||
let global_scope = global.upcast();
|
||||
unsafe { T::WRAP(global_scope.get_cx(), global_scope, obj) }
|
||||
unsafe { T::WRAP(GlobalScope::get_cx(), global_scope, obj) }
|
||||
}
|
||||
|
||||
/// A struct to store a reference to the reflector of a DOM object.
|
||||
|
@ -82,7 +83,8 @@ pub trait DomObject: JSTraceable + 'static {
|
|||
where
|
||||
Self: Sized,
|
||||
{
|
||||
GlobalScope::from_reflector(self)
|
||||
let realm = AlreadyInRealm::assert_for_cx(GlobalScope::get_cx());
|
||||
GlobalScope::from_reflector(self, &realm)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue