Bug 784190 - Fix Cycle collection casting in DOMRequest, r=mccr8
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 27 Aug 2012 09:44:25 -0700
changeset 105611 56e4e0a05753b36c4cd9ec17733292289b9f1e1a
parent 105610 d6aeeb24e99ef5a940b6fdcef573021589ad88ff
child 105612 0e99f557ca93a20e192f92f3dd385e65a203177c
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersmccr8
bugs784190
milestone17.0a1
Bug 784190 - Fix Cycle collection casting in DOMRequest, r=mccr8
dom/base/DOMRequest.cpp
dom/base/DOMRequest.h
dom/file/FileRequest.cpp
dom/file/FileRequest.h
--- a/dom/base/DOMRequest.cpp
+++ b/dom/base/DOMRequest.cpp
@@ -174,17 +174,20 @@ DOMRequest::FireEvent(const nsAString& a
   bool dummy;
   DispatchEvent(event, &dummy);
 }
 
 void
 DOMRequest::RootResultVal()
 {
   NS_ASSERTION(!mRooted, "Don't call me if already rooted!");
-  NS_HOLD_JS_OBJECTS(this, DOMRequest);
+  nsXPCOMCycleCollectionParticipant *participant;
+  CallQueryInterface(this, &participant);
+  nsContentUtils::HoldJSObjects(NS_CYCLE_COLLECTION_UPCAST(this, DOMRequest),
+                                participant);
   mRooted = true;
 }
 
 void
 DOMRequest::UnrootResultVal()
 {
   NS_ASSERTION(mRooted, "Don't call me if not rooted!");
   NS_DROP_JS_OBJECTS(this, DOMRequest);
--- a/dom/base/DOMRequest.h
+++ b/dom/base/DOMRequest.h
@@ -49,18 +49,18 @@ public:
     if (mRooted) {
       UnrootResultVal();
     }
   }
 
 protected:
   void FireEvent(const nsAString& aType, bool aBubble, bool aCancelable);
 
-  virtual void RootResultVal();
-  virtual void UnrootResultVal();
+  void RootResultVal();
+  void UnrootResultVal();
 
   void Init(nsIDOMWindow* aWindow);
 };
 
 class DOMRequestService MOZ_FINAL : public nsIDOMRequestService
 {
 public:
   NS_DECL_ISUPPORTS
--- a/dom/file/FileRequest.cpp
+++ b/dom/file/FileRequest.cpp
@@ -155,19 +155,8 @@ FileRequest::FireProgressEvent(uint64_t 
   }
 
   bool dummy;
   rv = DispatchEvent(static_cast<nsIDOMProgressEvent*>(event), &dummy);
   if (NS_FAILED(rv)) {
     return;
   }
 }
-
-void
-FileRequest::RootResultVal()
-{
-  NS_ASSERTION(!mRooted, "Don't call me if already rooted!");
-  nsXPCOMCycleCollectionParticipant *participant;
-  CallQueryInterface(this, &participant);
-  nsContentUtils::HoldJSObjects(NS_CYCLE_COLLECTION_UPCAST(this, DOMRequest),
-                                participant);
-  mRooted = true;
-}
--- a/dom/file/FileRequest.h
+++ b/dom/file/FileRequest.h
@@ -46,19 +46,16 @@ public:
 
 private:
   FileRequest(nsIDOMWindow* aWindow);
   ~FileRequest();
 
   void
   FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
 
-  virtual void
-  RootResultVal();
-
   nsRefPtr<LockedFile> mLockedFile;
   bool mIsFileRequest;
 
   NS_DECL_EVENT_HANDLER(progress)
 };
 
 END_FILE_NAMESPACE