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 -->
This commit is contained in:
bors-servo 2016-02-17 18:51:47 +05:30
commit 61f09cce4e
4 changed files with 13 additions and 17 deletions

View file

@ -2391,8 +2391,10 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
return CGGeneric("""\ return CGGeneric("""\
create_callback_interface_object(cx, receiver, sConstants, %s);""" % str_to_const_array(name)) create_callback_interface_object(cx, receiver, sConstants, %s);""" % str_to_const_array(name))
protoChain = self.descriptor.prototypeChain if len(self.descriptor.prototypeChain) == 1:
if len(protoChain) == 1: if self.descriptor.interface.getExtendedAttribute("ExceptionClass"):
getPrototypeProto = "prototype_proto.ptr = JS_GetErrorPrototype(cx)"
else:
getPrototypeProto = "prototype_proto.ptr = JS_GetObjectPrototype(cx, global)" getPrototypeProto = "prototype_proto.ptr = JS_GetObjectPrototype(cx, global)"
else: else:
getPrototypeProto = ("%s::GetProtoObject(cx, global, receiver, prototype_proto.handle_mut())" % getPrototypeProto = ("%s::GetProtoObject(cx, global, receiver, prototype_proto.handle_mut())" %
@ -5340,10 +5342,10 @@ class CGBindingRoot(CGThing):
'js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray}', 'js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray}',
'js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue}', 'js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue}',
'js::jsapi::{JS_ComputeThis, JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo}', 'js::jsapi::{JS_ComputeThis, JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo}',
'js::jsapi::{JS_GetClass, JS_GetFunctionPrototype, JS_GetGlobalForObject}', 'js::jsapi::{JS_GetClass, JS_GetErrorPrototype, JS_GetFunctionPrototype}',
'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}', 'js::jsapi::{JS_GetGlobalForObject, JS_GetObjectPrototype, JS_GetProperty}',
'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot, JS_HasProperty}', 'js::jsapi::{JS_GetPropertyById, JS_GetPropertyDescriptorById, JS_GetReservedSlot}',
'js::jsapi::{JS_HasPropertyById, JS_InitializePropertiesFromCompatibleNativeObject}', 'js::jsapi::{JS_HasProperty, JS_HasPropertyById, JS_InitializePropertiesFromCompatibleNativeObject}',
'js::jsapi::{JS_InternString, JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto}', 'js::jsapi::{JS_InternString, JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto}',
'js::jsapi::{JS_NewObjectWithoutMetadata, JS_NewStringCopyZ, JS_SetProperty}', 'js::jsapi::{JS_NewObjectWithoutMetadata, JS_NewStringCopyZ, JS_SetProperty}',
'js::jsapi::{JS_SetPrototype, JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment}', 'js::jsapi::{JS_SetPrototype, JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment}',

View file

@ -3,12 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 [ExceptionClass]
// parser or codegen mechanisms for dealing with exceptions.
interface DOMException { interface DOMException {
const unsigned short INDEX_SIZE_ERR = 1; const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical const unsigned short DOMSTRING_SIZE_ERR = 2; // historical

View file

@ -3,9 +3,6 @@
[existence and properties of DOMException] [existence and properties of DOMException]
expected: FAIL expected: FAIL
[existence and properties of DOMException.prototype]
expected: FAIL
[existence of name and code properties on DOMException.prototype] [existence of name and code properties on DOMException.prototype]
expected: FAIL expected: FAIL

View file

@ -3,9 +3,6 @@
[existence and properties of DOMException] [existence and properties of DOMException]
expected: FAIL expected: FAIL
[existence and properties of DOMException.prototype]
expected: FAIL
[existence of name and code properties on DOMException.prototype] [existence of name and code properties on DOMException.prototype]
expected: FAIL expected: FAIL