Changeset 167261 in webkit


Ignore:
Timestamp:
Apr 14, 2014 12:45:24 PM (10 years ago)
Author:
Brian Burg
Message:

Web Replay: memoize fallback time values for document.lastModified
https://bugs.webkit.org/show_bug.cgi?id=131318

Reviewed by Joseph Pecoraro.

Source/WebCore:
If a document's Last-Modified header can't be found or used, then
document.lastModified is derived from the current system time or
from filesystem data, which is obviously nondeterministic.

It's better to handle this inside Document::lastModified rather than using
MemoizedDOMResult, because only the fallback case is nondeterministic.

Test: http/tests/inspector/replay/document-last-modified-fallback-value.html

  • dom/Document.cpp:

(WebCore::Document::lastModified): Save or reuse memoized fallback value.

  • replay/WebInputs.json: Add input DocumentLastModifiedDate.

LayoutTests:

  • http/tests/inspector/replay/document-last-modified-fallback-value.html: Added.
Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167259 r167261  
     12014-04-14  Brian J. Burg  <burg@cs.washington.edu>
     2
     3        Web Replay: memoize fallback time values for document.lastModified
     4        https://bugs.webkit.org/show_bug.cgi?id=131318
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * http/tests/inspector/replay/document-last-modified-fallback-value.html: Added.
     9
    1102014-04-14  Eduardo Lima Mitev  <elima@igalia.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r167256 r167261  
     12014-04-14  Brian J. Burg  <burg@cs.washington.edu>
     2
     3        Web Replay: memoize fallback time values for document.lastModified
     4        https://bugs.webkit.org/show_bug.cgi?id=131318
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        If a document's Last-Modified header can't be found or used, then
     9        document.lastModified is derived from the current system time or
     10        from filesystem data, which is obviously nondeterministic.
     11
     12        It's better to handle this inside Document::lastModified rather than using
     13        MemoizedDOMResult, because only the fallback case is nondeterministic.
     14
     15        Test: http/tests/inspector/replay/document-last-modified-fallback-value.html
     16
     17        * dom/Document.cpp:
     18        (WebCore::Document::lastModified): Save or reuse memoized fallback value.
     19        * replay/WebInputs.json: Add input DocumentLastModifiedDate.
     20
    1212014-04-12  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/dom/Document.cpp

    r166937 r167261  
    221221
    222222#if ENABLE(WEB_REPLAY)
     223#include "WebReplayInputs.h"
    223224#include <replay/EmptyInputCursor.h>
    224225#endif
     
    38923893    // specificiation tells us to read the last modification date from the file
    38933894    // system.
    3894     if (!foundDate)
    3895         date.setMillisecondsSinceEpochForDateTime(currentTimeMS());
     3895    if (!foundDate) {
     3896        double fallbackDate = currentTimeMS();
     3897#if ENABLE(WEB_REPLAY)
     3898        InputCursor& cursor = inputCursor();
     3899        if (cursor.isCapturing())
     3900            cursor.appendInput<DocumentLastModifiedDate>(fallbackDate);
     3901        else if (cursor.isReplaying()) {
     3902            if (DocumentLastModifiedDate* input = cursor.fetchInput<DocumentLastModifiedDate>())
     3903                fallbackDate = input->fallbackValue();
     3904        }
     3905#endif
     3906        date.setMillisecondsSinceEpochForDateTime(fallbackDate);
     3907    }
     3908
    38963909    return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, date.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
    38973910}
  • trunk/Source/WebCore/replay/WebInputs.json

    r167085 r167261  
    166166        },
    167167        {
     168            "name": "DocumentLastModifiedDate",
     169            "description": "A fallback value used for the document's last modified date if the Last-Modified header can't be found or used.",
     170            "queue": "SCRIPT_MEMOIZED",
     171            "members": [
     172                { "name": "fallbackValue", "type": "double" }
     173            ]
     174        },
     175        {
    168176            "name": "EndSegmentSentinel",
    169177            "description": "A sentinel input to signal the end of a segment.",
Note: See TracChangeset for help on using the changeset viewer.