Bug 774705 - Part b: Throw a TypeError when trying to construct an interface without a constructor; r=bz
authorMs2ger <ms2ger@gmail.com>
Sat, 04 Aug 2012 09:44:00 +0200
changeset 106931 e06889b2f24a7b254c8d9458c01bbdbe1a16fcb0
parent 106930 94fb2a8a4c39c3db2ad1ac1026918664a99a630f
child 106932 b0e43ce07b18db421d3cc139eddd195b5990f526
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs774705
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 774705 - Part b: Throw a TypeError when trying to construct an interface without a constructor; r=bz
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/Codegen.py
dom/bindings/Errors.msg
dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html.json
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -398,23 +398,17 @@ QueryInterface(JSContext* cx, unsigned a
   // Lie, otherwise we need to check classinfo or QI
   *vp = thisv;
   return true;
 }
 
 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
 XrayResolveProperty(JSContext* cx, JSObject* wrapper, jsid id,
                     JSPropertyDescriptor* desc,
                     // And the things we need to determine the descriptor
                     Prefable<JSFunctionSpec>* methods,
                     jsid* methodIds,
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -685,18 +685,16 @@ InitIds(JSContext* cx, Prefable<Spec>* p
 
   return true;
 }
 
 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
 {
 public:
   NonNull()
 #ifdef DEBUG
     : inited(false)
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -1113,17 +1113,17 @@ class CGCreateInterfaceObjectsMethod(CGA
         needInterfaceObjectClass = (needInterfaceObject and
                                     self.descriptor.hasInstanceInterface)
         needConstructor = (needInterfaceObject and
                            not self.descriptor.hasInstanceInterface)
         if self.descriptor.interface.ctor():
             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"
                           "                                   %s, %s, %s, %d,\n"
                           "                                   %%(methods)s, %%(attrs)s, %%(consts)s, %%(staticMethods)s,\n"
                           "                                   %s);") % (
             "&PrototypeClass" if needInterfacePrototypeObject else "NULL",
             "&InterfaceObjectClass" if needInterfaceObjectClass else "NULL",
--- a/dom/bindings/Errors.msg
+++ b/dom/bindings/Errors.msg
@@ -19,8 +19,9 @@
  * be replaced with a string value when the error is reported.
  */
 
 MSG_DEF(MSG_INVALID_ENUM_VALUE, 2, "Value '{0}' is not a valid value for enumeration {1}.")
 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.")
--- a/dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html.json
+++ b/dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html.json
@@ -1,10 +1,9 @@
 {
-  "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,
   "FormData interface: existence and properties of interface prototype object": true,
   "FormData interface: existence and properties of interface prototype object's \"constructor\" property": true,
   "FormData interface: operation append(DOMString,Blob,DOMString)": true,
   "Stringification of new FormData()": "debug",
   "FormData interface: calling append(DOMString,Blob,DOMString) on new FormData() with too few arguments must throw TypeError": true,