Reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Feb 2006 10:48:56 +0000 (10:48 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Feb 2006 10:48:56 +0000 (10:48 +0000)
       - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3400
         setting the .src of an iframe to the same value does not reload page

        Test cases:
        * fast/frames/frame-set-same-location.html
        * fast/frames/frame-set-same-src.html
        * fast/frames/iframe-set-same-location.html
        * fast/frames/iframe-set-same-src.html

        * khtml/html/html_baseimpl.cpp:
        (WebCore::HTMLFrameElementImpl::setLocation):
        Remove the check for the new URL being different from the current one.
        Moved updateForNewURL() code into setLocation().
        * khtml/html/html_baseimpl.h:

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

16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/frames/frame-set-same-location-expected.checksum [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-location-expected.png [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-location-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-location.html [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-src-expected.checksum [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-src-expected.png [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-src-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/frame-set-same-src.html [new file with mode: 0644]
LayoutTests/fast/frames/iframe-set-same-location-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/iframe-set-same-location.html [new file with mode: 0644]
LayoutTests/fast/frames/iframe-set-same-src-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/iframe-set-same-src.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/khtml/html/html_baseimpl.cpp
WebCore/khtml/html/html_baseimpl.h

index ffd8a71702bd4ee58ec2ebc9adc6f880938f1832..509b8efc7c7b879113295cc6e2116de36f0a8c6c 100644 (file)
@@ -1,3 +1,23 @@
+2006-02-11  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+       - tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=3400
+         setting the .src of an iframe to the same value does not reload page
+
+        * fast/frames/frame-set-same-location-expected.checksum: Added.
+        * fast/frames/frame-set-same-location-expected.png: Added.
+        * fast/frames/frame-set-same-location-expected.txt: Added.
+        * fast/frames/frame-set-same-location.html: Added.
+        * fast/frames/frame-set-same-src-expected.checksum: Added.
+        * fast/frames/frame-set-same-src-expected.png: Added.
+        * fast/frames/frame-set-same-src-expected.txt: Added.
+        * fast/frames/frame-set-same-src.html: Added.
+        * fast/frames/iframe-set-same-location-expected.txt: Added.
+        * fast/frames/iframe-set-same-location.html: Added.
+        * fast/frames/iframe-set-same-src-expected.txt: Added.
+        * fast/frames/iframe-set-same-src.html: Added.
+
 2006-02-11  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by hyatt.
diff --git a/LayoutTests/fast/frames/frame-set-same-location-expected.checksum b/LayoutTests/fast/frames/frame-set-same-location-expected.checksum
new file mode 100644 (file)
index 0000000..740152a
--- /dev/null
@@ -0,0 +1 @@
+8d2e281b8248afb116f3771e59ead7f0
\ No newline at end of file
diff --git a/LayoutTests/fast/frames/frame-set-same-location-expected.png b/LayoutTests/fast/frames/frame-set-same-location-expected.png
new file mode 100644 (file)
index 0000000..f2e812a
Binary files /dev/null and b/LayoutTests/fast/frames/frame-set-same-location-expected.png differ
diff --git a/LayoutTests/fast/frames/frame-set-same-location-expected.txt b/LayoutTests/fast/frames/frame-set-same-location-expected.txt
new file mode 100644 (file)
index 0000000..a2c25cd
--- /dev/null
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderFrameSet {FRAMESET} at (0,0) size 800x600
+      RenderFrame {FRAME} at (0,0) size 398x600
+        layer at (0,0) size 396x596
+          RenderCanvas at (0,0) size 396x596
+        layer at (0,0) size 396x596
+          RenderBlock {HTML} at (0,0) size 396x596
+            RenderBody {BODY} at (8,8) size 380x572
+              RenderBlock {P} at (0,0) size 380x36
+                RenderText {TEXT} at (0,0) size 53x18
+                  text run at (0,0) width 53: "Test for "
+                RenderInline {A} at (0,0) size 60x18 [color=#0000EE]
+                  RenderText {TEXT} at (53,0) size 60x18
+                    text run at (53,0) width 60: "bug 3400"
+                RenderText {TEXT} at (113,0) size 366x36
+                  text run at (113,0) width 253: ": setting the .src of an iframe to the same"
+                  text run at (0,18) width 172: "value does not reload page."
+              RenderBlock {P} at (0,52) size 380x36
+                RenderText {TEXT} at (0,0) size 375x36
+                  text run at (0,0) width 375: "Testing that setting contentWindow.location.href of a frame"
+                  text run at (0,18) width 152: "to the same value works"
+              RenderBlock {P} at (0,104) size 380x18
+                RenderText {TEXT} at (0,0) size 71x18
+                  text run at (0,0) width 71: "SUCCESS"
+      RenderFrame {FRAME} at (402,0) size 398x600
+        layer at (0,0) size 396x596
+          RenderCanvas at (0,0) size 396x596
+        layer at (0,0) size 396x596
+          RenderBlock {HTML} at (0,0) size 396x596
+            RenderBody {BODY} at (8,8) size 380x580 [bgcolor=#800080]
diff --git a/LayoutTests/fast/frames/frame-set-same-location.html b/LayoutTests/fast/frames/frame-set-same-location.html
new file mode 100644 (file)
index 0000000..2bc4963
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<script>
+    
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+
+    function reportSuccess() {
+               console = document.getElementById("left_frame").contentWindow.document.getElementById("console");
+               if (console.firstChild.nodeValue == "FAILURE") {
+            console.firstChild.nodeValue = "PROCESSING...";
+            document.getElementById("right_frame").contentWindow.location.href = "resources/purple.html";
+        } else {
+            console.firstChild.nodeValue = "SUCCESS";
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+    }
+    
+</script>
+</head>
+<frameset cols="50%,*">
+<frame id="left_frame" src="data:text/html,<body><p>Test for <a href='http://bugzilla.opendarwin.org/show_bug.cgi?id=3400'>bug 3400</a>: setting the .src of an iframe to the same value does not reload page.</p><p>Testing that setting contentWindow.location.href of a frame to the same value works</p><p id=console>FAILURE</p></body>">
+<frame id="right_frame" onload="javascript:reportSuccess()" src="resources/purple.html"></iframe>
+</frameset>
+</html>
diff --git a/LayoutTests/fast/frames/frame-set-same-src-expected.checksum b/LayoutTests/fast/frames/frame-set-same-src-expected.checksum
new file mode 100644 (file)
index 0000000..e14a979
--- /dev/null
@@ -0,0 +1 @@
+d5dc1cc4a7a30032feb4b66cdc8cd435
\ No newline at end of file
diff --git a/LayoutTests/fast/frames/frame-set-same-src-expected.png b/LayoutTests/fast/frames/frame-set-same-src-expected.png
new file mode 100644 (file)
index 0000000..5ddb28b
Binary files /dev/null and b/LayoutTests/fast/frames/frame-set-same-src-expected.png differ
diff --git a/LayoutTests/fast/frames/frame-set-same-src-expected.txt b/LayoutTests/fast/frames/frame-set-same-src-expected.txt
new file mode 100644 (file)
index 0000000..b984dad
--- /dev/null
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderFrameSet {FRAMESET} at (0,0) size 800x600
+      RenderFrame {FRAME} at (0,0) size 398x600
+        layer at (0,0) size 396x596
+          RenderCanvas at (0,0) size 396x596
+        layer at (0,0) size 396x596
+          RenderBlock {HTML} at (0,0) size 396x596
+            RenderBody {BODY} at (8,8) size 380x572
+              RenderBlock {P} at (0,0) size 380x36
+                RenderText {TEXT} at (0,0) size 53x18
+                  text run at (0,0) width 53: "Test for "
+                RenderInline {A} at (0,0) size 60x18 [color=#0000EE]
+                  RenderText {TEXT} at (53,0) size 60x18
+                    text run at (53,0) width 60: "bug 3400"
+                RenderText {TEXT} at (113,0) size 366x36
+                  text run at (113,0) width 253: ": setting the .src of an iframe to the same"
+                  text run at (0,18) width 172: "value does not reload page."
+              RenderBlock {P} at (0,52) size 380x36
+                RenderText {TEXT} at (0,0) size 341x36
+                  text run at (0,0) width 341: "Testing that setting an src of a frame to the same value"
+                  text run at (0,18) width 39: "works"
+              RenderBlock {P} at (0,104) size 380x18
+                RenderText {TEXT} at (0,0) size 71x18
+                  text run at (0,0) width 71: "SUCCESS"
+      RenderFrame {FRAME} at (402,0) size 398x600
+        layer at (0,0) size 396x596
+          RenderCanvas at (0,0) size 396x596
+        layer at (0,0) size 396x596
+          RenderBlock {HTML} at (0,0) size 396x596
+            RenderBody {BODY} at (8,8) size 380x580 [bgcolor=#800080]
diff --git a/LayoutTests/fast/frames/frame-set-same-src.html b/LayoutTests/fast/frames/frame-set-same-src.html
new file mode 100644 (file)
index 0000000..3580fc7
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<script>
+    
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+
+    function reportSuccess() {
+               console = document.getElementById("left_frame").contentWindow.document.getElementById("console");
+               if (console.firstChild.nodeValue == "FAILURE") {
+            console.firstChild.nodeValue = "PROCESSING...";
+            document.getElementById("right_frame").src = "resources/purple.html";
+        } else {
+            console.firstChild.nodeValue = "SUCCESS";
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+    }
+    
+</script>
+</head>
+<frameset cols="50%,*">
+<frame id="left_frame" src="data:text/html,<body><p>Test for <a href='http://bugzilla.opendarwin.org/show_bug.cgi?id=3400'>bug 3400</a>: setting the .src of an iframe to the same value does not reload page.</p><p>Testing that setting an src of a frame to the same value works</p><p id=console>FAILURE</p></body>">
+<frame id="right_frame" onload="javascript:reportSuccess()" src="resources/purple.html"></iframe>
+</frameset>
+</html>
diff --git a/LayoutTests/fast/frames/iframe-set-same-location-expected.txt b/LayoutTests/fast/frames/iframe-set-same-location-expected.txt
new file mode 100644 (file)
index 0000000..3129976
--- /dev/null
@@ -0,0 +1,7 @@
+Test for bug 3400: setting the .src of an iframe to the same value does not reload page.
+
+Testing that setting contentWindow.location.href to the same value works
+
+SUCCESS
+
+
diff --git a/LayoutTests/fast/frames/iframe-set-same-location.html b/LayoutTests/fast/frames/iframe-set-same-location.html
new file mode 100644 (file)
index 0000000..d341ece
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<script>
+    
+    function reportSuccess() {
+        if (document.getElementById("console").firstChild.nodeValue == "FAILURE") {
+            document.getElementById("console").firstChild.nodeValue = "PROCESSING...";
+            document.getElementById("anIFrame").contentWindow.location.href = "resources/purple.html";
+        } else {
+            document.getElementById("console").firstChild.nodeValue = "SUCCESS";
+            layoutTestController.notifyDone();
+        }
+    }
+    
+</script>
+</head>
+<body>
+  <script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+  </script>
+
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3400">bug 3400</a>: setting the .src of an iframe to the same value does not reload page.</p>
+<p>Testing that setting contentWindow.location.href to the same value works</p>
+<p id=console>FAILURE</p>
+<iframe style="width:350px;border:dotted green 1px" width="200" height="200" id="anIFrame" onload="javascript:reportSuccess()" src="resources/purple.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/fast/frames/iframe-set-same-src-expected.txt b/LayoutTests/fast/frames/iframe-set-same-src-expected.txt
new file mode 100644 (file)
index 0000000..a9f309f
--- /dev/null
@@ -0,0 +1,5 @@
+Test for bug 3400: setting the .src of an iframe to the same value does not reload page.
+
+SUCCESS
+
+
diff --git a/LayoutTests/fast/frames/iframe-set-same-src.html b/LayoutTests/fast/frames/iframe-set-same-src.html
new file mode 100644 (file)
index 0000000..421d7ef
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<script>
+    
+    function reportSuccess() {
+        if (document.getElementById("console").firstChild.nodeValue == "FAILURE") {
+            document.getElementById("console").firstChild.nodeValue = "PROCESSING...";
+            document.getElementById("anIFrame").src = "resources/purple.html";
+        } else {
+            document.getElementById("console").firstChild.nodeValue = "SUCCESS";
+            layoutTestController.notifyDone();
+        }
+    }
+    
+</script>
+</head>
+<body>
+  <script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+  </script>
+
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3400">bug 3400</a>: setting the .src of an iframe to the same value does not reload page.</p>
+<p id=console>FAILURE</p>
+<iframe style="width:350px;border:dotted green 1px" width="200" height="200" id="anIFrame" onload="javascript:reportSuccess()" src="resources/purple.html"></iframe>
+</body>
+</html>
index 0cff1fe46bceaa8b77508dd6a8e5ea437e550f30..bbff94e50c9a546cf64ba506cd1afb29a3e71b31 100644 (file)
@@ -1,3 +1,22 @@
+2006-02-11  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+       - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3400
+         setting the .src of an iframe to the same value does not reload page
+
+        Test cases: 
+        * fast/frames/frame-set-same-location.html
+        * fast/frames/frame-set-same-src.html
+        * fast/frames/iframe-set-same-location.html
+        * fast/frames/iframe-set-same-src.html
+
+        * khtml/html/html_baseimpl.cpp:
+        (WebCore::HTMLFrameElementImpl::setLocation):
+        Remove the check for the new URL being different from the current one.
+        Moved updateForNewURL() code into setLocation().
+        * khtml/html/html_baseimpl.h:
+
 2006-02-10  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by hyatt.
index e7d4c2d8fc5f55d6b5ce34faf890b6db639d0f85..bfd1903a7c1e927b04302127cc8bca34bf955cdb 100644 (file)
@@ -321,27 +321,6 @@ bool HTMLFrameElementImpl::isURLAllowed(const AtomicString &URLString) const
     return true;
 }
 
-void HTMLFrameElementImpl::updateForNewURL()
-{
-    if (!attached()) {
-        return;
-    }
-    
-    // Handle the common case where we decided not to make a frame the first time.
-    // Detach and the let attach() decide again whether to make the frame for this URL.
-    if (!renderer()) {
-        detach();
-        attach();
-        return;
-    }
-    
-    if (!isURLAllowed(m_URL)) {
-        return;
-    }
-
-    openURL();
-}
-
 void HTMLFrameElementImpl::openURL()
 {
     DocumentImpl *d = getDocument();
@@ -495,12 +474,27 @@ void HTMLFrameElementImpl::detach()
     HTMLElementImpl::detach();
 }
 
-void HTMLFrameElementImpl::setLocation( const DOMString& str )
+void HTMLFrameElementImpl::setLocation(const DOMString& str)
 {
-    if (m_URL == str)
-        return;
     m_URL = AtomicString(str);
-    updateForNewURL();
+
+    if (!attached()) {
+        return;
+    }
+    
+    // Handle the common case where we decided not to make a frame the first time.
+    // Detach and the let attach() decide again whether to make the frame for this URL.
+    if (!renderer()) {
+        detach();
+        attach();
+        return;
+    }
+    
+    if (!isURLAllowed(m_URL)) {
+        return;
+    }
+
+    openURL();
 }
 
 bool HTMLFrameElementImpl::isFocusable() const
index af785f19559c13b86a750e6be0329ac78c0dfaf9..1bdcdf350864d66514b10a6b41353489a62584fd 100644 (file)
@@ -162,9 +162,6 @@ protected:
     bool m_frameBorder : 1;
     bool m_frameBorderSet : 1;
     bool m_noResize : 1;
-
-private:
-    void updateForNewURL();
 };
 
 // -------------------------------------------------------------------------