WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jul 2006 20:22:31 +0000 (20:22 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jul 2006 20:22:31 +0000 (20:22 +0000)
2006-07-18  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9959
        REGRESSION: iframes stop rendering after 200th one on successive reloads

        * html/HTMLFrameElement.cpp:
        (WebCore::HTMLFrameElement::attach):
        (WebCore::HTMLFrameElement::close):
        * html/HTMLIFrameElement.cpp:
        (WebCore::HTMLIFrameElement::insertedIntoDocument):
        (WebCore::HTMLIFrameElement::willRemove):
        Remove calls to incrementFrameCount and decrementFrameCount.

        * page/Frame.cpp:
        (WebCore::Frame::Frame):
        Call incrementFrameCount here.

        (WebCore::Frame::~Frame):
        Call disconnectOwnerElement.

        (WebCore::Frame::disconnectOwnerElement):
        Call decrementFrameCount here.

LayoutTests:

2006-07-18  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9959
        REGRESSION: iframes stop rendering after 200th one on successive reloads

        * fast/frames/frame-limit-expected.txt: Added.
        * fast/frames/frame-limit.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15506 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/frames/frame-limit-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/frame-limit.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLFrameElement.cpp
WebCore/html/HTMLIFrameElement.cpp
WebCore/page/Frame.cpp

index 3202d0e430bfd40357f6386f537d83f380253941..936e8f888637523560759c3dde0c65c54cf638d7 100644 (file)
@@ -1,3 +1,13 @@
+2006-07-18  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=9959
+        REGRESSION: iframes stop rendering after 200th one on successive reloads
+
+        * fast/frames/frame-limit-expected.txt: Added.
+        * fast/frames/frame-limit.html: Added.
+
 2006-07-18  Darin Adler  <darin@apple.com>
 
         Reviewed by Alice.
diff --git a/LayoutTests/fast/frames/frame-limit-expected.txt b/LayoutTests/fast/frames/frame-limit-expected.txt
new file mode 100644 (file)
index 0000000..c6e6ec9
--- /dev/null
@@ -0,0 +1,3 @@
+This tests that frames are properly deregistered with the page's counter when removed. If this test is successful, the text "SUCCESS" will be shown below.
+SUCCESS
+
diff --git a/LayoutTests/fast/frames/frame-limit.html b/LayoutTests/fast/frames/frame-limit.html
new file mode 100644 (file)
index 0000000..3ab5938
--- /dev/null
@@ -0,0 +1,39 @@
+<script>
+       function addFrames() {
+         var parent = document.createElement('iframe');
+         parent.id = 'theframe';
+         document.body.appendChild(parent);
+       
+         for (i = 0; i < 150; i++) {
+           var frame = document.createElement("iframe");
+           frame.setAttribute("src", "data:text/plain," + i);
+           frame.style.display = 'none';
+           parent.contentDocument.body.appendChild(frame);
+         }             
+       }
+       
+       function runTest() {
+               if (window.layoutTestController)
+                       layoutTestController.dumpAsText();
+                       
+               // Add 150 frames. 
+               addFrames();
+
+               // Remove the parent frame
+               var parent = document.getElementById('theframe');
+               parent.parentNode.removeChild(parent);
+
+               // Add 150 frames again.
+               addFrames();
+               var parent = document.getElementById('theframe');
+
+               if (parent.contentWindow.frames.length != 150)
+                       return;
+                       
+               document.getElementById('result').innerHTML = 'SUCCESS';
+       }
+</script>
+<body onload="runTest()">
+<div>This tests that frames are properly deregistered with the page's counter when removed. If this test is successful, the text "SUCCESS" will be shown below.</div>
+<div id="result">FAILURE</div>
+</body>
index a974c76fd4b8b6c3598afe7d645e0e97fde65122..a2a5e857a3aad4badf0a2dd9b5860460d4f7d1fb 100644 (file)
@@ -1,3 +1,28 @@
+2006-07-18  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=9959
+        REGRESSION: iframes stop rendering after 200th one on successive reloads
+        
+        * html/HTMLFrameElement.cpp:
+        (WebCore::HTMLFrameElement::attach):
+        (WebCore::HTMLFrameElement::close):
+        * html/HTMLIFrameElement.cpp:
+        (WebCore::HTMLIFrameElement::insertedIntoDocument):
+        (WebCore::HTMLIFrameElement::willRemove):
+        Remove calls to incrementFrameCount and decrementFrameCount.
+        
+        * page/Frame.cpp:
+        (WebCore::Frame::Frame):
+        Call incrementFrameCount here.
+        
+        (WebCore::Frame::~Frame):
+        Call disconnectOwnerElement.
+        
+        (WebCore::Frame::disconnectOwnerElement):
+        Call decrementFrameCount here.
+        
 2006-07-18  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Darin.
index 78b1770880eea79db73dc9e723b577806ba5bcd8..bf0958ecde5130b6aba3c7d85c53e430591fce9c 100644 (file)
@@ -211,8 +211,6 @@ void HTMLFrameElement::attach()
     if (!frame)
         return;
 
-    frame->page()->incrementFrameCount();
-    
     AtomicString relativeURL = m_URL;
     if (relativeURL.isEmpty())
         relativeURL = "about:blank";
@@ -231,7 +229,6 @@ void HTMLFrameElement::close()
     Frame* frame = document()->frame();
     if (renderer() && frame) {
         frame->disconnectOwnerElement();
-        frame->page()->decrementFrameCount();
         if (Frame* childFrame = frame->tree()->child(m_name))
             childFrame->frameDetached();
     }
index 8c57c6d654d89f3fcf5b3cb82f844cb4b35a0556..a9c6e5f8f69ee50fd2913d674520ca4768d9ed8d 100644 (file)
@@ -99,9 +99,7 @@ void HTMLIFrameElement::insertedIntoDocument()
     if (m_name.isNull())
         m_name = getAttribute(idAttr);
     
-    Frame* parentFrame = document()->frame();
-    if (parentFrame) {
-        parentFrame->page()->incrementFrameCount();
+    if (Frame* parentFrame = document()->frame()) {
         m_name = parentFrame->tree()->uniqueChildName(m_name);
         
         openURL();
@@ -112,7 +110,6 @@ void HTMLIFrameElement::willRemove()
 {
     if (Frame* frame = contentFrame()) {
         frame->disconnectOwnerElement();
-        frame->page()->decrementFrameCount();
         frame->frameDetached();
         ASSERT(!contentFrame());
     }
index 099d5d84ae9400a8ac8ba56fa82537e7132fe033..01aff4f05cb136b78d8c566c049ced466cb44ca3 100644 (file)
@@ -162,6 +162,9 @@ Frame::Frame(Page* page, Element* ownerElement)
     XMLNames::init();
 #endif
 
+    if (d->m_ownerElement)
+        d->m_page->incrementFrameCount();
+
     // FIXME: Frames were originally created with a refcount of 1, leave this
     // ref call here until we can straighten that out.
     ref();
@@ -194,6 +197,8 @@ Frame::~Frame()
             w = 0;
         }
 
+    disconnectOwnerElement();
+    
     if (d->m_domWindow)
         d->m_domWindow->disconnectFrame();
             
@@ -3583,6 +3588,9 @@ void Frame::started()
 
 void Frame::disconnectOwnerElement()
 {
+    if (d->m_ownerElement)
+        d->m_page->decrementFrameCount();
+        
     d->m_ownerElement = 0;
 }