Make history.pushState()/replaceState() more closely aligned to the HTML standard
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Sep 2017 18:06:24 +0000 (18:06 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Sep 2017 18:06:24 +0000 (18:06 +0000)
commit57385fffd2898c97d99c1ec5a9d5db7dd87d2eab
treeeb47afa8a9999fb7e6588be7cedc43d5204b8dde
parent5f15815c178422decc5243b4d6ce89e2c8ebc0c0
Make history.pushState()/replaceState() more closely aligned to the HTML standard
https://bugs.webkit.org/show_bug.cgi?id=176730
<rdar://problem/33839265>

Reviewed by Alex Christensen.

Source/WebCore:

Update history.pushState()/replaceState() to more closely align with the algorithm
specified in <https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate-2> (9 September 2017).

Test: http/tests/security/history-pushState-replaceState-from-sandboxed-iframe.html

* page/History.cpp:
(WebCore::History::stateObjectAdded):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::extractInnerURL): Use URL constructor that takes a base URL as opposed
to using the special ParsedURLString-variant because the latter can only be used to parse a string
returned from URL::string(). And the extracted inner URL does not meet this criterion. Using the
ParsedURLString-variant of the URL constructor with a string that is not the result of URL::string()
will cause an assertion failure in a debug build.

LayoutTests:

* http/tests/security/history-pushState-replaceState-from-sandboxed-iframe-expected.txt: Added.
* http/tests/security/history-pushState-replaceState-from-sandboxed-iframe.html: Added.
* http/tests/security/history-username-password-expected.txt:
* http/tests/security/history-username-password.html:
* http/tests/security/resources/history-pushState-replaceState-from-sandboxed-iframe.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@221978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/security/history-pushState-replaceState-from-sandboxed-iframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/security/history-pushState-replaceState-from-sandboxed-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/security/history-username-password-expected.txt
LayoutTests/http/tests/security/history-username-password.html
LayoutTests/http/tests/security/resources/history-pushState-replaceState-from-sandboxed-iframe.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/History.cpp
Source/WebCore/page/SecurityOrigin.cpp