Bug 709493 - Return JSObject* from nsIScriptHandler::GetScriptObject() rather than returning void to remove casting. f=Ms2ger r=bz
authorJignesh Kakadiya <jigneshhk1992@gmail.com>
Thu, 15 Dec 2011 21:03:33 +0100
changeset 84683 a46f9224f2c6edc75af5cb2a5956d956414b73b3
parent 84682 46f82bd23a92bfaf9ee6dfb5885d06a89a55d5e3
child 84684 c8b8b310f27e69af12083f12e812b1e590417b5a
push id114
push userffxbld
push dateFri, 09 Mar 2012 01:01:18 +0000
treeherdermozilla-release@c081ebf13261 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs709493
milestone11.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 709493 - Return JSObject* from nsIScriptHandler::GetScriptObject() rather than returning void to remove casting. f=Ms2ger r=bz
dom/base/nsGlobalWindow.cpp
dom/base/nsIScriptTimeoutHandler.h
dom/base/nsJSTimeoutHandler.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9242,17 +9242,17 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
     bool trackNestingLevel = !timeout->mIsInterval;
     PRUint32 nestingLevel;
     if (trackNestingLevel) {
       nestingLevel = sNestingLevel;
       sNestingLevel = timeout->mNestingLevel;
     }
 
     nsCOMPtr<nsIScriptTimeoutHandler> handler(timeout->mScriptHandler);
-    JSObject* scriptObject = static_cast<JSObject*>(handler->GetScriptObject());
+    JSObject* scriptObject = handler->GetScriptObject();
     if (!scriptObject) {
       // Evaluate the timeout expression.
       const PRUnichar *script = handler->GetHandlerText();
       NS_ASSERTION(script, "timeout has no script nor handler text!");
 
       const char *filename = nsnull;
       PRUint32 lineNo = 0;
       handler->GetLocation(&filename, &lineNo);
--- a/dom/base/nsIScriptTimeoutHandler.h
+++ b/dom/base/nsIScriptTimeoutHandler.h
@@ -37,19 +37,19 @@
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsIScriptTimeoutHandler_h___
 #define nsIScriptTimeoutHandler_h___
 
 class nsIArray;
 
 #define NS_ISCRIPTTIMEOUTHANDLER_IID \
-{ /* {260C0DAB-0DCF-4c75-B820-46C31005718D} */ \
-  0x260c0dab, 0xdcf, 0x4c75, \
-  { 0xb8, 0x20, 0x46, 0xc3, 0x10, 0x5, 0x71, 0x8d } }
+{ /* {21ba4f96-30b8-4215-a75d-d438eb16a50c} */ \
+  0x21ba4f96, 0x30b8, 0x4215, \
+  { 0xa7, 0x5d, 0xd4, 0x38, 0xeb, 0x16, 0xa5, 0x0c } }
 
 /**
  * Abstraction of the script objects etc required to do timeouts in a
  * language agnostic way.
  */
 
 class nsIScriptTimeoutHandler : public nsISupports
 {
@@ -57,17 +57,17 @@ public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTTIMEOUTHANDLER_IID)
 
   // Get the script-type (language) implementing this timeout.
   virtual PRUint32 GetScriptTypeID() = 0;
 
   // Get a script object for the language suitable for passing back to
   // the language's context as an event handler.  If this returns nsnull,
   // GetHandlerText() will be called to get the string.
-  virtual void *GetScriptObject() = 0;
+  virtual JSObject *GetScriptObject() = 0;
 
   // Get the handler text of not a compiled object.
   virtual const PRUnichar *GetHandlerText() = 0;
 
   // Get the location of the script.
   // Note: The memory pointed to by aFileName is owned by the
   // nsIScriptTimeoutHandler and should not be freed by the caller.
   virtual void GetLocation(const char **aFileName, PRUint32 *aLineNo) = 0;
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -62,17 +62,17 @@ public:
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsJSScriptTimeoutHandler)
 
   nsJSScriptTimeoutHandler();
   ~nsJSScriptTimeoutHandler();
 
   virtual const PRUnichar *GetHandlerText();
-  virtual void *GetScriptObject() {
+  virtual JSObject *GetScriptObject() {
     return mFunObj;
   }
   virtual void GetLocation(const char **aFileName, PRUint32 *aLineNo) {
     *aFileName = mFileName.get();
     *aLineNo = mLineNo;
   }
 
   virtual PRUint32 GetScriptTypeID() {