aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/error.rs12
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs6
-rw-r--r--components/script/dom/cssstyledeclaration.rs6
-rw-r--r--components/script/dom/document.rs10
-rw-r--r--components/script/dom/domimplementation.rs4
-rw-r--r--components/script/dom/element.rs15
6 files changed, 27 insertions, 26 deletions
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index c62216d4683..4908fa3b03d 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -39,7 +39,7 @@ pub enum Error {
/// SyntaxError DOMException
Syntax,
/// NamespaceError DOMException
- NamespaceError,
+ Namespace,
/// InvalidAccessError DOMException
InvalidAccess,
/// SecurityError DOMException
@@ -53,10 +53,10 @@ pub enum Error {
/// DataCloneError DOMException
DataClone,
/// NoModificationAllowedError DOMException
- NoModificationAllowedError,
+ NoModificationAllowed,
/// TypeError JavaScript Error
- TypeError(DOMString),
+ Type(DOMString),
/// A JavaScript exception is already pending.
JSFailed,
@@ -81,15 +81,15 @@ pub fn throw_dom_exception(cx: *mut JSContext, global: GlobalRef,
Error::NotSupported => DOMErrorName::NotSupportedError,
Error::InvalidState => DOMErrorName::InvalidStateError,
Error::Syntax => DOMErrorName::SyntaxError,
- Error::NamespaceError => DOMErrorName::NamespaceError,
+ Error::Namespace => DOMErrorName::NamespaceError,
Error::InvalidAccess => DOMErrorName::InvalidAccessError,
Error::Security => DOMErrorName::SecurityError,
Error::Network => DOMErrorName::NetworkError,
Error::Abort => DOMErrorName::AbortError,
Error::Timeout => DOMErrorName::TimeoutError,
Error::DataClone => DOMErrorName::DataCloneError,
- Error::NoModificationAllowedError => DOMErrorName::NoModificationAllowedError,
- Error::TypeError(message) => {
+ Error::NoModificationAllowed => DOMErrorName::NoModificationAllowedError,
+ Error::Type(message) => {
throw_type_error(cx, &message);
return;
}
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index c2316dd44db..fc8573923d0 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasWin
use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods;
use dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrCanvasRenderingContext2D;
use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
-use dom::bindings::error::Error::{IndexSize, NotSupported, TypeError};
+use dom::bindings::error::Error::{IndexSize, NotSupported, Type};
use dom::bindings::error::Fallible;
use dom::bindings::global::{GlobalRef, GlobalField};
use dom::bindings::js::{JS, JSRef, LayoutJS, Temporary};
@@ -628,7 +628,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
let y1 = *y1;
if [x0, y0, x1, y1].iter().any(|x| x.is_nan() || x.is_infinite()) {
- return Err(TypeError("One of the arguments of createLinearGradient() is not a finite floating-point value.".to_owned()));
+ return Err(Type("One of the arguments of createLinearGradient() is not a finite floating-point value.".to_owned()));
}
Ok(CanvasGradient::new(self.global.root().r(),
CanvasGradientStyle::Linear(LinearGradientStyle::new(x0, y0, x1, y1, Vec::new()))))
@@ -644,7 +644,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
let r1 = *r1;
if [x0, y0, r0, x1, y1, r1].iter().any(|x| x.is_nan() || x.is_infinite()) {
- return Err(TypeError("One of the arguments of createRadialGradient() is not a finite floating-point value.".to_owned()));
+ return Err(Type("One of the arguments of createRadialGradient() is not a finite floating-point value.".to_owned()));
}
Ok(CanvasGradient::new(self.global.root().r(),
CanvasGradientStyle::Radial(RadialGradientStyle::new(x0, y0, r0, x1, y1, r1, Vec::new()))))
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index c76ccee38fe..2f907feb3f9 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -187,7 +187,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
priority: DOMString) -> ErrorResult {
// Step 1
if self.readonly {
- return Err(Error::NoModificationAllowedError);
+ return Err(Error::NoModificationAllowed);
}
// Step 2
@@ -247,7 +247,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
fn SetPropertyPriority(self, property: DOMString, priority: DOMString) -> ErrorResult {
// Step 1
if self.readonly {
- return Err(Error::NoModificationAllowedError);
+ return Err(Error::NoModificationAllowed);
}
// Step 2
@@ -295,7 +295,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
fn RemoveProperty(self, property: DOMString) -> Fallible<DOMString> {
// Step 1
if self.readonly {
- return Err(Error::NoModificationAllowedError);
+ return Err(Error::NoModificationAllowed);
}
// Step 2
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index dcf96d66399..7e8a570960d 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -21,7 +21,7 @@ use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElem
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived};
use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::error::Error::{NotSupported, InvalidCharacter, Security};
-use dom::bindings::error::Error::{HierarchyRequest, NamespaceError};
+use dom::bindings::error::Error::{HierarchyRequest, Namespace};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{MutNullableJS, JS, JSRef, LayoutJS, Temporary, TemporaryPushable};
use dom::bindings::js::{OptionalRootable, RootedReference};
@@ -983,7 +983,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
},
Name => {
debug!("Not a valid qualified element name");
- return Err(NamespaceError);
+ return Err(Namespace);
},
QName => {}
}
@@ -993,12 +993,12 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// throw if prefix is not null and namespace is null
(&ns!(""), Some(_), _) => {
debug!("Namespace can't be null with a non-null prefix");
- return Err(NamespaceError);
+ return Err(Namespace);
},
// throw if prefix is "xml" and namespace is not the XML namespace
(_, Some(ref prefix), _) if "xml" == *prefix && ns != ns!(XML) => {
debug!("Namespace must be the xml namespace if the prefix is 'xml'");
- return Err(NamespaceError);
+ return Err(Namespace);
},
// throw if namespace is the XMLNS namespace and neither qualifiedName nor prefix is
// "xmlns"
@@ -1006,7 +1006,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
(&ns!(XMLNS), _, "xmlns") => {},
(&ns!(XMLNS), _, _) => {
debug!("The prefix or the qualified name must be 'xmlns' if namespace is the XMLNS namespace ");
- return Err(NamespaceError);
+ return Err(Namespace);
},
_ => {}
}
diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs
index 2b5bc3870c1..7e2a3dba03a 100644
--- a/components/script/dom/domimplementation.rs
+++ b/components/script/dom/domimplementation.rs
@@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::DOMImplementationBinding::DOMImplementatio
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::NodeCast;
use dom::bindings::error::Fallible;
-use dom::bindings::error::Error::{InvalidCharacter, NamespaceError};
+use dom::bindings::error::Error::{InvalidCharacter, Namespace};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, JSRef, Root, Temporary, OptionalRootable};
use dom::bindings::utils::{Reflector, reflect_dom_object};
@@ -57,7 +57,7 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// Step 1.
InvalidXMLName => Err(InvalidCharacter),
// Step 2.
- Name => Err(NamespaceError),
+ Name => Err(Namespace),
// Step 3.
QName => {
let document = self.document.root();
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index f27384c8028..544aa918c6d 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -26,7 +26,8 @@ use dom::bindings::codegen::InheritTypes::{HTMLTableSectionElementDerived, NodeC
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast;
use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived;
use dom::bindings::error::{ErrorResult, Fallible};
-use dom::bindings::error::Error::{NamespaceError, InvalidCharacter, Syntax};
+use dom::bindings::error::Error;
+use dom::bindings::error::Error::{InvalidCharacter, Syntax};
use dom::bindings::js::{MutNullableJS, JS, JSRef, LayoutJS, Temporary, TemporaryPushable};
use dom::bindings::js::OptionalRootable;
use dom::bindings::trace::RootedVec;
@@ -1045,7 +1046,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
// Step 2.
InvalidXMLName => return Err(InvalidCharacter),
// Step 3.
- Name => return Err(NamespaceError),
+ Name => return Err(Error::Namespace),
QName => {}
}
@@ -1055,17 +1056,17 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
if let Some(ref prefix_str) = prefix {
// Step 5.
if namespace == ns!("") {
- return Err(NamespaceError);
+ return Err(Error::Namespace);
}
// Step 6.
if "xml" == *prefix_str && namespace != ns!(XML) {
- return Err(NamespaceError);
+ return Err(Error::Namespace);
}
// Step 7b.
if "xmlns" == *prefix_str && namespace != ns!(XMLNS) {
- return Err(NamespaceError);
+ return Err(Error::Namespace);
}
}
@@ -1075,12 +1076,12 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
// Step 7a.
if xmlns == name && namespace != ns!(XMLNS) {
- return Err(NamespaceError);
+ return Err(Error::Namespace);
}
// Step 8.
if namespace == ns!(XMLNS) && xmlns != name && Some("xmlns") != prefix {
- return Err(NamespaceError);
+ return Err(Error::Namespace);
}
// Step 9.