Bug 1190921 - Broadcastchannel keeps its containing iframe in memory when it has a user defined property, r=khuey
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 06 Aug 2015 01:26:00 +0300
changeset 288122 d3c82823fb482d01db694057476d07d063e67bef
parent 288121 c5f710ed8718c44cee5853813a1f3b988317f449
child 288123 0c95a8b88ecd59024269691d21b4cd99ec474ac7
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1190921
milestone42.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 1190921 - Broadcastchannel keeps its containing iframe in memory when it has a user defined property, r=khuey
dom/broadcastchannel/BroadcastChannel.cpp
dom/broadcastchannel/tests/test_broadcastchannel_basic.html
--- a/dom/broadcastchannel/BroadcastChannel.cpp
+++ b/dom/broadcastchannel/BroadcastChannel.cpp
@@ -649,20 +649,16 @@ NS_IMETHODIMP
 BroadcastChannel::Observe(nsISupports* aSubject, const char* aTopic,
                           const char16_t* aData)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!strcmp(aTopic, "inner-window-destroyed"));
 
   // If the window is destroyed we have to release the reference that we are
   // keeping.
-  if (!mIsKeptAlive) {
-    return NS_OK;
-  }
-
   nsCOMPtr<nsISupportsPRUint64> wrapper = do_QueryInterface(aSubject);
   NS_ENSURE_TRUE(wrapper, NS_ERROR_FAILURE);
 
   uint64_t innerID;
   nsresult rv = wrapper->GetData(&innerID);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (innerID == mInnerID) {
--- a/dom/broadcastchannel/tests/test_broadcastchannel_basic.html
+++ b/dom/broadcastchannel/tests/test_broadcastchannel_basic.html
@@ -47,16 +47,21 @@ function runTest() {
   var ifr = document.createElement("iframe");
   ifr.addEventListener("load", iframeLoaded, false);
   ifr.setAttribute('src', "iframe_broadcastchannel.html");
   div.appendChild(ifr);
 
   function iframeLoaded() {
     bc.postMessage("Hello world from the window!");
   }
+
+  // A leak test
+  var dummyBc = new BroadcastChannel("dont_leak_this");
+  dummyBc.foo = "bar";
+  // don't add message listener!
 }
 
 SimpleTest.waitForExplicitFinish();
 runTest();
 
 </script>
 </body>
 </html>