mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -245,7 +245,7 @@ impl CallSetup {
|
|||
if let Some(window) = global.downcast::<Window>() {
|
||||
window.Document().ensure_safe_to_run_script_or_layout();
|
||||
}
|
||||
let cx = global.get_cx();
|
||||
let cx = GlobalScope::get_cx();
|
||||
|
||||
let aes = AutoEntryScript::new(&global);
|
||||
let ais = callback.incumbent().map(AutoIncumbentScript::new);
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ pub fn read(
|
|||
mut data: StructuredSerializedData,
|
||||
rval: MutableHandleValue,
|
||||
) -> Result<Vec<DomRoot<MessagePort>>, ()> {
|
||||
let cx = global.get_cx();
|
||||
let cx = GlobalScope::get_cx();
|
||||
let _ac = enter_realm(&*global);
|
||||
let mut sc_holder = StructuredDataHolder::Read {
|
||||
blobs: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue