Changeset 229375 in webkit


Ignore:
Timestamp:
Mar 7, 2018 2:09:49 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

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_liu@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.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229371 r229375  
     12018-03-07  Sihui Liu  <sihui_liu@apple.com>
     2
     3        replaceState cause back/forward malfunction on html page with <base href="/"> tag
     4        https://bugs.webkit.org/show_bug.cgi?id=182678
     5        <rdar://problem/37517821>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/tests/history/replacestate-no-url-expected.txt: Added.
     10        * http/tests/history/replacestate-no-url.html: Added.
     11        Add layout test coverage.
     12
     13        * fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt:
     14        Rebaseline a layout test as empty string for URL is handled differently.
     15
    1162018-03-07  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange-expected.txt

    r53672 r229375  
    2828State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html#hash
    2929Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html#hash
     30State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html
     31Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html
    3032State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html#
    3133Hash change fired and last path component is pushstate-with-fragment-urls-and-hashchange.html#
    32 State popped with event null (type object) and last path component pushstate-with-fragment-urls-and-hashchange.html#
    3334State popped with event OriginalEntry (type string) and last path component pushstate-with-fragment-urls-and-hashchange.html
    3435
  • trunk/Source/WebCore/ChangeLog

    r229372 r229375  
     12018-03-07  Sihui Liu  <sihui_liu@apple.com>
     2
     3        replaceState cause back/forward malfunction on html page with <base href="/"> tag
     4        https://bugs.webkit.org/show_bug.cgi?id=182678
     5        <rdar://problem/37517821>
     6
     7        Reviewed by Chris Dumez.
     8
     9        replaceState should not change URL when the URL argument is NULL, but should change URL when the URL argument is an empty string.
     10
     11        Test: http/tests/history/replacestate-no-url.html
     12
     13        * page/History.cpp:
     14        (WebCore::History::urlForState):
     15
    1162018-03-07  Antti Koivisto  <antti@apple.com>
    217
  • trunk/Source/WebCore/page/History.cpp

    r228942 r229375  
    157157URL History::urlForState(const String& urlString)
    158158{
    159     URL baseURL = m_frame->document()->baseURL();
    160     if (urlString.isEmpty())
    161         return baseURL;
    162 
    163     return URL(baseURL, urlString);
     159    if (urlString.isNull())
     160        return m_frame->document()->url();
     161    return m_frame->document()->completeURL(urlString);
    164162}
    165163
Note: See TracChangeset for help on using the changeset viewer.