diff options
4 files changed, 13 insertions, 17 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 diff --git a/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html.ini b/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html.ini index 5be1e6376ab..39e25898e41 100644 --- a/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html.ini +++ b/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html.ini @@ -3,9 +3,6 @@ [existence and properties of DOMException] expected: FAIL - [existence and properties of DOMException.prototype] - expected: FAIL - [existence of name and code properties on DOMException.prototype] expected: FAIL diff --git a/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js.ini b/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js.ini index 0d3b8275f04..66a75c592b8 100644 --- a/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js.ini +++ b/tests/wpt/metadata/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js.ini @@ -3,9 +3,6 @@ [existence and properties of DOMException] expected: FAIL - [existence and properties of DOMException.prototype] - expected: FAIL - [existence of name and code properties on DOMException.prototype] expected: FAIL |