Bug 620000 - Remove nsXULPDGlobalObject::OnFinalize's language id parameter; r=jst
authorMs2ger <ms2ger@gmail.com>
Thu, 14 Apr 2011 14:04:08 +0200
changeset 68109 511198a0befa38944c1418f0327ff48fe622e493
parent 68108 8d3962816279b122495cfc8a22a4b985b35b7d97
child 68110 c5f9a0fb6c67bcdd9709cf7468b6d6401e615091
push id19513
push userMs2ger@gmail.com
push dateThu, 14 Apr 2011 12:08:45 +0000
treeherdermozilla-central@931c401f7d37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs620000
milestone6.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 620000 - Remove nsXULPDGlobalObject::OnFinalize's language id parameter; r=jst
content/xbl/src/nsXBLDocumentInfo.cpp
content/xul/document/src/nsXULPrototypeDocument.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsIScriptGlobalObject.h
--- a/content/xbl/src/nsXBLDocumentInfo.cpp
+++ b/content/xbl/src/nsXBLDocumentInfo.cpp
@@ -71,17 +71,17 @@ public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   
   // nsIScriptGlobalObject methods
   virtual nsresult EnsureScriptEnvironment(PRUint32 aLangID);
   virtual nsresult SetScriptContext(PRUint32 lang_id, nsIScriptContext *aContext);
 
   virtual nsIScriptContext *GetContext();
   virtual JSObject *GetGlobalJSObject();
-  virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal);
+  virtual void OnFinalize(JSObject* aObject);
   virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
 
   // nsIScriptObjectPrincipal methods
   virtual nsIPrincipal* GetPrincipal();
 
   static JSBool doCheckAccess(JSContext *cx, JSObject *obj, jsid id,
                               PRUint32 accessType);
 
@@ -162,17 +162,17 @@ nsXBLDocGlobalObject_checkAccess(JSConte
 static void
 nsXBLDocGlobalObject_finalize(JSContext *cx, JSObject *obj)
 {
   nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(cx, obj);
 
   nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(nativeThis));
 
   if (sgo)
-    sgo->OnFinalize(nsIProgrammingLanguage::JAVASCRIPT, obj);
+    sgo->OnFinalize(obj);
 
   // The addref was part of JSObject construction
   NS_RELEASE(nativeThis);
 }
 
 static JSBool
 nsXBLDocGlobalObject_resolve(JSContext *cx, JSObject *obj, jsid id)
 {
@@ -378,23 +378,20 @@ nsXBLDocGlobalObject::GetGlobalJSObject(
     return nsnull;
 
   JSObject *ret = ::JS_GetGlobalObject(cx);
   NS_ASSERTION(mJSObject == ret, "How did this magic switch happen?");
   return ret;
 }
 
 void
-nsXBLDocGlobalObject::OnFinalize(PRUint32 aLangID, void *aObject)
+nsXBLDocGlobalObject::OnFinalize(JSObject* aObject)
 {
-  NS_ASSERTION(aLangID == nsIProgrammingLanguage::JAVASCRIPT,
-               "Only JS supported");
   NS_ASSERTION(aObject == mJSObject, "Wrong object finalized!");
-
-  mJSObject = nsnull;
+  mJSObject = NULL;
 }
 
 void
 nsXBLDocGlobalObject::SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts)
 {
     // We don't care...
 }
 
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp
+++ b/content/xul/document/src/nsXULPrototypeDocument.cpp
@@ -76,17 +76,17 @@ class nsXULPDGlobalObject : public nsISc
 {
 public:
     nsXULPDGlobalObject(nsXULPrototypeDocument* owner);
 
     // nsISupports interface
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
     // nsIScriptGlobalObject methods
-    virtual void OnFinalize(PRUint32 aLangID, void *aGlobal);
+    virtual void OnFinalize(JSObject* aObject);
     virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
 
     virtual void *GetScriptGlobal(PRUint32 lang);
     virtual nsresult EnsureScriptEnvironment(PRUint32 aLangID);
 
     virtual nsIScriptContext *GetScriptContext(PRUint32 lang);
     virtual nsresult SetScriptContext(PRUint32 language, nsIScriptContext *ctx);
 
@@ -119,17 +119,17 @@ PRUint32 nsXULPrototypeDocument::gRefCnt
 void
 nsXULPDGlobalObject_finalize(JSContext *cx, JSObject *obj)
 {
     nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(cx, obj);
 
     nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(nativeThis));
 
     if (sgo) {
-        sgo->OnFinalize(nsIProgrammingLanguage::JAVASCRIPT, obj);
+        sgo->OnFinalize(obj);
     }
 
     // The addref was part of JSObject construction
     NS_RELEASE(nativeThis);
 }
 
 
 JSBool
