mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Refactor Error enum usage to consistently be qualified
This commit is contained in:
parent
94816bb3b4
commit
ba86131cd5
19 changed files with 139 additions and 161 deletions
|
@ -28,9 +28,7 @@ use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementCast, HTMLTableSec
|
|||
use dom::bindings::codegen::InheritTypes::{HTMLTemplateElementCast, HTMLTextAreaElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, TextCast};
|
||||
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
||||
use dom::bindings::error::Error::NoModificationAllowed;
|
||||
use dom::bindings::error::Error::{InvalidCharacter, Syntax};
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
|
||||
use dom::bindings::js::{Root, RootedReference};
|
||||
use dom::bindings::utils::XMLName::InvalidXMLName;
|
||||
|
@ -909,7 +907,7 @@ impl Element {
|
|||
pub fn set_custom_attribute(&self, name: DOMString, value: DOMString) -> ErrorResult {
|
||||
// Step 1.
|
||||
match xml_name_type(&name) {
|
||||
InvalidXMLName => return Err(InvalidCharacter),
|
||||
InvalidXMLName => return Err(Error::InvalidCharacter),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
@ -1174,7 +1172,7 @@ impl ElementMethods for Element {
|
|||
value: DOMString) -> ErrorResult {
|
||||
// Step 1.
|
||||
if xml_name_type(&name) == InvalidXMLName {
|
||||
return Err(InvalidCharacter);
|
||||
return Err(Error::InvalidCharacter);
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
|
@ -1341,7 +1339,7 @@ impl ElementMethods for Element {
|
|||
|
||||
let parent = match context_parent.r().type_id() {
|
||||
// Step 3.
|
||||
NodeTypeId::Document => return Err(NoModificationAllowed),
|
||||
NodeTypeId::Document => return Err(Error::NoModificationAllowed),
|
||||
|
||||
// Step 4.
|
||||
NodeTypeId::DocumentFragment => {
|
||||
|
@ -1440,7 +1438,7 @@ impl ElementMethods for Element {
|
|||
// https://dom.spec.whatwg.org/#dom-element-matches
|
||||
fn Matches(&self, selectors: DOMString) -> Fallible<bool> {
|
||||
match parse_author_origin_selector_list_from_str(&selectors) {
|
||||
Err(()) => Err(Syntax),
|
||||
Err(()) => Err(Error::Syntax),
|
||||
Ok(ref selectors) => {
|
||||
Ok(matches(selectors, &Root::from_ref(self), None))
|
||||
}
|
||||
|
@ -1450,7 +1448,7 @@ impl ElementMethods for Element {
|
|||
// https://dom.spec.whatwg.org/#dom-element-closest
|
||||
fn Closest(&self, selectors: DOMString) -> Fallible<Option<Root<Element>>> {
|
||||
match parse_author_origin_selector_list_from_str(&selectors) {
|
||||
Err(()) => Err(Syntax),
|
||||
Err(()) => Err(Error::Syntax),
|
||||
Ok(ref selectors) => {
|
||||
let root = NodeCast::from_ref(self);
|
||||
for element in root.inclusive_ancestors() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue