mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
bindings: Return errors in Result rather than setting an out parameter
Fixes #909.
This commit is contained in:
parent
4b0680a136
commit
73c1a12f30
73 changed files with 891 additions and 550 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! DOM bindings for `CharacterData`.
|
||||
|
||||
use dom::bindings::utils::{DOMString, ErrorResult};
|
||||
use dom::bindings::utils::{DOMString, ErrorResult, Fallible};
|
||||
use dom::bindings::utils::{BindingObject, CacheableWrapper, WrapperCache};
|
||||
use dom::node::{Node, NodeTypeId, ScriptView};
|
||||
use js::jsapi::{JSObject, JSContext};
|
||||
|
@ -26,31 +26,33 @@ impl CharacterData {
|
|||
Some(self.data.clone())
|
||||
}
|
||||
|
||||
pub fn SetData(&mut self, arg: &DOMString, _rv: &mut ErrorResult) {
|
||||
pub fn SetData(&mut self, arg: &DOMString) -> ErrorResult {
|
||||
self.data = arg.get_ref().clone();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn Length(&self) -> u32 {
|
||||
self.data.len() as u32
|
||||
}
|
||||
|
||||
pub fn SubstringData(&self, offset: u32, count: u32, _rv: &mut ErrorResult) -> DOMString {
|
||||
Some(self.data.slice(offset as uint, count as uint).to_str())
|
||||
pub fn SubstringData(&self, offset: u32, count: u32) -> Fallible<DOMString> {
|
||||
Ok(Some(self.data.slice(offset as uint, count as uint).to_str()))
|
||||
}
|
||||
|
||||
pub fn AppendData(&mut self, arg: &DOMString, _rv: &mut ErrorResult) {
|
||||
pub fn AppendData(&mut self, arg: &DOMString) -> ErrorResult {
|
||||
self.data.push_str(arg.get_ref().clone());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn InsertData(&mut self, _offset: u32, _arg: &DOMString, _rv: &mut ErrorResult) {
|
||||
pub fn InsertData(&mut self, _offset: u32, _arg: &DOMString) -> ErrorResult {
|
||||
fail!("CharacterData::InsertData() is unimplemented")
|
||||
}
|
||||
|
||||
pub fn DeleteData(&mut self, _offset: u32, _count: u32, _rv: &mut ErrorResult) {
|
||||
pub fn DeleteData(&mut self, _offset: u32, _count: u32) -> ErrorResult {
|
||||
fail!("CharacterData::DeleteData() is unimplemented")
|
||||
}
|
||||
|
||||
pub fn ReplaceData(&mut self, _offset: u32, _count: u32, _arg: &DOMString, _rv: &mut ErrorResult) {
|
||||
pub fn ReplaceData(&mut self, _offset: u32, _count: u32, _arg: &DOMString) -> ErrorResult {
|
||||
fail!("CharacterData::ReplaceData() is unimplemented")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue