Changeset 238628 in webkit


Ignore:
Timestamp:
Nov 28, 2018 12:28:07 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[XHR] Document.lastModified doesn't work for non-rendered documents
https://bugs.webkit.org/show_bug.cgi?id=179375

Patch by Rob Buis <rbuis@igalia.com> on 2018-11-28
Reviewed by Alexey Proskuryakov.

LayoutTests/imported/w3c:

  • web-platform-tests/xhr/responsexml-document-properties-expected.txt:

Source/WebCore:

Add setOverrideLastModified to override last modified date for
standalone Documents.

Behavior matches Firefox and Chrome.

Test: web-platform-tests/xhr/responsexml-document-properties.htm

  • dom/Document.cpp:

(WebCore::Document::overrideLastModified):
(WebCore::Document::lastModified const): no need to test m_frame since that's already done in loader().
(WebCore::Document::lastModified): Deleted.

  • dom/Document.h:
  • xml/XMLHttpRequest.cpp:

LayoutTests:

Unskip responsexml-document-properties.htm since the dynamic message is gone.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238624 r238628  
     12018-11-28  Rob Buis  <rbuis@igalia.com>
     2
     3        [XHR] Document.lastModified doesn't work for non-rendered documents
     4        https://bugs.webkit.org/show_bug.cgi?id=179375
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Unskip responsexml-document-properties.htm since the dynamic message is gone.
     9
     10        * TestExpectations:
     11        * platform/wpe/TestExpectations:
     12
    1132018-11-28  Frederic Wang  <fwang@igalia.com>
    214
  • trunk/LayoutTests/TestExpectations

    r238592 r238628  
    749749imported/w3c/web-platform-tests/xhr/send-redirect-to-cors.htm [ Skip ]
    750750imported/w3c/web-platform-tests/xhr/send-redirect-to-non-cors.htm [ Skip ]
    751 # Failing assertion with dynamic message
    752 imported/w3c/web-platform-tests/xhr/responsexml-document-properties.htm [ Failure ]
    753751
    754752imported/w3c/web-platform-tests/fetch/api/basic/block-mime-as-script.html [ DumpJSConsoleLogInStdErr ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r238610 r238628  
     12018-11-28  Rob Buis  <rbuis@igalia.com>
     2
     3        [XHR] Document.lastModified doesn't work for non-rendered documents
     4        https://bugs.webkit.org/show_bug.cgi?id=179375
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * web-platform-tests/xhr/responsexml-document-properties-expected.txt:
     9
    1102018-11-28  Ali Juma  <ajuma@chromium.org>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/responsexml-document-properties-expected.txt

    r235354 r238628  
    1010PASS location
    1111PASS defaultView
    12 FAIL body assert_equals: expected (undefined) undefined but got (object) null
    13 FAIL images assert_equals: expected (undefined) undefined but got (object) object "[object HTMLCollection]"
     12PASS body
    1413PASS doctype
    15 FAIL forms assert_equals: expected (undefined) undefined but got (object) object "[object HTMLCollection]"
    1614FAIL all assert_equals: expected undefined but got [object HTMLAllCollection]
    17 FAIL links assert_equals: expected (undefined) undefined but got (object) object "[object HTMLCollection]"
    1815PASS cookie
    19 FAIL Test document URL properties after redirect assert_equals: expected "http://localhost:8800/XMLHttpRequest/resources/well-formed.xml" but got "http://localhost:8800/XMLHttpRequest/resources/redirect.py?location=well-formed.xml"
    20 FAIL Test document URL properties of document with <base> after redirect assert_equals: expected "http://localhost:8800/XMLHttpRequest/resources/base.xml" but got "http://localhost:8800/XMLHttpRequest/resources/redirect.py?location=base.xml"
     16FAIL Test document URL properties after redirect assert_equals: expected "http://localhost:8800/xhr/resources/well-formed.xml" but got "http://localhost:8800/xhr/resources/redirect.py?location=well-formed.xml"
     17FAIL Test document URL properties of document with <base> after redirect assert_equals: expected "http://localhost:8800/xhr/resources/base.xml" but got "http://localhost:8800/xhr/resources/redirect.py?location=base.xml"
    2118PASS lastModified set to time of response if no HTTP header provided
    22 FAIL lastModified set to related HTTP header if provided assert_equals: expected 1505770096000 but got 1505744052000
     19PASS lastModified set to related HTTP header if provided
    2320PASS cookie (after setting it)
    24 PASS styleSheets
    25 PASS implementation
     21PASS styleSheets should be an object
     22PASS implementation should be an object
     23PASS images should be an object
     24PASS forms should be an object
     25PASS links should be an object
    2626
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r238375 r238628  
    10061006webkit.org/b/179608 imported/w3c/web-platform-tests/xhr/access-control-preflight-sync-not-supported.htm [ Failure ]
    10071007webkit.org/b/179608 imported/w3c/web-platform-tests/xhr/send-conditional-cors.htm [ Failure ]
    1008 webkit.org/b/179375 imported/w3c/web-platform-tests/xhr/responsexml-document-properties.htm [ Failure ]
    10091008webkit.org/b/171031 imported/w3c/web-platform-tests/xhr/getallresponseheaders-cl.htm [ Failure ]
    10101009
  • trunk/Source/WebCore/ChangeLog

    r238623 r238628  
     12018-11-28  Rob Buis  <rbuis@igalia.com>
     2
     3        [XHR] Document.lastModified doesn't work for non-rendered documents
     4        https://bugs.webkit.org/show_bug.cgi?id=179375
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Add setOverrideLastModified to override last modified date for
     9        standalone Documents.
     10
     11        Behavior matches Firefox and Chrome.
     12
     13        Test: web-platform-tests/xhr/responsexml-document-properties.htm
     14
     15        * dom/Document.cpp:
     16        (WebCore::Document::overrideLastModified):
     17        (WebCore::Document::lastModified const): no need to test m_frame since that's already done in loader().
     18        (WebCore::Document::lastModified): Deleted.
     19        * dom/Document.h:
     20        * xml/XMLHttpRequest.cpp:
     21
    1222018-11-28  Yongjun Zhang  <yongjun_zhang@apple.com>
    223
  • trunk/Source/WebCore/dom/Document.cpp

    r238404 r238628  
    48374837}
    48384838
     4839void Document::overrideLastModified(const std::optional<WallTime>& lastModified)
     4840{
     4841    m_overrideLastModified = lastModified;
     4842}
     4843
    48394844// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
    4840 String Document::lastModified()
     4845String Document::lastModified() const
    48414846{
    48424847    std::optional<WallTime> dateTime;
    4843     if (m_frame && loader())
     4848    if (m_overrideLastModified)
     4849        dateTime = m_overrideLastModified;
     4850    else if (loader())
    48444851        dateTime = loader()->response().lastModified();
    48454852
  • trunk/Source/WebCore/dom/Document.h

    r238562 r238628  
    930930    ExceptionOr<void> setDomain(const String& newDomain);
    931931
    932     WEBCORE_EXPORT String lastModified();
     932    void overrideLastModified(const std::optional<WallTime>&);
     933    WEBCORE_EXPORT String lastModified() const;
    933934
    934935    // The cookieURL is used to query the cookie database for this document's
     
    19311932    String m_cachedDOMCookies;
    19321933
     1934    std::optional<WallTime> m_overrideLastModified;
     1935
    19331936    HashSet<RefPtr<Element>> m_associatedFormControls;
    19341937    unsigned m_disabledFieldsetElementsCount { 0 };
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r236999 r238628  
    201201            else
    202202                m_responseDocument = XMLDocument::create(0, m_url);
    203             // FIXME: Set Last-Modified.
     203            m_responseDocument->overrideLastModified(m_response.lastModified());
    204204            m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
    205205            m_responseDocument->setContextDocument(downcast<Document>(*scriptExecutionContext()));
Note: See TracChangeset for help on using the changeset viewer.