Bug 774705 - Part b: Throw a TypeError when trying to construct an interface without a constructor; r=bz

This commit is contained in:
Ms2ger 2012-08-04 09:44:00 +02:00
Родитель e5dbf6b206
Коммит 86de6cd109
5 изменённых файлов: 3 добавлений и 11 удалений

Просмотреть файл

@ -403,13 +403,7 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
JSBool JSBool
ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp) ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp)
{ {
return Throw<true>(cx, NS_ERROR_FAILURE); return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
}
JSBool
ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp)
{
return Throw<false>(cx, NS_ERROR_FAILURE);
} }
bool bool

Просмотреть файл

@ -690,8 +690,6 @@ JSBool
QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp); QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp);
JSBool JSBool
ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp); ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp);
JSBool
ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp);
template<class T> template<class T>
class NonNull class NonNull

Просмотреть файл

@ -1118,7 +1118,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
constructHook = CONSTRUCT_HOOK_NAME constructHook = CONSTRUCT_HOOK_NAME
constructArgs = methodLength(self.descriptor.interface.ctor()) constructArgs = methodLength(self.descriptor.interface.ctor())
else: else:
constructHook = "ThrowingConstructorWorkers" if self.descriptor.workers else "ThrowingConstructor" constructHook = "ThrowingConstructor"
constructArgs = 0 constructArgs = 0
call = CGGeneric(("return dom::CreateInterfaceObjects(aCx, aGlobal, aReceiver, parentProto,\n" call = CGGeneric(("return dom::CreateInterfaceObjects(aCx, aGlobal, aReceiver, parentProto,\n"

Просмотреть файл

@ -24,3 +24,4 @@ MSG_DEF(MSG_MISSING_ARGUMENTS, 1, "Not enough arguments to {0}.")
MSG_DEF(MSG_NOT_OBJECT, 0, "Value not an object.") MSG_DEF(MSG_NOT_OBJECT, 0, "Value not an object.")
MSG_DEF(MSG_DOES_NOT_IMPLEMENT_INTERFACE, 1, "Value does not implement interface {0}.") MSG_DEF(MSG_DOES_NOT_IMPLEMENT_INTERFACE, 1, "Value does not implement interface {0}.")
MSG_DEF(MSG_NOT_IN_UNION, 1, "Value could not be converted to any of: {0}.") MSG_DEF(MSG_NOT_IN_UNION, 1, "Value could not be converted to any of: {0}.")
MSG_DEF(MSG_ILLEGAL_CONSTRUCTOR, 0, "Illegal constructor.")

Просмотреть файл

@ -1,5 +1,4 @@
{ {
"XMLHttpRequestUpload interface: existence and properties of interface object": true,
"XMLHttpRequest interface constructor": true, "XMLHttpRequest interface constructor": true,
"FormData interface: existence and properties of interface object": true, "FormData interface: existence and properties of interface object": true,
"FormData interface constructor": true, "FormData interface constructor": true,