Don't return NS_OK in failure cases. Instead, return a well-known value that nsGlobalWindow can convert. bug 382196, r+sr=jst
authormrbkap@gmail.com
Fri, 15 Jun 2007 14:47:37 -0700
changeset 2458 be1914709c4200d80d67fb874ee02f706d9f4c6b
parent 2457 079486ee93d6421170208896e64f280caa48ad49
child 2459 a9e750fcf8aba9955967d2c9a6a650614489d4ab
push idunknown
push userunknown
push dateunknown
bugs382196
milestone1.9a6pre
Don't return NS_OK in failure cases. Instead, return a well-known value that nsGlobalWindow can convert. bug 382196, r+sr=jst
dom/src/base/nsJSTimeoutHandler.cpp
--- a/dom/src/base/nsJSTimeoutHandler.cpp
+++ b/dom/src/base/nsJSTimeoutHandler.cpp
@@ -233,25 +233,27 @@ nsJSScriptTimeoutHandler::Init(nsIScript
   int32 interval = 0;
 
   JSAutoRequest ar(cx);
 
   if (argc < 1) {
     ::JS_ReportError(cx, "Function %s requires at least 1 parameter",
                      aIsInterval ? kSetIntervalStr : kSetTimeoutStr);
 
-    return ncc->SetExceptionWasThrown(PR_TRUE);
+    ncc->SetExceptionWasThrown(PR_TRUE);
+    return NS_ERROR_DOM_TYPE_ERR;
   }
 
   if (argc > 1 && !::JS_ValueToECMAInt32(cx, argv[1], &interval)) {
     ::JS_ReportError(cx,
                      "Second argument to %s must be a millisecond interval",
                      aIsInterval ? kSetIntervalStr : kSetTimeoutStr);
 
-    return ncc->SetExceptionWasThrown(PR_TRUE);
+    ncc->SetExceptionWasThrown(PR_TRUE);
+    return NS_ERROR_DOM_TYPE_ERR;
   }
 
   switch (::JS_TypeOfValue(cx, argv[0])) {
   case JSTYPE_FUNCTION:
     funobj = JSVAL_TO_OBJECT(argv[0]);
     break;
 
   case JSTYPE_STRING: