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
parent 3a16363144
commit e8f42a2d03
5 changed files with 3 additions and 11 deletions

View File

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

View File

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

View File

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

View File

@ -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_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_ILLEGAL_CONSTRUCTOR, 0, "Illegal constructor.")

View File

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