bindings: Return errors in Result rather than setting an out parameter

Fixes #909.
This commit is contained in:
Keegan McAllister 2013-09-18 15:23:03 -07:00
parent 4b0680a136
commit 73c1a12f30
73 changed files with 891 additions and 550 deletions

View file

@ -2,7 +2,7 @@
* 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::{DOMString, ErrorResult, null_str_as_empty};
use dom::bindings::utils::{DOMString, Fallible, null_str_as_empty};
use dom::characterdata::CharacterData;
use dom::node::{AbstractNode, ScriptView, Node, TextNodeTypeId};
use dom::window::Window;
@ -20,16 +20,16 @@ impl Text {
}
}
pub fn Constructor(owner: @mut Window, text: &DOMString, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
pub fn Constructor(owner: @mut Window, text: &DOMString) -> Fallible<AbstractNode<ScriptView>> {
let cx = owner.page.js_info.get_ref().js_compartment.cx.ptr;
unsafe { Node::as_abstract_node(cx, @Text::new(null_str_as_empty(text))) }
unsafe { Ok(Node::as_abstract_node(cx, @Text::new(null_str_as_empty(text)))) }
}
pub fn SplitText(&self, _offset: u32, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
pub fn SplitText(&self, _offset: u32) -> Fallible<AbstractNode<ScriptView>> {
fail!("unimplemented")
}
pub fn GetWholeText(&self, _rv: &mut ErrorResult) -> DOMString {
None
pub fn GetWholeText(&self) -> Fallible<DOMString> {
Ok(None)
}
}