auto merge of #1085 : Ms2ger/servo/wrap_shared, r=jdm

This commit is contained in:
bors-servo 2013-10-18 07:19:10 -07:00
commit 19c1b023e0
9 changed files with 14 additions and 153 deletions

View file

@ -3,12 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::DOMParserBinding;
use dom::bindings::utils::{Reflectable, Reflector};
use dom::bindings::utils::{BindingObject, DerivedWrapper};
use dom::bindings::utils::{BindingObject, Reflectable, Reflector};
use dom::domparser::DOMParser;
use js::jsapi::{JSContext, JSObject, JSVal};
use js::glue::{RUST_OBJECT_TO_JSVAL};
use js::jsapi::{JSContext, JSObject};
impl Reflectable for DOMParser {
fn reflector<'a>(&'a self) -> &'a Reflector {
@ -29,20 +27,3 @@ impl BindingObject for DOMParser {
Some(self.owner as @mut Reflectable)
}
}
impl DerivedWrapper for DOMParser {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
return 1;
}
}
}

View file

@ -738,7 +738,6 @@ pub fn InitIds(cx: *JSContext, specs: &[JSPropertySpec], ids: &mut [jsid]) -> bo
pub trait DerivedWrapper {
fn wrap(&mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32;
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32;
}
impl DerivedWrapper for AbstractNode<ScriptView> {
@ -752,10 +751,6 @@ impl DerivedWrapper for AbstractNode<ScriptView> {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(node::create(cx, self)) };
return 1;
}
fn wrap_shared(@mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
}
#[deriving(ToStr)]

View file

@ -2,12 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
use dom::bindings::codegen::ClientRectBinding;
use script_task::page_from_context;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext};
pub struct ClientRect {
reflector_: Reflector,
@ -81,20 +80,3 @@ impl BindingObject for ClientRect {
}
}
}
impl DerivedWrapper for ClientRect {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
return 1;
}
}
}

View file

@ -192,10 +192,6 @@ impl DerivedWrapper for AbstractDocument {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(self.reflector().get_jsobject()) };
return 1;
}
fn wrap_shared(@mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
}

View file

@ -5,12 +5,11 @@
use dom::eventtarget::EventTarget;
use dom::window::Window;
use dom::bindings::codegen::EventBinding;
use dom::bindings::utils::{Reflectable, BindingObject, DerivedWrapper};
use dom::bindings::utils::{Reflectable, BindingObject};
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Reflector};
use geom::point::Point2D;
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::jsapi::{JSObject, JSContext};
use script_task::page_from_context;
@ -132,20 +131,3 @@ impl BindingObject for Event {
}
}
}
impl DerivedWrapper for Event {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
return 1;
}
}
}

View file

@ -3,11 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::EventTargetBinding;
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
use script_task::page_from_context;
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::jsapi::{JSObject, JSContext};
pub struct EventTarget {
reflector_: Reflector
@ -48,22 +47,3 @@ impl BindingObject for EventTarget {
}
}
}
impl DerivedWrapper for EventTarget {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe {
*vp = RUST_OBJECT_TO_JSVAL(obj)
};
return 1;
}
}
}

View file

@ -2,14 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::utils::{Reflectable, BindingObject, DerivedWrapper};
use dom::bindings::utils::{Reflectable, BindingObject};
use dom::bindings::utils::{Reflector, DOMString, null_str_as_empty};
use dom::bindings::codegen::FormDataBinding;
use dom::blob::Blob;
use script_task::{page_from_context};
use js::jsapi::{JSObject, JSContext, JSVal};
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext};
use std::hashmap::HashMap;
@ -70,20 +69,3 @@ impl BindingObject for FormData {
}
}
}
impl DerivedWrapper for FormData {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
return 1;
}
}
}

View file

@ -4,14 +4,13 @@
use dom::bindings::codegen::MouseEventBinding;
use dom::bindings::utils::{ErrorResult, Fallible, DOMString};
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
use dom::eventtarget::EventTarget;
use dom::uievent::UIEvent;
use dom::window::Window;
use dom::windowproxy::WindowProxy;
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::jsapi::{JSObject, JSContext};
pub struct MouseEvent {
parent: UIEvent,
@ -161,21 +160,3 @@ impl BindingObject for MouseEvent {
self.parent.GetParentObject(cx)
}
}
impl DerivedWrapper for MouseEvent {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
return 1;
}
}
}

View file

@ -4,14 +4,13 @@
use dom::bindings::codegen::UIEventBinding;
use dom::bindings::utils::{DOMString, Fallible};
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
use dom::node::{AbstractNode, ScriptView};
use dom::event::Event;
use dom::window::Window;
use dom::windowproxy::WindowProxy;
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use js::jsapi::{JSObject, JSContext};
pub struct UIEvent {
parent: Event,
@ -134,20 +133,3 @@ impl BindingObject for UIEvent {
self.parent.GetParentObject(cx)
}
}
impl DerivedWrapper for UIEvent {
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
fail!(~"nyi")
}
#[fixed_stack_segment]
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
let obj = self.wrap_object_shared(cx, scope);
if obj.is_null() {
return 0;
} else {
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
return 1;
}
}
}