Bug 1195977, part 8 - Check that ThrowInvalidThis is passing in enough arguments. r=peterv
authorAndrew McCreight <continuation@gmail.com>
Tue, 15 Sep 2015 11:47:04 -0700
changeset 296973 461b0e3e3071e9cab4b5d23fb97e3eb5782371bb
parent 296972 eae3e7c3dbbd7fdd56c29eb26345c26780f2a122
child 296974 57bc5e8914dcda0d6cf9dc9102db95db0376a8b9
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1195977
milestone43.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 1195977, part 8 - Check that ThrowInvalidThis is passing in enough arguments. r=peterv We have to permit passing in too many arguments because sometimes the error is MSG_METHOD_THIS_UNWRAPPING_DENIED which only takes one argument.
dom/bindings/BindingUtils.cpp
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -103,16 +103,17 @@ ThrowInvalidThis(JSContext* aCx, const J
   JS::Rooted<JSFunction*> func(aCx, JS_ValueToFunction(aCx, aArgs.calleev()));
   MOZ_ASSERT(func);
   JS::Rooted<JSString*> funcName(aCx, JS_GetFunctionDisplayId(func));
   MOZ_ASSERT(funcName);
   nsAutoJSString funcNameStr;
   if (!funcNameStr.init(aCx, funcName)) {
     return false;
   }
+  MOZ_RELEASE_ASSERT(GetErrorArgCount(aErrorNumber) <= 2);
   JS_ReportErrorNumberUC(aCx, GetErrorMessage, nullptr,
                          static_cast<const unsigned>(aErrorNumber),
                          funcNameStr.get(), ifaceName.get());
   return false;
 }
 
 bool
 ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,