[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 13:25:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6dbb21c3ea86bf8f72807318405e9c4a40c66906
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 14 23:29:38 2010 +0000

    2010-09-14  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Darin Adler.
    
            document.lastModified gives no output if the response doesn't have a Last-Modified header
            https://bugs.webkit.org/show_bug.cgi?id=8475
    
            Implement document.lastModified as per HTML5.
    
            Tests: http/tests/misc/last-modified-parsing.html
                   http/tests/misc/no-last-modified.html
    
            * dom/Document.cpp:
            (WebCore::Document::lastModified):
    2010-09-14  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Darin Adler.
    
            document.lastModified gives no output if the response doesn't have a Last-Modified header
            https://bugs.webkit.org/show_bug.cgi?id=8475
    
            * http/tests/misc/last-modified-parsing-expected.txt: Added.
            * http/tests/misc/last-modified-parsing.html: Added.
                - Tests some details of our date parsing and serialization.  The
                  serialization format is kind of goofy, but that's what the spec
                  seems to want.
            * http/tests/misc/no-last-modified-expected.txt: Added.
            * http/tests/misc/no-last-modified.html: Added.
                - Test was happens if the server doesn't send a Last-Modified
                  header.  We're supposed to use the current date and time.
            * http/tests/resources/last-modified.php: Added.
                - PHP helper script.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2725b7f..864348c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,24 @@
 2010-09-14  Adam Barth  <abarth at webkit.org>
 
+        Reviewed by Darin Adler.
+
+        document.lastModified gives no output if the response doesn't have a Last-Modified header
+        https://bugs.webkit.org/show_bug.cgi?id=8475
+
+        * http/tests/misc/last-modified-parsing-expected.txt: Added.
+        * http/tests/misc/last-modified-parsing.html: Added.
+            - Tests some details of our date parsing and serialization.  The
+              serialization format is kind of goofy, but that's what the spec
+              seems to want.
+        * http/tests/misc/no-last-modified-expected.txt: Added.
+        * http/tests/misc/no-last-modified.html: Added.
+            - Test was happens if the server doesn't send a Last-Modified
+              header.  We're supposed to use the current date and time.
+        * http/tests/resources/last-modified.php: Added.
+            - PHP helper script.
+
+2010-09-14  Adam Barth  <abarth at webkit.org>
+
         Reviewed by Eric Seidel.
 
         `document.compatMode` is `undefined` when using `application/xhtml+xml`
diff --git a/LayoutTests/http/tests/misc/last-modified-parsing-expected.txt b/LayoutTests/http/tests/misc/last-modified-parsing-expected.txt
new file mode 100644
index 0000000..8c6d5ba
--- /dev/null
+++ b/LayoutTests/http/tests/misc/last-modified-parsing-expected.txt
@@ -0,0 +1,36 @@
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+11/21/2008 01:03:33
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+11/21/2008 01:03:33
+
+--------
+Frame: '<!--framePath //<!--frame2-->-->'
+--------
+11/21/1997 01:03:33
+
+--------
+Frame: '<!--framePath //<!--frame3-->-->'
+--------
+11/21/2008 01:03:33
+
+--------
+Frame: '<!--framePath //<!--frame4-->-->'
+--------
+02/21/2008 01:03:33
+
+--------
+Frame: '<!--framePath //<!--frame5-->-->'
+--------
+02/03/2008 01:03:33
+
+--------
+Frame: '<!--framePath //<!--frame6-->-->'
+--------
+03/03/2008 01:03:33
diff --git a/LayoutTests/http/tests/misc/last-modified-parsing.html b/LayoutTests/http/tests/misc/last-modified-parsing.html
new file mode 100644
index 0000000..72727db
--- /dev/null
+++ b/LayoutTests/http/tests/misc/last-modified-parsing.html
@@ -0,0 +1,18 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpChildFramesAsText();
+}
+
+function test(text) {
+    document.write('<iframe src="../resources/last-modified.php?date=' + escape(text) + '"></iframe>');
+}
+
+test('Mon, 21 Nov 2008 01:03:33 GMT');
+test('Tuesday, 21 Nov 2008 01:03:33 GMT');
+test('Mon, 21 Nov 97 01:03:33 GMT');
+test('Mon, 21-Nov-2008 01:03:33 GMT');
+test('Mon, 21-Feb-2008 01:03:33 GMT');
+test('Mon, 03-Feb-2008 01:03:33 GMT');
+test('Mon, 3-Mar-2008 01:03:33 GMT');
+</script>
diff --git a/LayoutTests/fast/events/resize-subframe-expected.txt b/LayoutTests/http/tests/misc/no-last-modified-expected.txt
similarity index 100%
copy from LayoutTests/fast/events/resize-subframe-expected.txt
copy to LayoutTests/http/tests/misc/no-last-modified-expected.txt
diff --git a/LayoutTests/http/tests/misc/no-last-modified.html b/LayoutTests/http/tests/misc/no-last-modified.html
new file mode 100644
index 0000000..7e4d85c
--- /dev/null
+++ b/LayoutTests/http/tests/misc/no-last-modified.html
@@ -0,0 +1,19 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function test(text) {
+    document.write('<iframe src="../resources/last-modified.php?date=' + escape(text) + '"></iframe>');
+}
+
+test('');
+
+window.onload = function() {
+    var lastModified = Date.parse(frames[0].document.body.textContent);
+    var now = new Date();
+    if (lastModified > now - 60*1000)
+        alert('PASS');
+    else
+        alert('FAIL');
+}
+</script>
diff --git a/LayoutTests/http/tests/resources/last-modified.php b/LayoutTests/http/tests/resources/last-modified.php
new file mode 100644
index 0000000..55c5222
--- /dev/null
+++ b/LayoutTests/http/tests/resources/last-modified.php
@@ -0,0 +1,7 @@
+<?php
+    $date = $_GET['date'];
+    header("Last-Modified: $date");
+?>
+<script>
+document.write(document.lastModified);
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ee7bfcb..f0dc58d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,20 @@
 2010-09-14  Adam Barth  <abarth at webkit.org>
 
