mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Wrap(Global)Method now takes a SafeJSContext instead of a JSContext
as first argument.
This commit is contained in:
parent
cd0eb88a3e
commit
35dc5320ab
10 changed files with 55 additions and 37 deletions
|
@ -2618,17 +2618,17 @@ def CreateBindingJSObject(descriptor):
|
||||||
if descriptor.proxy:
|
if descriptor.proxy:
|
||||||
create += """
|
create += """
|
||||||
let handler = RegisterBindings::PROXY_HANDLERS[PrototypeList::Proxies::%s as usize];
|
let handler = RegisterBindings::PROXY_HANDLERS[PrototypeList::Proxies::%s as usize];
|
||||||
rooted!(in(cx) let private = PrivateValue(raw as *const libc::c_void));
|
rooted!(in(*cx) let private = PrivateValue(raw as *const libc::c_void));
|
||||||
let obj = NewProxyObject(cx, handler,
|
let obj = NewProxyObject(*cx, handler,
|
||||||
Handle::from_raw(UndefinedHandleValue),
|
Handle::from_raw(UndefinedHandleValue),
|
||||||
proto.get());
|
proto.get());
|
||||||
assert!(!obj.is_null());
|
assert!(!obj.is_null());
|
||||||
SetProxyReservedSlot(obj, 0, &private.get());
|
SetProxyReservedSlot(obj, 0, &private.get());
|
||||||
rooted!(in(cx) let obj = obj);\
|
rooted!(in(*cx) let obj = obj);\
|
||||||
""" % (descriptor.name)
|
""" % (descriptor.name)
|
||||||
else:
|
else:
|
||||||
create += ("rooted!(in(cx) let obj = JS_NewObjectWithGivenProto(\n"
|
create += ("rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(\n"
|
||||||
" cx, &Class.base as *const JSClass, proto.handle()));\n"
|
" *cx, &Class.base as *const JSClass, proto.handle()));\n"
|
||||||
"assert!(!obj.is_null());\n"
|
"assert!(!obj.is_null());\n"
|
||||||
"\n"
|
"\n"
|
||||||
"let val = PrivateValue(raw as *const libc::c_void);\n"
|
"let val = PrivateValue(raw as *const libc::c_void);\n"
|
||||||
|
@ -2676,8 +2676,8 @@ def CopyUnforgeablePropertiesToInstance(descriptor):
|
||||||
# reflector, so we can make sure we don't get confused by named getters.
|
# reflector, so we can make sure we don't get confused by named getters.
|
||||||
if descriptor.proxy:
|
if descriptor.proxy:
|
||||||
copyCode += """\
|
copyCode += """\
|
||||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||||
ensure_expando_object(cx, obj.handle().into(), expando.handle_mut());
|
ensure_expando_object(*cx, obj.handle().into(), expando.handle_mut());
|
||||||
"""
|
"""
|
||||||
obj = "expando"
|
obj = "expando"
|
||||||
else:
|
else:
|
||||||
|
@ -2693,9 +2693,9 @@ ensure_expando_object(cx, obj.handle().into(), expando.handle_mut());
|
||||||
copyCode += """\
|
copyCode += """\
|
||||||
let mut slot = UndefinedValue();
|
let mut slot = UndefinedValue();
|
||||||
JS_GetReservedSlot(proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
|
JS_GetReservedSlot(proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
|
||||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
|
rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
|
||||||
unforgeable_holder.handle_mut().set(slot.to_object());
|
unforgeable_holder.handle_mut().set(slot.to_object());
|
||||||
assert!(%(copyFunc)s(cx, %(obj)s.handle(), unforgeable_holder.handle()));
|
assert!(%(copyFunc)s(*cx, %(obj)s.handle(), unforgeable_holder.handle()));
|
||||||
""" % {'copyFunc': copyFunc, 'obj': obj}
|
""" % {'copyFunc': copyFunc, 'obj': obj}
|
||||||
|
|
||||||
return copyCode
|
return copyCode
|
||||||
|
@ -2709,7 +2709,7 @@ class CGWrapMethod(CGAbstractMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
assert not descriptor.interface.isCallback()
|
assert not descriptor.interface.isCallback()
|
||||||
assert not descriptor.isGlobal()
|
assert not descriptor.isGlobal()
|
||||||
args = [Argument('*mut JSContext', 'cx'),
|
args = [Argument('SafeJSContext', 'cx'),
|
||||||
Argument('&GlobalScope', 'scope'),
|
Argument('&GlobalScope', 'scope'),
|
||||||
Argument("Box<%s>" % descriptor.concreteType, 'object')]
|
Argument("Box<%s>" % descriptor.concreteType, 'object')]
|
||||||
retval = 'DomRoot<%s>' % descriptor.concreteType
|
retval = 'DomRoot<%s>' % descriptor.concreteType
|
||||||
|
@ -2724,9 +2724,9 @@ let scope = scope.reflector().get_jsobject();
|
||||||
assert!(!scope.get().is_null());
|
assert!(!scope.get().is_null());
|
||||||
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||||
|
|
||||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||||
let _ac = JSAutoRealm::new(cx, scope.get());
|
let _ac = JSAutoRealm::new(*cx, scope.get());
|
||||||
GetProtoObject(cx, scope, proto.handle_mut());
|
GetProtoObject(*cx, scope, proto.handle_mut());
|
||||||
assert!(!proto.is_null());
|
assert!(!proto.is_null());
|
||||||
|
|
||||||
%(createObject)s
|
%(createObject)s
|
||||||
|
@ -2744,7 +2744,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
||||||
def __init__(self, descriptor, properties):
|
def __init__(self, descriptor, properties):
|
||||||
assert not descriptor.interface.isCallback()
|
assert not descriptor.interface.isCallback()
|
||||||
assert descriptor.isGlobal()
|
assert descriptor.isGlobal()
|
||||||
args = [Argument('*mut JSContext', 'cx'),
|
args = [Argument('SafeJSContext', 'cx'),
|
||||||
Argument("Box<%s>" % descriptor.concreteType, 'object')]
|
Argument("Box<%s>" % descriptor.concreteType, 'object')]
|
||||||
retval = 'DomRoot<%s>' % descriptor.concreteType
|
retval = 'DomRoot<%s>' % descriptor.concreteType
|
||||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
|
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
|
||||||
|
@ -2761,7 +2761,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
||||||
("define_guarded_methods", self.properties.methods),
|
("define_guarded_methods", self.properties.methods),
|
||||||
("define_guarded_constants", self.properties.consts)
|
("define_guarded_constants", self.properties.consts)
|
||||||
]
|
]
|
||||||
members = ["%s(cx, obj.handle(), %s, obj.handle());" % (function, array.variableName())
|
members = ["%s(*cx, obj.handle(), %s, obj.handle());" % (function, array.variableName())
|
||||||
for (function, array) in pairs if array.length() > 0]
|
for (function, array) in pairs if array.length() > 0]
|
||||||
values["members"] = "\n".join(members)
|
values["members"] = "\n".join(members)
|
||||||
|
|
||||||
|
@ -2769,9 +2769,9 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
||||||
let raw = Box::into_raw(object);
|
let raw = Box::into_raw(object);
|
||||||
let _rt = RootedTraceable::new(&*raw);
|
let _rt = RootedTraceable::new(&*raw);
|
||||||
|
|
||||||
rooted!(in(cx) let mut obj = ptr::null_mut::<JSObject>());
|
rooted!(in(*cx) let mut obj = ptr::null_mut::<JSObject>());
|
||||||
create_global_object(
|
create_global_object(
|
||||||
cx,
|
*cx,
|
||||||
&Class.base,
|
&Class.base,
|
||||||
raw as *const libc::c_void,
|
raw as *const libc::c_void,
|
||||||
_trace,
|
_trace,
|
||||||
|
@ -2780,12 +2780,12 @@ assert!(!obj.is_null());
|
||||||
|
|
||||||
(*raw).init_reflector(obj.get());
|
(*raw).init_reflector(obj.get());
|
||||||
|
|
||||||
let _ac = JSAutoRealm::new(cx, obj.get());
|
let _ac = JSAutoRealm::new(*cx, obj.get());
|
||||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||||
GetProtoObject(cx, obj.handle(), proto.handle_mut());
|
GetProtoObject(*cx, obj.handle(), proto.handle_mut());
|
||||||
assert!(JS_SplicePrototype(cx, obj.handle(), proto.handle()));
|
assert!(JS_SplicePrototype(*cx, obj.handle(), proto.handle()));
|
||||||
let mut immutable = false;
|
let mut immutable = false;
|
||||||
assert!(JS_SetImmutablePrototype(cx, obj.handle(), &mut immutable));
|
assert!(JS_SetImmutablePrototype(*cx, obj.handle(), &mut immutable));
|
||||||
assert!(immutable);
|
assert!(immutable);
|
||||||
|
|
||||||
%(members)s
|
%(members)s
|
||||||
|
@ -6022,6 +6022,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
||||||
'std::rc::Rc',
|
'std::rc::Rc',
|
||||||
'std::default::Default',
|
'std::default::Default',
|
||||||
'std::ffi::CString',
|
'std::ffi::CString',
|
||||||
|
'std::ops::Deref',
|
||||||
], config)
|
], config)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox};
|
use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use crate::script_runtime::JSContext as SafeJSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::conversions::ToJSValConvertible;
|
use js::conversions::ToJSValConvertible;
|
||||||
use js::jsapi::{Heap, JSContext, JSObject};
|
use js::jsapi::{Heap, JSContext, JSObject};
|
||||||
|
@ -62,7 +63,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
iterable: &T,
|
iterable: &T,
|
||||||
type_: IteratorType,
|
type_: IteratorType,
|
||||||
wrap: unsafe fn(*mut JSContext, &GlobalScope, Box<IterableIterator<T>>) -> DomRoot<Self>,
|
wrap: unsafe fn(SafeJSContext, &GlobalScope, Box<IterableIterator<T>>) -> DomRoot<Self>,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
let iterator = Box::new(IterableIterator {
|
let iterator = Box::new(IterableIterator {
|
||||||
reflector: Reflector::new(),
|
reflector: Reflector::new(),
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
use crate::dom::bindings::conversions::DerivedFrom;
|
use crate::dom::bindings::conversions::DerivedFrom;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use js::jsapi::{Heap, JSContext, JSObject};
|
use crate::script_runtime::JSContext as SafeJSContext;
|
||||||
|
use js::jsapi::{Heap, JSObject};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
|
@ -16,14 +17,20 @@ use std::default::Default;
|
||||||
pub fn reflect_dom_object<T, U>(
|
pub fn reflect_dom_object<T, U>(
|
||||||
obj: Box<T>,
|
obj: Box<T>,
|
||||||
global: &U,
|
global: &U,
|
||||||
wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box<T>) -> DomRoot<T>,
|
wrap_fn: unsafe fn(SafeJSContext, &GlobalScope, Box<T>) -> DomRoot<T>,
|
||||||
) -> DomRoot<T>
|
) -> DomRoot<T>
|
||||||
where
|
where
|
||||||
T: DomObject,
|
T: DomObject,
|
||||||
U: DerivedFrom<GlobalScope>,
|
U: DerivedFrom<GlobalScope>,
|
||||||
{
|
{
|
||||||
let global_scope = global.upcast();
|
let global_scope = global.upcast();
|
||||||
unsafe { wrap_fn(global_scope.get_cx(), global_scope, obj) }
|
unsafe {
|
||||||
|
wrap_fn(
|
||||||
|
SafeJSContext::from_ptr(global_scope.get_cx()),
|
||||||
|
global_scope,
|
||||||
|
obj,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A struct to store a reference to the reflector of a DOM object.
|
/// A struct to store a reference to the reflector of a DOM object.
|
||||||
|
|
|
@ -26,7 +26,9 @@ use crate::dom::worker::{TrustedWorkerAddress, Worker};
|
||||||
use crate::dom::workerglobalscope::WorkerGlobalScope;
|
use crate::dom::workerglobalscope::WorkerGlobalScope;
|
||||||
use crate::fetch::load_whole_resource;
|
use crate::fetch::load_whole_resource;
|
||||||
use crate::script_runtime::ScriptThreadEventCategory::WorkerEvent;
|
use crate::script_runtime::ScriptThreadEventCategory::WorkerEvent;
|
||||||
use crate::script_runtime::{new_child_runtime, CommonScriptMsg, Runtime, ScriptChan, ScriptPort};
|
use crate::script_runtime::{
|
||||||
|
new_child_runtime, CommonScriptMsg, JSContext as SafeJSContext, Runtime, ScriptChan, ScriptPort,
|
||||||
|
};
|
||||||
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
||||||
use crate::task_source::TaskSourceName;
|
use crate::task_source::TaskSourceName;
|
||||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||||
|
@ -283,7 +285,7 @@ impl DedicatedWorkerGlobalScope {
|
||||||
closing,
|
closing,
|
||||||
image_cache,
|
image_cache,
|
||||||
));
|
));
|
||||||
unsafe { DedicatedWorkerGlobalScopeBinding::Wrap(cx, scope) }
|
unsafe { DedicatedWorkerGlobalScopeBinding::Wrap(SafeJSContext::from_ptr(cx), scope) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::structuredclone::StructuredCloneData;
|
||||||
use crate::dom::dissimilaroriginlocation::DissimilarOriginLocation;
|
use crate::dom::dissimilaroriginlocation::DissimilarOriginLocation;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::windowproxy::WindowProxy;
|
use crate::dom::windowproxy::WindowProxy;
|
||||||
|
use crate::script_runtime::JSContext as SafeJSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use js::jsapi::JSContext;
|
use js::jsapi::JSContext;
|
||||||
|
@ -68,7 +69,7 @@ impl DissimilarOriginWindow {
|
||||||
window_proxy: Dom::from_ref(window_proxy),
|
window_proxy: Dom::from_ref(window_proxy),
|
||||||
location: Default::default(),
|
location: Default::default(),
|
||||||
});
|
});
|
||||||
unsafe { DissimilarOriginWindowBinding::Wrap(cx, win) }
|
unsafe { DissimilarOriginWindowBinding::Wrap(SafeJSContext::from_ptr(cx), win) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn window_proxy(&self) -> DomRoot<WindowProxy> {
|
pub fn window_proxy(&self) -> DomRoot<WindowProxy> {
|
||||||
|
|
|
@ -60,13 +60,14 @@ use crate::dom::svgsvgelement::{LayoutSVGSVGElementHelpers, SVGSVGElement};
|
||||||
use crate::dom::text::Text;
|
use crate::dom::text::Text;
|
||||||
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
|
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
use crate::script_runtime::JSContext;
|
||||||
use crate::script_thread::ScriptThread;
|
use crate::script_thread::ScriptThread;
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use devtools_traits::NodeInfo;
|
use devtools_traits::NodeInfo;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
|
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
|
||||||
use html5ever::{Namespace, Prefix, QualName};
|
use html5ever::{Namespace, Prefix, QualName};
|
||||||
use js::jsapi::{JSContext, JSObject, JSRuntime};
|
use js::jsapi::{JSObject, JSRuntime};
|
||||||
use libc::{self, c_void, uintptr_t};
|
use libc::{self, c_void, uintptr_t};
|
||||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||||
|
@ -1630,7 +1631,7 @@ impl Node {
|
||||||
pub fn reflect_node<N>(
|
pub fn reflect_node<N>(
|
||||||
node: Box<N>,
|
node: Box<N>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box<N>) -> DomRoot<N>,
|
wrap_fn: unsafe fn(JSContext, &GlobalScope, Box<N>) -> DomRoot<N>,
|
||||||
) -> DomRoot<N>
|
) -> DomRoot<N>
|
||||||
where
|
where
|
||||||
N: DerivedFrom<Node> + DomObject,
|
N: DerivedFrom<Node> + DomObject,
|
||||||
|
|
|
@ -23,6 +23,7 @@ use crate::dom::worklet::WorkletExecutor;
|
||||||
use crate::dom::workletglobalscope::WorkletGlobalScope;
|
use crate::dom::workletglobalscope::WorkletGlobalScope;
|
||||||
use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
|
use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
|
||||||
use crate::dom::workletglobalscope::WorkletTask;
|
use crate::dom::workletglobalscope::WorkletTask;
|
||||||
|
use crate::script_runtime::JSContext;
|
||||||
use crossbeam_channel::{unbounded, Sender};
|
use crossbeam_channel::{unbounded, Sender};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::Scale;
|
use euclid::Scale;
|
||||||
|
@ -128,7 +129,7 @@ impl PaintWorkletGlobalScope {
|
||||||
missing_image_urls: Vec::new(),
|
missing_image_urls: Vec::new(),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
unsafe { PaintWorkletGlobalScopeBinding::Wrap(runtime.cx(), global) }
|
unsafe { PaintWorkletGlobalScopeBinding::Wrap(JSContext::from_ptr(runtime.cx()), global) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn image_cache(&self) -> Arc<dyn ImageCache> {
|
pub fn image_cache(&self) -> Arc<dyn ImageCache> {
|
||||||
|
|
|
@ -21,7 +21,9 @@ use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::worker::TrustedWorkerAddress;
|
use crate::dom::worker::TrustedWorkerAddress;
|
||||||
use crate::dom::workerglobalscope::WorkerGlobalScope;
|
use crate::dom::workerglobalscope::WorkerGlobalScope;
|
||||||
use crate::fetch::load_whole_resource;
|
use crate::fetch::load_whole_resource;
|
||||||
use crate::script_runtime::{new_rt_and_cx, CommonScriptMsg, Runtime, ScriptChan};
|
use crate::script_runtime::{
|
||||||
|
new_rt_and_cx, CommonScriptMsg, JSContext as SafeJSContext, Runtime, ScriptChan,
|
||||||
|
};
|
||||||
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
||||||
use crate::task_source::TaskSourceName;
|
use crate::task_source::TaskSourceName;
|
||||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||||
|
@ -246,7 +248,7 @@ impl ServiceWorkerGlobalScope {
|
||||||
swmanager_sender,
|
swmanager_sender,
|
||||||
scope_url,
|
scope_url,
|
||||||
));
|
));
|
||||||
unsafe { ServiceWorkerGlobalScopeBinding::Wrap(cx, scope) }
|
unsafe { ServiceWorkerGlobalScopeBinding::Wrap(SafeJSContext::from_ptr(cx), scope) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::worklet::WorkletExecutor;
|
use crate::dom::worklet::WorkletExecutor;
|
||||||
use crate::dom::workletglobalscope::WorkletGlobalScope;
|
use crate::dom::workletglobalscope::WorkletGlobalScope;
|
||||||
use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
|
use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
|
||||||
|
use crate::script_runtime::JSContext;
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::rust::Runtime;
|
use js::rust::Runtime;
|
||||||
|
@ -49,7 +50,7 @@ impl TestWorkletGlobalScope {
|
||||||
),
|
),
|
||||||
lookup_table: Default::default(),
|
lookup_table: Default::default(),
|
||||||
});
|
});
|
||||||
unsafe { TestWorkletGlobalScopeBinding::Wrap(runtime.cx(), global) }
|
unsafe { TestWorkletGlobalScopeBinding::Wrap(JSContext::from_ptr(runtime.cx()), global) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn perform_a_worklet_task(&self, task: TestWorkletTask) {
|
pub fn perform_a_worklet_task(&self, task: TestWorkletTask) {
|
||||||
|
|
|
@ -57,7 +57,8 @@ use crate::fetch;
|
||||||
use crate::layout_image::fetch_image_for_layout;
|
use crate::layout_image::fetch_image_for_layout;
|
||||||
use crate::microtask::MicrotaskQueue;
|
use crate::microtask::MicrotaskQueue;
|
||||||
use crate::script_runtime::{
|
use crate::script_runtime::{
|
||||||
CommonScriptMsg, Runtime, ScriptChan, ScriptPort, ScriptThreadEventCategory,
|
CommonScriptMsg, JSContext as SafeJSContext, Runtime, ScriptChan, ScriptPort,
|
||||||
|
ScriptThreadEventCategory,
|
||||||
};
|
};
|
||||||
use crate::script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg};
|
use crate::script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg};
|
||||||
use crate::script_thread::{ScriptThread, SendableMainThreadScriptChan};
|
use crate::script_thread::{ScriptThread, SendableMainThreadScriptChan};
|
||||||
|
@ -2179,7 +2180,7 @@ impl Window {
|
||||||
player_context,
|
player_context,
|
||||||
});
|
});
|
||||||
|
|
||||||
unsafe { WindowBinding::Wrap(runtime.cx(), win) }
|
unsafe { WindowBinding::Wrap(SafeJSContext::from_ptr(runtime.cx()), win) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pipeline_id(&self) -> Option<PipelineId> {
|
pub fn pipeline_id(&self) -> Option<PipelineId> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue