Title: [238628] trunk
Revision
238628
Author
commit-qu...@webkit.org
Date
2018-11-28 12:28:07 -0800 (Wed, 28 Nov 2018)

Log Message

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

Patch by Rob Buis <rb...@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.

* TestExpectations:
* platform/wpe/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238627 => 238628)


--- trunk/LayoutTests/ChangeLog	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/LayoutTests/ChangeLog	2018-11-28 20:28:07 UTC (rev 238628)
@@ -1,3 +1,15 @@
+2018-11-28  Rob Buis  <rb...@igalia.com>
+
+        [XHR] Document.lastModified doesn't work for non-rendered documents
+        https://bugs.webkit.org/show_bug.cgi?id=179375
+
+        Reviewed by Alexey Proskuryakov.
+
+        Unskip responsexml-document-properties.htm since the dynamic message is gone.
+
+        * TestExpectations:
+        * platform/wpe/TestExpectations:
+
 2018-11-28  Frederic Wang  <fw...@igalia.com>
 
         [iOS Simulator Release WK2] media/no-fullscreen-when-hidden.html is flaky

Modified: trunk/LayoutTests/TestExpectations (238627 => 238628)


--- trunk/LayoutTests/TestExpectations	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/LayoutTests/TestExpectations	2018-11-28 20:28:07 UTC (rev 238628)
@@ -748,8 +748,6 @@
 imported/w3c/web-platform-tests/xhr/send-redirect-bogus.htm [ Skip ]
 imported/w3c/web-platform-tests/xhr/send-redirect-to-cors.htm [ Skip ]
 imported/w3c/web-platform-tests/xhr/send-redirect-to-non-cors.htm [ Skip ]