+        Reviewed by Darin Adler.
+
+        document.lastModified gives no output if the response doesn't have a Last-Modified header
+        https://bugs.webkit.org/show_bug.cgi?id=8475
+
+        Implement document.lastModified as per HTML5.
+
+        Tests: http/tests/misc/last-modified-parsing.html
+               http/tests/misc/no-last-modified.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::lastModified):
+
+2010-09-14  Adam Barth  <abarth at webkit.org>
+
         Reviewed by Eric Seidel.
 
         `document.compatMode` is `undefined` when using `application/xhtml+xml`
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 1fd02b3..12c18a0 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -43,6 +43,7 @@
 #include "Console.h"
 #include "CookieJar.h"
 #include "CustomEvent.h"
+#include "DateComponents.h"
 #include "DOMImplementation.h"
 #include "DOMWindow.h"
 #include "DeviceMotionEvent.h"
@@ -3611,15 +3612,24 @@ void Document::setDomain(const String& newDomain, ExceptionCode& ec)
         m_frame->script()->updateSecurityOrigin();
 }
 
+// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
 String Document::lastModified() const
 {
-    Frame* f = frame();
-    if (!f)
-        return String();
-    DocumentLoader* loader = f->loader()->documentLoader();
-    if (!loader)
-        return String();
-    return loader->response().httpHeaderField("Last-Modified");
+    DateComponents date;
+    bool foundDate = false;
+    if (m_frame) {
+        String httpLastModified = m_frame->loader()->documentLoader()->response().httpHeaderField("Last-Modified");
+        if (!httpLastModified.isEmpty()) {
+            date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified));
+            foundDate = true;
+        }
+    }
+    // FIXME: If this document came from the file system, the HTML5
+    // specificiation tells us to read the last modification date from the file
+    // system.
+    if (!foundDate)
+        date.setMillisecondsSinceEpochForDateTime(currentTimeMS());
+    return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, date.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
 }
 
 static bool isValidNameNonASCII(const UChar* characters, unsigned length)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list