Bug 784190 - Fix Cycle collection casting in DOMRequest, r=mccr8
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 27 Aug 2012 09:44:25 -0700
changeset 103578 56e4e0a05753b36c4cd9ec17733292289b9f1e1a
parent 103577 d6aeeb24e99ef5a940b6fdcef573021589ad88ff
child 103579 0e99f557ca93a20e192f92f3dd385e65a203177c
push id23362
push userryanvm@gmail.com
push dateTue, 28 Aug 2012 02:11:38 +0000
treeherdermozilla-central@8af2ff9c6018 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs784190
milestone17.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 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