-# Failing assertion with dynamic message
-imported/w3c/web-platform-tests/xhr/responsexml-document-properties.htm [ Failure ]
 
 imported/w3c/web-platform-tests/fetch/api/basic/block-mime-as-script.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/fetch/api/cors/cors-origin.any.html [ DumpJSConsoleLogInStdErr ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (238627 => 238628)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-28 20:28:07 UTC (rev 238628)
@@ -1,3 +1,12 @@
+2018-11-28  Rob Buis  <rb...@igalia.com>
+
+        [XHR] Document.lastModified doesn't work for non-rendered documents
+        https://bugs.webkit.org/show_bug.cgi?id=179375
+
+        Reviewed by Alexey Proskuryakov.
+
+        * web-platform-tests/xhr/responsexml-document-properties-expected.txt:
+
 2018-11-28  Ali Juma  <aj...@chromium.org>
 
         Intersection Observer: rootMargin: '' gives weird results

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/responsexml-document-properties-expected.txt (238627 => 238628)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/responsexml-document-properties-expected.txt	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/responsexml-document-properties-expected.txt	2018-11-28 20:28:07 UTC (rev 238628)
@@ -9,18 +9,18 @@
 FAIL readyState assert_equals: expected "complete" but got "interactive"
 PASS location 
 PASS defaultView 
-FAIL body assert_equals: expected (undefined) undefined but got (object) null
-FAIL images assert_equals: expected (undefined) undefined but got (object) object "[object HTMLCollection]"
+PASS body 
 PASS doctype 
-FAIL forms assert_equals: expected (undefined) undefined but got (object) object "[object HTMLCollection]"
 FAIL all assert_equals: expected undefined but got [object HTMLAllCollection]
-FAIL links assert_equals: expected (undefined) undefined but got (object) object "[object HTMLCollection]"
 PASS cookie 
-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"
-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"
+FAIL 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"
+FAIL 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"
 PASS lastModified set to time of response if no HTTP header provided 
-FAIL lastModified set to related HTTP header if provided assert_equals: expected 1505770096000 but got 1505744052000
+PASS lastModified set to related HTTP header if provided 
 PASS cookie (after setting it) 
-PASS styleSheets 
-PASS implementation 
+PASS styleSheets should be an object 
+PASS implementation should be an object 
+PASS images should be an object 
+PASS forms should be an object 
+PASS links should be an object 
 

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (238627 => 238628)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2018-11-28 20:28:07 UTC (rev 238628)
@@ -1005,7 +1005,6 @@
 webkit.org/b/179608 imported/w3c/web-platform-tests/xhr/access-control-preflight-sync-method-denied.htm [ Failure ]
 webkit.org/b/179608 imported/w3c/web-platform-tests/xhr/access-control-preflight-sync-not-supported.htm [ Failure ]
 webkit.org/b/179608 imported/w3c/web-platform-tests/xhr/send-conditional-cors.htm [ Failure ]
-webkit.org/b/179375 imported/w3c/web-platform-tests/xhr/responsexml-document-properties.htm [ Failure ]
 webkit.org/b/171031 imported/w3c/web-platform-tests/xhr/getallresponseheaders-cl.htm [ Failure ]
 
 webkit.org/b/179663 imported/w3c/web-platform-tests/xhr/headers-normalize-response.htm [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (238627 => 238628)


--- trunk/Source/WebCore/ChangeLog	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/Source/WebCore/ChangeLog	2018-11-28 20:28:07 UTC (rev 238628)
@@ -1,3 +1,24 @@
+2018-11-28  Rob Buis  <rb...@igalia.com>
+
+        [XHR] Document.lastModified doesn't work for non-rendered documents
+        https://bugs.webkit.org/show_bug.cgi?id=179375
+
+        Reviewed by Alexey Proskuryakov.
+
+        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:
+
 2018-11-28  Yongjun Zhang  <yongjun_zh...@apple.com>
 
         Allow WebKit clients to specify a minimum effective width for layout.

Modified: trunk/Source/WebCore/dom/Document.cpp (238627 => 238628)


--- trunk/Source/WebCore/dom/Document.cpp	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-11-28 20:28:07 UTC (rev 238628)
@@ -4836,11 +4836,18 @@
     return { };
 }
 
+void Document::overrideLastModified(const std::optional<WallTime>& lastModified)
+{
+    m_overrideLastModified = lastModified;
+}
+
 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
-String Document::lastModified()
+String Document::lastModified() const
 {
     std::optional<WallTime> dateTime;
-    if (m_frame && loader())
+    if (m_overrideLastModified)
+        dateTime = m_overrideLastModified;
+    else if (loader())
         dateTime = loader()->response().lastModified();
 
     // FIXME: If this document came from the file system, the HTML5

Modified: trunk/Source/WebCore/dom/Document.h (238627 => 238628)


--- trunk/Source/WebCore/dom/Document.h	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/Source/WebCore/dom/Document.h	2018-11-28 20:28:07 UTC (rev 238628)
@@ -929,7 +929,8 @@
     WEBCORE_EXPORT String domain() const;
     ExceptionOr<void> setDomain(const String& newDomain);
 
-    WEBCORE_EXPORT String lastModified();
+    void overrideLastModified(const std::optional<WallTime>&);
+    WEBCORE_EXPORT String lastModified() const;
 
     // The cookieURL is used to query the cookie database for this document's
     // cookies. For example, if the cookie URL is http://example.com, we'll
@@ -1930,6 +1931,8 @@
 
     String m_cachedDOMCookies;
 
+    std::optional<WallTime> m_overrideLastModified;
+
     HashSet<RefPtr<Element>> m_associatedFormControls;
     unsigned m_disabledFieldsetElementsCount { 0 };
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (238627 => 238628)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2018-11-28 20:12:00 UTC (rev 238627)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2018-11-28 20:28:07 UTC (rev 238628)
@@ -200,7 +200,7 @@
                 m_responseDocument = HTMLDocument::create(0, m_url);
             else
                 m_responseDocument = XMLDocument::create(0, m_url);
-            // FIXME: Set Last-Modified.
+            m_responseDocument->overrideLastModified(m_response.lastModified());
             m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
             m_responseDocument->setContextDocument(downcast<Document>(*scriptExecutionContext()));
             m_responseDocument->setSecurityOriginPolicy(scriptExecutionContext()->securityOriginPolicy());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to