Title: [230399] releases/WebKitGTK/webkit-2.20
- Revision
- 230399
- Author
- carlo...@webkit.org
- Date
- 2018-04-09 03:53:05 -0700 (Mon, 09 Apr 2018)
Log Message
Merge r229375 - replaceState cause back/forward malfunction on html page with <base href="" tag
https://bugs.webkit.org/show_bug.cgi?id=182678
<rdar://problem/37517821>
Patch by Sihui Liu <sihui_...@apple.com> on 2018-03-07
Reviewed by Chris Dumez.
Source/WebCore:
replaceState should not change URL when the URL argument is NULL, but should change URL when the URL argument is an empty string.
Test: http/tests/history/replacestate-no-url.html
* page/History.cpp:
(WebCore::History::urlForState):
LayoutTests:
* http/tests/history/replacestate-no-url-expected.txt: Added.
* http/tests/history/replacestate-no-url.html: Added.
Add layout test coverage.
* fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt:
Rebaseline a layout test as empty string for URL is handled differently.
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog (230398 => 230399)
--- releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog 2018-04-09 10:52:54 UTC (rev 230398)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog 2018-04-09 10:53:05 UTC (rev 230399)
@@ -1,3 +1,18 @@
+2018-03-07 Sihui Liu <sihui_...@apple.com>
+
+ replaceState cause back/forward malfunction on html page with <base href="" tag
+ https://bugs.webkit.org/show_bug.cgi?id=182678
+ <rdar://problem/37517821>
+
+ Reviewed by Chris Dumez.
+
+ * http/tests/history/replacestate-no-url-expected.txt: Added.
+ * http/tests/history/replacestate-no-url.html: Added.
+ Add layout test coverage.
+
+ * fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt:
+ Rebaseline a layout test as empty string for URL is handled differently.
+
2018-03-03 Said Abou-Hallawa <sabouhall...@apple.com>
Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp
Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt (230398 => 230399)
--- releases/WebKitGTK/webkit-2.20/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt 2018-04-09 10:52:54 UTC (rev 230398)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt 2018-04-09 10:53:05 UTC (rev 230399)
@@ -27,8 +27,9 @@
Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html#otherhash
State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html#hash
Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html#hash
+State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html
+Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html
State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html#
Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html#
-State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html#
State popped with event OriginalEntry (type string) and last path component pushstate-with-fragment-urls-and-hashchange.html
Added: releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/history/replacestate-no-url-expected.txt (0 => 230399)
--- releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/history/replacestate-no-url-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/history/replacestate-no-url-expected.txt 2018-04-09 10:53:05 UTC (rev 230399)
@@ -0,0 +1,18 @@
+Tests that ReplaceState should not change document URL if URL argument is null.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Push item one
+Replace item one with null url
+Push item two
+Going back to item one
+PASS document.location.href is "http://127.0.0.1:8000/one"
+Replace item one with empty url
+Push item two
+Going back to item one
+PASS document.location.href is "http://127.0.0.1:8000/"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/history/replacestate-no-url.html (0 => 230399)
--- releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/history/replacestate-no-url.html (rev 0)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/history/replacestate-no-url.html 2018-04-09 10:53:05 UTC (rev 230399)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <base href=""
+ <script src=""
+ <script>
+ jsTestIsAsync = true;
+ description('Tests that ReplaceState should not change document URL if URL argument is null.');
+
+ function testNullUrl() {
+ debug('Push item one');
+ history.pushState({}, 'page 1', '/one');
+ debug('Replace item one with null url');
+ history.replaceState({}, 'replaced page 1');
+ debug('Push item two');
+ history.pushState({}, 'page 2', '/two');
+ debug('Going back to item one');
+ history.back();
+ }
+
+ function testEmptyUrl() {
+ debug('Replace item one with empty url');
+ history.replaceState('StopEntry', 'replaced page 1 again', '');
+ debug('Push item two');
+ history.pushState({}, 'page 2', '/two');
+ debug('Going back to item one');
+ history.back();
+ }
+
+ window._onpopstate_ = function(event) {
+ if (event.state != 'StopEntry') {
+ shouldBeEqualToString('document.location.href', 'http://127.0.0.1:8000/one');
+ setTimeout(testEmptyUrl, 0);
+ } else {
+ shouldBeEqualToString('document.location.href', 'http://127.0.0.1:8000/');
+ finishJSTest();
+ }
+ }
+ </script>
+</head>
+
+<body _onload_="testNullUrl()">
+</body>
+</html>
\ No newline at end of file
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (230398 => 230399)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-04-09 10:52:54 UTC (rev 230398)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-04-09 10:53:05 UTC (rev 230399)
@@ -1,3 +1,18 @@
+2018-03-07 Sihui Liu <sihui_...@apple.com>
+
+ replaceState cause back/forward malfunction on html page with <base href="" tag
+ https://bugs.webkit.org/show_bug.cgi?id=182678
+ <rdar://problem/37517821>
+
+ Reviewed by Chris Dumez.
+
+ replaceState should not change URL when the URL argument is NULL, but should change URL when the URL argument is an empty string.
+
+ Test: http/tests/history/replacestate-no-url.html
+
+ * page/History.cpp:
+ (WebCore::History::urlForState):
+
2018-03-06 Myles C. Maxfield <mmaxfi...@apple.com>
Change the type of SVGToOTFFontConverter::m_weight to be not a char
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/page/History.cpp (230398 => 230399)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/page/History.cpp 2018-04-09 10:52:54 UTC (rev 230398)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/page/History.cpp 2018-04-09 10:53:05 UTC (rev 230399)
@@ -156,11 +156,9 @@
URL History::urlForState(const String& urlString)
{
- URL baseURL = m_frame->document()->baseURL();
- if (urlString.isEmpty())
- return baseURL;
-
- return URL(baseURL, urlString);
+ if (urlString.isNull())
+ return m_frame->document()->url();
+ return m_frame->document()->completeURL(urlString);
}
ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data, const String& title, const String& urlString, StateObjectType stateObjectType)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes