aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-02-17 18:51:47 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2016-02-17 18:51:47 +0530
commit61f09cce4e7c1681fd1f7fbefada596316f06809 (patch)
tree2f9a3c715e5f0186c76db4b3f8aa0b6125935db3 /components/script/dom
parentab381cf951f3e556d0f4c1f2107a311b0d275f91 (diff)
parentc21a1643965b052f2ca7324081f06971319351b6 (diff)
downloadservo-61f09cce4e7c1681fd1f7fbefada596316f06809.tar.gz
servo-61f09cce4e7c1681fd1f7fbefada596316f06809.zip
Auto merge of #9676 - nox:domexception, r=KiChjang
Support [ExceptionClass] Use it on DOMException. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9676) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py16
-rw-r--r--components/script/dom/webidls/DOMException.webidl8
2 files changed, 13 insertions, 11 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 13b65f53f29..ea16360841d 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2391,9 +2391,11 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
return CGGeneric("""\
create_callback_interface_object(cx, receiver, sConstants, %s);""" % str_to_const_array(name))
- protoChain = self.descriptor.prototypeChain
- if len(protoChain) == 1:
- getPrototypeProto = "prototype_proto.ptr = JS_GetObjectPrototype(cx, global)"
+ if len(self.descriptor.prototypeChain) == 1:
+ if self.descriptor.interface.getExtendedAttribute("ExceptionClass"):
+ getPrototypeProto = "prototype_proto.ptr = JS_GetErrorPrototype(cx)"
+ else:
+ getPrototypeProto = "prototype_proto.ptr = JS_GetObjectPrototype(cx, global)"
else:
getPrototypeProto = ("%s::GetProtoObject(cx, global, receiver, prototype_proto.handle_mut())" %
toBindingNamespace(self.descriptor.prototypeChain[-2]))
@@ -5340,10 +5342,10 @@ class CGBindingRoot(CGThing):
'js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray}',
'js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue}',
'js::jsapi::{JS_ComputeThis, JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo}',
- 'js::jsapi::{JS_GetClass, JS_GetFunctionPrototype, JS_GetGlobalForObject}',
- 'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}',
- 'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot, JS_HasProperty}',
- 'js::jsapi::{JS_HasPropertyById, JS_InitializePropertiesFromCompatibleNativeObject}',
+ 'js::jsapi::{JS_GetClass, JS_GetErrorPrototype, JS_GetFunctionPrototype}',
+ 'js::jsapi::{JS_GetGlobalForObject, JS_GetObjectPrototype, JS_GetProperty}',
+ 'js::jsapi::{JS_GetPropertyById, JS_GetPropertyDescriptorById, JS_GetReservedSlot}',
+ 'js::jsapi::{JS_HasProperty, JS_HasPropertyById, JS_InitializePropertiesFromCompatibleNativeObject}',
'js::jsapi::{JS_InternString, JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto}',
'js::jsapi::{JS_NewObjectWithoutMetadata, JS_NewStringCopyZ, JS_SetProperty}',
'js::jsapi::{JS_SetPrototype, JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment}',
diff --git a/components/script/dom/webidls/DOMException.webidl b/components/script/dom/webidls/DOMException.webidl
index 0dfb7149e93..4e1620aa13b 100644
--- a/components/script/dom/webidls/DOMException.webidl
+++ b/components/script/dom/webidls/DOMException.webidl
@@ -3,12 +3,12 @@
* 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/. */
/*
- * The origin of this IDL file is:
- * https://dom.spec.whatwg.org/#domexception
+
+/* https://heycam.github.io/webidl/#es-DOMException
+ * https://heycam.github.io/webidl/#es-DOMException-constructor-object
*/
-// XXXkhuey this is an 'exception', not an interface, but we don't have any
-// parser or codegen mechanisms for dealing with exceptions.
+[ExceptionClass]
interface DOMException {
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical