[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

dbates at webkit.org dbates at webkit.org
Wed Dec 22 15:49:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7ce7b61c3af56606e730531533b36b9b6a6d190f
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 13 06:46:46 2010 +0000

    2010-11-12  Daniel Bates  <dbates at rim.com>
    
            Reviewed by Adam Barth.
    
            Transferred <iframe>s may not have a unique internal name
            https://bugs.webkit.org/show_bug.cgi?id=48768
    
            Fixes an issue where an <iframe> that is transferred from
            document A to document B, where A != B, may not have a
            unique internal name in B.
    
            Test: fast/frames/iframe-reparenting-unique-name.html
    
            * html/HTMLFrameElementBase.cpp:
            (WebCore::HTMLFrameElementBase::setNameAndOpenURL): Inlined code from
            HTMLFrameElementBase::setName() so that we can remove setName(), which
            was only called being called by HTMLFrameElementBase::setNameAndOpenURL().
            * html/HTMLFrameElementBase.h: Removed HTMLFrameElementBase::setName().
            * html/HTMLFrameOwnerElement.h: Removed HTMLFrameOwnerElement::setName().
            * page/Frame.cpp:
            (WebCore::Frame::transferChildFrameToNewDocument): Modified to call FrameTree::transferChild().
            * page/FrameTree.cpp:
            (WebCore::FrameTree::transferChild): Added.
            (WebCore::FrameTree::appendChild): Moved the majority of the code into FrameTree::actuallyAppendChild().
            (WebCore::FrameTree::actuallyAppendChild): Added.
            * page/FrameTree.h:
    2010-11-12  Daniel Bates  <dbates at rim.com>
    
            Reviewed by Adam Barth.
    
            Transferred <iframe>s may not have a unique internal name
            https://bugs.webkit.org/show_bug.cgi?id=48768
    
            Tests that an <iframe> which is transferred from document A to
            document B, where A != B, has a unique name in B.
    
            * fast/frames/iframe-reparenting-unique-name-expected.txt: Added.
            * fast/frames/iframe-reparenting-unique-name.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71962 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7b7eadc..e5041d8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-12  Daniel Bates  <dbates at rim.com>
+
+        Reviewed by Adam Barth.
+
+        Transferred <iframe>s may not have a unique internal name
+        https://bugs.webkit.org/show_bug.cgi?id=48768
+
+        Tests that an <iframe> which is transferred from document A to
+        document B, where A != B, has a unique name in B.
+
+        * fast/frames/iframe-reparenting-unique-name-expected.txt: Added.
+        * fast/frames/iframe-reparenting-unique-name.html: Added.
+
 2010-11-12  Tony Chang  <tony at chromium.org>
 
         Unreviewed, revert changes to script-object-invoke that crash
diff --git a/LayoutTests/fast/frames/iframe-reparenting-unique-name-expected.txt b/LayoutTests/fast/frames/iframe-reparenting-unique-name-expected.txt
new file mode 100644
index 0000000..85623d2
--- /dev/null
+++ b/LayoutTests/fast/frames/iframe-reparenting-unique-name-expected.txt
@@ -0,0 +1,18 @@
+ 
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+This test PASSED if DRT outputs two <iframe>s with unique names.
+
+
+
+--------
+Frame: '<!--framePath //<!--frame1-->/<!--frame0-->-->'
+--------
+Frame 0
+
+--------
+Frame: '<!--framePath //<!--frame1-->/<!--frame1-->-->'
+--------
+Frame 1
diff --git a/LayoutTests/fast/frames/iframe-reparenting-unique-name.html b/LayoutTests/fast/frames/iframe-reparenting-unique-name.html
new file mode 100644
index 0000000..02b923c
--- /dev/null
+++ b/LayoutTests/fast/frames/iframe-reparenting-unique-name.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpChildFramesAsText();
+}
+
+function runTest()
+{
+    var frames = document.getElementsByTagName("iframe");
+    var dummy = frames[0];
+    var testFrame = frames[1];
+    testFrame.contentDocument.adoptNode(dummy);
+    testFrame.contentDocument.body.appendChild(dummy);
+}
+window.onload = runTest;
+</script>
+</head>
+<body>
+<iframe src="data:text/plain,Frame 1"></iframe>
+<iframe src="data:text/html,<p>This test PASSED if DRT outputs two %26lt%3Biframe%26gt%3Bs with unique names.</p><iframe src='data:text/plain,Frame 0'></iframe>"></iframe>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 51143be..623c50b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-11-12  Daniel Bates  <dbates at rim.com>
+
+        Reviewed by Adam Barth.
+
+        Transferred <iframe>s may not have a unique internal name
+        https://bugs.webkit.org/show_bug.cgi?id=48768
+
+        Fixes an issue where an <iframe> that is transferred from
+        document A to document B, where A != B, may not have a
+        unique internal name in B.
+
+        Test: fast/frames/iframe-reparenting-unique-name.html
+
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::setNameAndOpenURL): Inlined code from
+        HTMLFrameElementBase::setName() so that we can remove setName(), which
+        was only called being called by HTMLFrameElementBase::setNameAndOpenURL().
+        * html/HTMLFrameElementBase.h: Removed HTMLFrameElementBase::setName().
+        * html/HTMLFrameOwnerElement.h: Removed HTMLFrameOwnerElement::setName().
+        * page/Frame.cpp:
+        (WebCore::Frame::transferChildFrameToNewDocument): Modified to call FrameTree::transferChild().
+        * page/FrameTree.cpp:
+        (WebCore::FrameTree::transferChild): Added.
+        (WebCore::FrameTree::appendChild): Moved the majority of the code into FrameTree::actuallyAppendChild().
+        (WebCore::FrameTree::actuallyAppendChild): Added.
+        * page/FrameTree.h:
+
 2010-11-12  Joseph Pecoraro  <joepeck at webkit.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp
index cba82a2..47465c6 100644
--- a/WebCore/html/HTMLFrameElementBase.cpp
+++ b/WebCore/html/HTMLFrameElementBase.cpp
@@ -148,16 +148,11 @@ void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr)
         HTMLFrameOwnerElement::parseMappedAttribute(attr);
 }
 
-void HTMLFrameElementBase::setName()
+void HTMLFrameElementBase::setNameAndOpenURL()
 {
     m_frameName = getAttribute(nameAttr);
     if (m_frameName.isNull())
         m_frameName = getIdAttribute();
-}
-
-void HTMLFrameElementBase::setNameAndOpenURL()
-{
-    setName();
     openURL();
 }
 
diff --git a/WebCore/html/HTMLFrameElementBase.h b/WebCore/html/HTMLFrameElementBase.h
index ef25f30..8770af5 100644
--- a/WebCore/html/HTMLFrameElementBase.h
+++ b/WebCore/html/HTMLFrameElementBase.h
@@ -59,8 +59,6 @@ private:
     
     virtual bool isURLAttribute(Attribute*) const;
 
-    virtual void setName();
-
     virtual void willRemove();
     void checkInDocumentTimerFired(Timer<HTMLFrameElementBase>*);
     void updateOnReparenting();
diff --git a/WebCore/html/HTMLFrameOwnerElement.h b/WebCore/html/HTMLFrameOwnerElement.h
index c84d7bb..f784f4f 100644
--- a/WebCore/html/HTMLFrameOwnerElement.h
+++ b/WebCore/html/HTMLFrameOwnerElement.h
@@ -65,7 +65,6 @@ protected:
 private:
     friend class Frame;
 
-    virtual void setName() { }
     virtual bool isFrameOwnerElement() const { return true; }
     virtual bool isKeyboardFocusable(KeyboardEvent*) const { return m_contentFrame; }
 
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index eafcb71..c14a3d8 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -732,16 +732,9 @@ void Frame::transferChildFrameToNewDocument()
         didTransfer = true;
     }
 
-    // Update the frame tree.
-    Frame* oldParent = tree()->parent();
-    if (oldParent != newParent) {
-        if (oldParent)
-            oldParent->tree()->removeChild(this);
-        if (newParent) {
-            newParent->tree()->appendChild(this);
-            m_ownerElement->setName();
-        }
-        didTransfer = true;
+    if (newParent) {
+        // Update the frame tree.
+        didTransfer = newParent->tree()->transferChild(this);
     }
 
     // Avoid unnecessary calls to client and frame subtree if the frame ended
diff --git a/WebCore/page/FrameTree.cpp b/WebCore/page/FrameTree.cpp
index 0e15379..f3f32ec 100644
--- a/WebCore/page/FrameTree.cpp
+++ b/WebCore/page/FrameTree.cpp
@@ -63,11 +63,35 @@ Frame* FrameTree::parent(bool checkForDisconnectedFrame) const
     return m_parent;
 }
 
+bool FrameTree::transferChild(PassRefPtr<Frame> child)
+{
+    Frame* oldParent = child->tree()->parent();
+    if (oldParent == m_thisFrame)
+        return false; // |child| is already a child of m_thisFrame.
+
+    if (oldParent)
+        oldParent->tree()->removeChild(child.get());
+
+    ASSERT(child->page() == m_thisFrame->page());
+    child->tree()->m_parent = m_thisFrame;
+
+    // We need to ensure that the child still has a unique frame name with respect to its new parent.
+    child->tree()->setName(child->tree()->m_name);
+
+    actuallyAppendChild(child); // Note, on return |child| is null.
+    return true;
+}
+
 void FrameTree::appendChild(PassRefPtr<Frame> child)
 {
     ASSERT(child->page() == m_thisFrame->page());
     child->tree()->m_parent = m_thisFrame;
+    actuallyAppendChild(child); // Note, on return |child| is null.
+}
 
+void FrameTree::actuallyAppendChild(PassRefPtr<Frame> child)
+{
+    ASSERT(child->tree()->m_parent == m_thisFrame);
     Frame* oldLast = m_lastChild;
     m_lastChild = child.get();
 
diff --git a/WebCore/page/FrameTree.h b/WebCore/page/FrameTree.h
index 58b7c1f..94b8d16 100644
--- a/WebCore/page/FrameTree.h
+++ b/WebCore/page/FrameTree.h
@@ -57,6 +57,7 @@ namespace WebCore {
         Frame* traversePreviousWithWrap(bool) const;
         
         void appendChild(PassRefPtr<Frame>);
+        bool transferChild(PassRefPtr<Frame>);
         void detachFromParent() { m_parent = 0; }
         void removeChild(Frame*);
 
@@ -70,6 +71,7 @@ namespace WebCore {
 
     private:
         Frame* deepLastChild() const;
+        void actuallyAppendChild(PassRefPtr<Frame>);
 
         Frame* m_thisFrame;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list