@@ -772,20 +772,18 @@ nsXULPDGlobalObject::ClearGlobalObjectOw
     mContext = NULL;
   }
 
   mGlobalObjectOwner = NULL;
 }
 
 
 void
-nsXULPDGlobalObject::OnFinalize(PRUint32 aLangID, void *aObject)
+nsXULPDGlobalObject::OnFinalize(JSObject* aObject)
 {
-  NS_ABORT_IF_FALSE(aLangID == nsIProgrammingLanguage::JAVASCRIPT,
-                    "We don't support this language ID");
   mJSObject = NULL;
 }
 
 void
 nsXULPDGlobalObject::SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts)
 {
   // We don't care...
 }
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -7074,17 +7074,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
 
 NS_IMETHODIMP
 nsWindowSH::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                      JSObject *obj)
 {
   nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(sgo, NS_ERROR_UNEXPECTED);
 
-  sgo->OnFinalize(nsIProgrammingLanguage::JAVASCRIPT, obj);
+  sgo->OnFinalize(obj);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowSH::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
                      JSObject * obj, const jsval &val, PRBool *bp)
 {
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2755,23 +2755,20 @@ nsGlobalWindow::DispatchDOMEvent(nsEvent
 {
   return
     nsEventDispatcher::DispatchDOMEvent(static_cast<nsPIDOMWindow*>(this),
                                        aEvent, aDOMEvent, aPresContext,
                                        aEventStatus);
 }
 
 void
-nsGlobalWindow::OnFinalize(PRUint32 aLangID, void *aObject)
-{
-  NS_ASSERTION(aLangID == nsIProgrammingLanguage::JAVASCRIPT,
-               "We don't support this language ID");
-
+nsGlobalWindow::OnFinalize(JSObject* aObject)
+{
   if (aObject == mJSObject) {
-    mJSObject = nsnull;
+    mJSObject = NULL;
   }
 }
 
 void
 nsGlobalWindow::SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts)
 {
   FORWARD_TO_INNER_VOID(SetScriptsEnabled, (aEnabled, aFireTimeouts));
 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -315,17 +315,17 @@ public:
 
   virtual nsIScriptContext *GetScriptContext(PRUint32 lang);
   virtual void *GetScriptGlobal(PRUint32 lang);
 
   // Set a new script language context for this global.  The native global
   // for the context is created by the context's GetNativeGlobal() method.
   virtual nsresult SetScriptContext(PRUint32 lang, nsIScriptContext *aContext);
   
-  virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal);
+  virtual void OnFinalize(JSObject* aObject);
   virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
 
   // nsIScriptObjectPrincipal
   virtual nsIPrincipal* GetPrincipal();
 
   // nsIDOMWindow
   NS_DECL_NSIDOMWINDOW
 
--- a/dom/base/nsIScriptGlobalObject.h
+++ b/dom/base/nsIScriptGlobalObject.h
@@ -95,22 +95,22 @@ struct JSObject; // until we finally rem
 // aStatus will be filled in with the status.
 PRBool
 NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
                      nsScriptErrorEvent *aErrorEvent,
                      nsEventStatus *aStatus);
 
 
 #define NS_ISCRIPTGLOBALOBJECT_IID \
-{ 0xe9f3f2c1, 0x2d94, 0x4722, \
-  { 0xbb, 0xd4, 0x2b, 0xf6, 0xfd, 0xf4, 0x2f, 0x48 } }
+{ 0x4eb16819, 0x4e81, 0x406e, \
+  { 0x93, 0x05, 0x6f, 0x30, 0xfc, 0xd2, 0x62, 0x4a } }
 
 /**
-  * The global object which keeps a script context for each supported script
-  * language. This often used to store per-window global state.
+ * The global object which keeps a script context for each supported script
+ * language. This often used to store per-window global state.
  */
 
 class nsIScriptGlobalObject : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTGLOBALOBJECT_IID)
 
   /**
@@ -151,18 +151,17 @@ public:
 
   /**
    * Called when the global script for a language is finalized, typically as
    * part of its GC process.  By the time this call is made, the
    * nsIScriptContext for the language has probably already been removed.
    * After this call, the passed object is dead - which should generally be the
    * same object the global is using for a global for that language.
    */
-
-  virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal) = 0;
+  virtual void OnFinalize(JSObject* aObject) = 0;
 
   /**
    * Called to enable/disable scripts.
    */
   virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts) = 0;
 
   /**
    * Handle a script error.  Generally called by a script context.