mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Updated reflect_dom_object to be passed by value
This commit is contained in:
parent
9cea3ce266
commit
2cbf5a3671
51 changed files with 75 additions and 75 deletions
|
@ -110,7 +110,7 @@ impl Attr {
|
|||
name: Atom, namespace: Namespace,
|
||||
prefix: Option<DOMString>, owner: Option<JSRef<Element>>) -> Temporary<Attr> {
|
||||
reflect_dom_object(box Attr::new_inherited(local_name, value, name, namespace, prefix, owner),
|
||||
&global::Window(window), AttrBinding::Wrap)
|
||||
global::Window(window), AttrBinding::Wrap)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -49,7 +49,7 @@ pub type ErrorResult = Fallible<()>;
|
|||
pub fn throw_dom_exception(cx: *mut JSContext, global: &GlobalRef,
|
||||
result: Error) {
|
||||
assert!(unsafe { JS_IsExceptionPending(cx) } == 0);
|
||||
let exception = DOMException::new_from_error(global, result).root();
|
||||
let exception = DOMException::new_from_error(*global, result).root();
|
||||
let thrown = exception.to_jsval(cx);
|
||||
unsafe {
|
||||
JS_SetPendingException(cx, thrown);
|
||||
|
|
|
@ -441,10 +441,10 @@ pub trait Reflectable {
|
|||
/// reflector.
|
||||
pub fn reflect_dom_object<T: Reflectable>
|
||||
(obj: Box<T>,
|
||||
global: &GlobalRef,
|
||||
global: GlobalRef,
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, &GlobalRef, Box<T>) -> Temporary<T>)
|
||||
-> Temporary<T> {
|
||||
wrap_fn(global.get_cx(), global, obj)
|
||||
wrap_fn(global.get_cx(), &global, obj)
|
||||
}
|
||||
|
||||
/// A struct to store a reference to the reflector of a DOM object.
|
||||
|
|
|
@ -29,14 +29,14 @@ impl Blob {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<Blob> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<Blob> {
|
||||
reflect_dom_object(box Blob::new_inherited(),
|
||||
global,
|
||||
BlobBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Blob>> {
|
||||
Ok(Blob::new(global))
|
||||
Ok(Blob::new(*global))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ impl CanvasRenderingContext2D {
|
|||
|
||||
pub fn new(global: &GlobalRef, canvas: JSRef<HTMLCanvasElement>, size: Size2D<i32>) -> Temporary<CanvasRenderingContext2D> {
|
||||
reflect_dom_object(box CanvasRenderingContext2D::new_inherited(global, canvas, size),
|
||||
global, CanvasRenderingContext2DBinding::Wrap)
|
||||
*global, CanvasRenderingContext2DBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn recreate(&self, size: Size2D<i32>) {
|
||||
|
|
|
@ -21,7 +21,7 @@ impl Console {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<Console> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<Console> {
|
||||
reflect_dom_object(box Console::new_inherited(), global, ConsoleBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,13 +37,13 @@ impl CustomEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_uninitialized(global: &GlobalRef) -> Temporary<CustomEvent> {
|
||||
pub fn new_uninitialized(global: GlobalRef) -> Temporary<CustomEvent> {
|
||||
reflect_dom_object(box CustomEvent::new_inherited(CustomEventTypeId),
|
||||
global,
|
||||
CustomEventBinding::Wrap)
|
||||
}
|
||||
pub fn new(global: &GlobalRef, type_: DOMString, bubbles: bool, cancelable: bool, detail: JSVal) -> Temporary<CustomEvent> {
|
||||
let ev = CustomEvent::new_uninitialized(global).root();
|
||||
let ev = CustomEvent::new_uninitialized(*global).root();
|
||||
ev.InitCustomEvent(global.get_cx(), type_, bubbles, cancelable, detail);
|
||||
Temporary::from_rooted(*ev)
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
ptr::null(), ptr::null_mut()) != 0);
|
||||
}
|
||||
|
||||
MessageEvent::dispatch_jsval(target, &global::Worker(scope), message);
|
||||
MessageEvent::dispatch_jsval(target, global::Worker(scope), message);
|
||||
global.delayed_release_worker();
|
||||
},
|
||||
Ok(XHRProgressMsg(addr, progress)) => {
|
||||
|
|
|
@ -331,7 +331,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
self.ready_state.set(state);
|
||||
|
||||
let window = self.window.root();
|
||||
let event = Event::new(&global::Window(*window), "readystatechange".to_string(),
|
||||
let event = Event::new(global::Window(*window), "readystatechange".to_string(),
|
||||
DoesNotBubble, NotCancelable).root();
|
||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||
let _ = target.DispatchEvent(*event);
|
||||
|
@ -440,7 +440,7 @@ impl Document {
|
|||
source: DocumentSource) -> Temporary<Document> {
|
||||
let document = reflect_dom_object(box Document::new_inherited(window, url, doctype,
|
||||
content_type, source),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
DocumentBinding::Wrap).root();
|
||||
|
||||
let node: JSRef<Node> = NodeCast::from_ref(*document);
|
||||
|
@ -711,9 +711,9 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
"mouseevents" | "mouseevent" => Ok(EventCast::from_temporary(
|
||||
MouseEvent::new_uninitialized(*window))),
|
||||
"customevent" => Ok(EventCast::from_temporary(
|
||||
CustomEvent::new_uninitialized(&global::Window(*window)))),
|
||||
CustomEvent::new_uninitialized(global::Window(*window)))),
|
||||
"htmlevents" | "events" | "event" => Ok(Event::new_uninitialized(
|
||||
&global::Window(*window))),
|
||||
global::Window(*window))),
|
||||
"keyboardevent" | "keyevents" => Ok(EventCast::from_temporary(
|
||||
KeyboardEvent::new_uninitialized(*window))),
|
||||
_ => Err(NotSupported)
|
||||
|
|
|
@ -75,11 +75,11 @@ impl DOMException {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, code: DOMErrorName) -> Temporary<DOMException> {
|
||||
pub fn new(global: GlobalRef, code: DOMErrorName) -> Temporary<DOMException> {
|
||||
reflect_dom_object(box DOMException::new_inherited(code), global, DOMExceptionBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn new_from_error(global: &GlobalRef, code: Error) -> Temporary<DOMException> {
|
||||
pub fn new_from_error(global: GlobalRef, code: Error) -> Temporary<DOMException> {
|
||||
DOMException::new(global, DOMErrorName::from_error(code))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ impl DOMImplementation {
|
|||
pub fn new(document: JSRef<Document>) -> Temporary<DOMImplementation> {
|
||||
let window = document.window().root();
|
||||
reflect_dom_object(box DOMImplementation::new_inherited(document),
|
||||
&Window(*window),
|
||||
Window(*window),
|
||||
DOMImplementationBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl DOMParser {
|
|||
}
|
||||
|
||||
pub fn new(window: JSRef<Window>) -> Temporary<DOMParser> {
|
||||
reflect_dom_object(box DOMParser::new_inherited(window), &global::Window(window),
|
||||
reflect_dom_object(box DOMParser::new_inherited(window), global::Window(window),
|
||||
DOMParserBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ impl DOMRect {
|
|||
top: Au, bottom: Au,
|
||||
left: Au, right: Au) -> Temporary<DOMRect> {
|
||||
reflect_dom_object(box DOMRect::new_inherited(top, bottom, left, right),
|
||||
&global::Window(window), DOMRectBinding::Wrap)
|
||||
global::Window(window), DOMRectBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ impl DOMRectList {
|
|||
pub fn new(window: JSRef<Window>,
|
||||
rects: Vec<JSRef<DOMRect>>) -> Temporary<DOMRectList> {
|
||||
reflect_dom_object(box DOMRectList::new_inherited(window, rects),
|
||||
&global::Window(window), DOMRectListBinding::Wrap)
|
||||
global::Window(window), DOMRectListBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ impl DOMStringMap {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<DOMStringMap> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<DOMStringMap> {
|
||||
reflect_dom_object(box DOMStringMap::new_inherited(),
|
||||
global, DOMStringMapBinding::Wrap)
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ impl DOMTokenList {
|
|||
pub fn new(element: JSRef<Element>, local_name: &Atom) -> Temporary<DOMTokenList> {
|
||||
let window = window_from_node(element).root();
|
||||
reflect_dom_object(box DOMTokenList::new_inherited(element, local_name.clone()),
|
||||
&Window(*window),
|
||||
Window(*window),
|
||||
DOMTokenListBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,13 +88,13 @@ impl Event {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_uninitialized(global: &GlobalRef) -> Temporary<Event> {
|
||||
pub fn new_uninitialized(global: GlobalRef) -> Temporary<Event> {
|
||||
reflect_dom_object(box Event::new_inherited(HTMLEventTypeId),
|
||||
global,
|
||||
EventBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef,
|
||||
pub fn new(global: GlobalRef,
|
||||
type_: DOMString,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable) -> Temporary<Event> {
|
||||
|
@ -108,7 +108,7 @@ impl Event {
|
|||
init: &EventBinding::EventInit) -> Fallible<Temporary<Event>> {
|
||||
let bubbles = if init.bubbles { Bubbles } else { DoesNotBubble };
|
||||
let cancelable = if init.cancelable { Cancelable } else { NotCancelable };
|
||||
Ok(Event::new(global, type_, bubbles, cancelable))
|
||||
Ok(Event::new(*global, type_, bubbles, cancelable))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -28,7 +28,7 @@ impl File {
|
|||
// the relevant subfields of file_bits should be copied over
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
|
||||
pub fn new(global: GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
|
||||
reflect_dom_object(box File::new_inherited(file_bits, name),
|
||||
global,
|
||||
FileBinding::Wrap)
|
||||
|
|
|
@ -46,7 +46,7 @@ impl FormData {
|
|||
|
||||
pub fn new(form: Option<JSRef<HTMLFormElement>>, global: &GlobalRef) -> Temporary<FormData> {
|
||||
reflect_dom_object(box FormData::new_inherited(form, global),
|
||||
global, FormDataBinding::Wrap)
|
||||
*global, FormDataBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {
|
||||
|
@ -121,6 +121,6 @@ impl PrivateFormDataHelpers for FormData {
|
|||
let global = self.global.root();
|
||||
let f: Option<JSRef<File>> = FileCast::to_ref(value);
|
||||
let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".to_string()));
|
||||
File::new(&global.root_ref(), value, name)
|
||||
File::new(global.root_ref(), value, name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ impl HTMLCollection {
|
|||
|
||||
pub fn new(window: JSRef<Window>, collection: CollectionTypeId) -> Temporary<HTMLCollection> {
|
||||
reflect_dom_object(box HTMLCollection::new_inherited(collection),
|
||||
&global::Window(window), HTMLCollectionBinding::Wrap)
|
||||
global::Window(window), HTMLCollectionBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
|||
let base = doc.url();
|
||||
// TODO: Handle browsing contexts
|
||||
// TODO: Handle validation
|
||||
let event = Event::new(&Window(*win),
|
||||
let event = Event::new(Window(*win),
|
||||
"submit".to_string(),
|
||||
Bubbles, Cancelable).root();
|
||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||
|
|
|
@ -61,7 +61,7 @@ impl KeyboardEvent {
|
|||
|
||||
pub fn new_uninitialized(window: JSRef<Window>) -> Temporary<KeyboardEvent> {
|
||||
reflect_dom_object(box KeyboardEvent::new_inherited(),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
KeyboardEventBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ impl Location {
|
|||
|
||||
pub fn new(window: JSRef<Window>, page: Rc<Page>) -> Temporary<Location> {
|
||||
reflect_dom_object(box Location::new_inherited(page),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
LocationBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ impl MessageEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, type_: DOMString,
|
||||
pub fn new(global: GlobalRef, type_: DOMString,
|
||||
bubbles: bool, cancelable: bool,
|
||||
data: JSVal, origin: DOMString, lastEventId: DOMString)
|
||||
-> Temporary<MessageEvent> {
|
||||
|
@ -59,7 +59,7 @@ impl MessageEvent {
|
|||
type_: DOMString,
|
||||
init: &MessageEventBinding::MessageEventInit)
|
||||
-> Fallible<Temporary<MessageEvent>> {
|
||||
let ev = MessageEvent::new(global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
let ev = MessageEvent::new(*global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
init.data, init.origin.clone(), init.lastEventId.clone());
|
||||
Ok(ev)
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ impl MessageEvent {
|
|||
|
||||
impl MessageEvent {
|
||||
pub fn dispatch_jsval(target: JSRef<EventTarget>,
|
||||
scope: &GlobalRef,
|
||||
scope: GlobalRef,
|
||||
message: JSVal) {
|
||||
let messageevent = MessageEvent::new(
|
||||
scope, "message".to_string(), false, false, message,
|
||||
|
|
|
@ -59,7 +59,7 @@ impl MouseEvent {
|
|||
|
||||
pub fn new_uninitialized(window: JSRef<Window>) -> Temporary<MouseEvent> {
|
||||
reflect_dom_object(box MouseEvent::new_inherited(),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
MouseEventBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ impl NamedNodeMap {
|
|||
|
||||
pub fn new(window: JSRef<Window>, elem: JSRef<Element>) -> Temporary<NamedNodeMap> {
|
||||
reflect_dom_object(box NamedNodeMap::new_inherited(elem),
|
||||
&global::Window(window), NamedNodeMapBinding::Wrap)
|
||||
global::Window(window), NamedNodeMapBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Navigator {
|
|||
|
||||
pub fn new(window: JSRef<Window>) -> Temporary<Navigator> {
|
||||
reflect_dom_object(box Navigator::new_inherited(),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
NavigatorBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1118,7 +1118,7 @@ impl Node {
|
|||
wrap_fn: extern "Rust" fn(*mut JSContext, &GlobalRef, Box<N>) -> Temporary<N>)
|
||||
-> Temporary<N> {
|
||||
let window = document.window().root();
|
||||
reflect_dom_object(node, &global::Window(*window), wrap_fn)
|
||||
reflect_dom_object(node, global::Window(*window), wrap_fn)
|
||||
}
|
||||
|
||||
pub fn new_inherited(type_id: NodeTypeId, doc: JSRef<Document>) -> Node {
|
||||
|
|
|
@ -20,7 +20,7 @@ impl NodeIterator {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<NodeIterator> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<NodeIterator> {
|
||||
reflect_dom_object(box NodeIterator::new_inherited(), global, NodeIteratorBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ impl NodeList {
|
|||
pub fn new(window: JSRef<Window>,
|
||||
list_type: NodeListType) -> Temporary<NodeList> {
|
||||
reflect_dom_object(box NodeList::new_inherited(list_type),
|
||||
&global::Window(window), NodeListBinding::Wrap)
|
||||
global::Window(window), NodeListBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn new_simple_list(window: JSRef<Window>, elements: Vec<JSRef<Node>>) -> Temporary<NodeList> {
|
||||
|
|
|
@ -29,7 +29,7 @@ impl Performance {
|
|||
|
||||
pub fn new(window: JSRef<Window>) -> Temporary<Performance> {
|
||||
reflect_dom_object(box Performance::new_inherited(window),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
PerformanceBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ impl PerformanceTiming {
|
|||
pub fn new(window: JSRef<Window>) -> Temporary<PerformanceTiming> {
|
||||
let timing = PerformanceTiming::new_inherited(window.navigation_start(),
|
||||
window.navigation_start_precise());
|
||||
reflect_dom_object(box timing, &global::Window(window),
|
||||
reflect_dom_object(box timing, global::Window(window),
|
||||
PerformanceTimingBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ impl ProgressEvent {
|
|||
total: total
|
||||
}
|
||||
}
|
||||
pub fn new(global: &GlobalRef, type_: DOMString,
|
||||
pub fn new(global: GlobalRef, type_: DOMString,
|
||||
can_bubble: bool, cancelable: bool,
|
||||
length_computable: bool, loaded: u64, total: u64) -> Temporary<ProgressEvent> {
|
||||
let ev = reflect_dom_object(box ProgressEvent::new_inherited(length_computable, loaded, total),
|
||||
|
@ -50,7 +50,7 @@ impl ProgressEvent {
|
|||
type_: DOMString,
|
||||
init: &ProgressEventBinding::ProgressEventInit)
|
||||
-> Fallible<Temporary<ProgressEvent>> {
|
||||
let ev = ProgressEvent::new(global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
let ev = ProgressEvent::new(*global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
init.lengthComputable, init.loaded, init.total);
|
||||
Ok(ev)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ impl Range {
|
|||
pub fn new(document: JSRef<Document>) -> Temporary<Range> {
|
||||
let window = document.window().root();
|
||||
reflect_dom_object(box Range::new_inherited(),
|
||||
&Window(*window),
|
||||
Window(*window),
|
||||
RangeBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ impl Screen {
|
|||
|
||||
pub fn new(window: JSRef<Window>) -> Temporary<Screen> {
|
||||
reflect_dom_object(box Screen::new_inherited(),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
ScreenBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ impl ServoHTMLParser {
|
|||
tokenizer: DOMRefCell::new(tok),
|
||||
};
|
||||
|
||||
reflect_dom_object(box parser, &global::Window(*window), ServoHTMLParserBinding::Wrap)
|
||||
reflect_dom_object(box parser, global::Window(*window), ServoHTMLParserBinding::Wrap)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -21,7 +21,7 @@ impl Storage {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<Storage> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<Storage> {
|
||||
reflect_dom_object(box Storage::new_inherited(), global, StorageBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn SetEnumAttribute(self, _: TestEnum) {}
|
||||
fn InterfaceAttribute(self) -> Temporary<Blob> {
|
||||
let global = self.global.root();
|
||||
Blob::new(&global.root_ref())
|
||||
Blob::new(global.root_ref())
|
||||
}
|
||||
fn SetInterfaceAttribute(self, _: JSRef<Blob>) {}
|
||||
fn UnionAttribute(self) -> HTMLElementOrLong { eLong(0) }
|
||||
|
@ -96,7 +96,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn GetEnumAttributeNullable(self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn GetInterfaceAttributeNullable(self) -> Option<Temporary<Blob>> {
|
||||
let global = self.global.root();
|
||||
Some(Blob::new(&global.root_ref()))
|
||||
Some(Blob::new(global.root_ref()))
|
||||
}
|
||||
fn SetInterfaceAttributeNullable(self, _: Option<JSRef<Blob>>) {}
|
||||
fn GetUnionAttributeNullable(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
|
@ -120,7 +120,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn ReceiveEnum(self) -> TestEnum { _empty }
|
||||
fn ReceiveInterface(self) -> Temporary<Blob> {
|
||||
let global = self.global.root();
|
||||
Blob::new(&global.root_ref())
|
||||
Blob::new(global.root_ref())
|
||||
}
|
||||
fn ReceiveAny(self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||
fn ReceiveUnion(self) -> HTMLElementOrLong { eLong(0) }
|
||||
|
@ -142,7 +142,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
|||
fn ReceiveNullableEnum(self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn ReceiveNullableInterface(self) -> Option<Temporary<Blob>> {
|
||||
let global = self.global.root();
|
||||
Some(Blob::new(&global.root_ref()))
|
||||
Some(Blob::new(global.root_ref()))
|
||||
}
|
||||
fn ReceiveNullableUnion(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
fn ReceiveNullableUnion2(self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
||||
|
|
|
@ -49,7 +49,7 @@ impl TreeWalker {
|
|||
filter: Filter) -> Temporary<TreeWalker> {
|
||||
let window = document.window().root();
|
||||
reflect_dom_object(box TreeWalker::new_inherited(root_node, what_to_show, filter),
|
||||
&Window(*window),
|
||||
Window(*window),
|
||||
TreeWalkerBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ impl UIEvent {
|
|||
|
||||
pub fn new_uninitialized(window: JSRef<Window>) -> Temporary<UIEvent> {
|
||||
reflect_dom_object(box UIEvent::new_inherited(UIEventTypeId),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
UIEventBinding::Wrap)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ impl URLSearchParams {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<URLSearchParams> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<URLSearchParams> {
|
||||
reflect_dom_object(box URLSearchParams::new_inherited(), global, URLSearchParamsBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, init: Option<StringOrURLSearchParams>) -> Fallible<Temporary<URLSearchParams>> {
|
||||
let usp = URLSearchParams::new(global).root();
|
||||
let usp = URLSearchParams::new(*global).root();
|
||||
match init {
|
||||
Some(eString(_s)) => {
|
||||
// XXXManishearth we need to parse the input here
|
||||
|
|
|
@ -24,7 +24,7 @@ impl ValidityState {
|
|||
|
||||
pub fn new(window: JSRef<Window>) -> Temporary<ValidityState> {
|
||||
reflect_dom_object(box ValidityState::new_inherited(),
|
||||
&global::Window(window),
|
||||
global::Window(window),
|
||||
ValidityStateBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ impl WebSocket {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef, url: DOMString) -> Temporary<WebSocket> {
|
||||
pub fn new(global: GlobalRef, url: DOMString) -> Temporary<WebSocket> {
|
||||
reflect_dom_object(box WebSocket::new_inherited(url),
|
||||
global,
|
||||
WebSocketBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef, url: DOMString) -> Fallible<Temporary<WebSocket>> {
|
||||
Ok(WebSocket::new(global, url))
|
||||
Ok(WebSocket::new(*global, url))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
|
||||
fn Console(self) -> Temporary<Console> {
|
||||
if self.console.get().is_none() {
|
||||
let console = Console::new(&global::Window(self));
|
||||
let console = Console::new(global::Window(self));
|
||||
self.console.assign(Some(console));
|
||||
}
|
||||
self.console.get().unwrap()
|
||||
|
|
|
@ -53,7 +53,7 @@ impl Worker {
|
|||
|
||||
pub fn new(global: &GlobalRef, sender: ScriptChan) -> Temporary<Worker> {
|
||||
reflect_dom_object(box Worker::new_inherited(global, sender),
|
||||
global,
|
||||
*global,
|
||||
WorkerBinding::Wrap)
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ impl Worker {
|
|||
}
|
||||
|
||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(*worker);
|
||||
MessageEvent::dispatch_jsval(target, &global.root_ref(), message);
|
||||
MessageEvent::dispatch_jsval(target, global.root_ref(), message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
|||
|
||||
fn Console(self) -> Temporary<Console> {
|
||||
if self.console.get().is_none() {
|
||||
let console = Console::new(&global::Worker(self));
|
||||
let console = Console::new(global::Worker(self));
|
||||
self.console.assign(Some(console));
|
||||
}
|
||||
self.console.get().unwrap()
|
||||
|
|
|
@ -30,7 +30,7 @@ impl WorkerLocation {
|
|||
|
||||
pub fn new(global: JSRef<WorkerGlobalScope>, url: Url) -> Temporary<WorkerLocation> {
|
||||
reflect_dom_object(box WorkerLocation::new_inherited(url),
|
||||
&Worker(global),
|
||||
Worker(global),
|
||||
WorkerLocationBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ impl WorkerNavigator {
|
|||
|
||||
pub fn new(global: JSRef<WorkerGlobalScope>) -> Temporary<WorkerNavigator> {
|
||||
reflect_dom_object(box WorkerNavigator::new_inherited(),
|
||||
&Worker(global),
|
||||
Worker(global),
|
||||
WorkerNavigatorBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ impl XMLHttpRequest {
|
|||
ready_state: Cell::new(Unsent),
|
||||
timeout: Cell::new(0u32),
|
||||
with_credentials: Cell::new(false),
|
||||
upload: JS::from_rooted(XMLHttpRequestUpload::new(global)),
|
||||
upload: JS::from_rooted(XMLHttpRequestUpload::new(*global)),
|
||||
response_url: "".to_string(),
|
||||
status: Cell::new(0),
|
||||
status_text: DOMRefCell::new(ByteString::new(vec!())),
|
||||
|
@ -187,7 +187,7 @@ impl XMLHttpRequest {
|
|||
}
|
||||
pub fn new(global: &GlobalRef) -> Temporary<XMLHttpRequest> {
|
||||
reflect_dom_object(box XMLHttpRequest::new_inherited(global),
|
||||
global,
|
||||
*global,
|
||||
XMLHttpRequestBinding::Wrap)
|
||||
}
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<XMLHttpRequest>> {
|
||||
|
@ -832,7 +832,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
assert!(self.ready_state.get() != rs)
|
||||
self.ready_state.set(rs);
|
||||
let global = self.global.root();
|
||||
let event = Event::new(&global.root_ref(),
|
||||
let event = Event::new(global.root_ref(),
|
||||
"readystatechange".to_string(),
|
||||
DoesNotBubble, Cancelable).root();
|
||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||
|
@ -977,7 +977,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
fn dispatch_progress_event(self, upload: bool, type_: DOMString, loaded: u64, total: Option<u64>) {
|
||||
let global = self.global.root();
|
||||
let upload_target = *self.upload.root();
|
||||
let progressevent = ProgressEvent::new(&global.root_ref(),
|
||||
let progressevent = ProgressEvent::new(global.root_ref(),
|
||||
type_, false, false,
|
||||
total.is_some(), loaded,
|
||||
total.unwrap_or(0)).root();
|
||||
|
|
|
@ -22,7 +22,7 @@ impl XMLHttpRequestUpload {
|
|||
eventtarget:XMLHttpRequestEventTarget::new_inherited(XMLHttpRequestUploadTypeId)
|
||||
}
|
||||
}
|
||||
pub fn new(global: &GlobalRef) -> Temporary<XMLHttpRequestUpload> {
|
||||
pub fn new(global: GlobalRef) -> Temporary<XMLHttpRequestUpload> {
|
||||
reflect_dom_object(box XMLHttpRequestUpload::new_inherited(),
|
||||
global,
|
||||
XMLHttpRequestUploadBinding::Wrap)
|
||||
|
|
|
@ -838,7 +838,7 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-end step 4
|
||||
let event = Event::new(&global::Window(*window), "DOMContentLoaded".to_string(),
|
||||
let event = Event::new(global::Window(*window), "DOMContentLoaded".to_string(),
|
||||
DoesNotBubble, NotCancelable).root();
|
||||
let doctarget: JSRef<EventTarget> = EventTargetCast::from_ref(*document);
|
||||
let _ = doctarget.DispatchEvent(*event);
|
||||
|
@ -850,7 +850,7 @@ impl ScriptTask {
|
|||
// https://html.spec.whatwg.org/multipage/#the-end step 7
|
||||
document.set_ready_state(DocumentReadyStateValues::Complete);
|
||||
|
||||
let event = Event::new(&global::Window(*window), "load".to_string(), DoesNotBubble, NotCancelable).root();
|
||||
let event = Event::new(global::Window(*window), "load".to_string(), DoesNotBubble, NotCancelable).root();
|
||||
let wintarget: JSRef<EventTarget> = EventTargetCast::from_ref(*window);
|
||||
let _ = wintarget.dispatch_event_with_target(Some(doctarget), *event);
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ impl ScriptTask {
|
|||
doc.begin_focus_transaction();
|
||||
|
||||
let event =
|
||||
Event::new(&global::Window(*window),
|
||||
Event::new(global::Window(*window),
|
||||
"click".to_string(),
|
||||
Bubbles, Cancelable).root();
|
||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(node);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue