| Index: third_party/WebKit/Source/core/dom/Document.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
|
| index 43aaf0a8818e7d3dffa5b297bf1756910e408cac..7d1a15d2fdb92e8ac60ec11186a3e4ea0269a116 100644
|
| --- a/third_party/WebKit/Source/core/dom/Document.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp
|
| @@ -282,6 +282,10 @@ static const unsigned cMaxWriteRecursionDepth = 21;
|
| // adequate, but a little high for dual G5s. :)
|
| static const int cLayoutScheduleThreshold = 250;
|
|
|
| +// After a document has been committed for this time, it can create a history
|
| +// entry even if the user hasn't interacted with the document.
|
| +static const int cElapsedTimeForHistoryEntryWithoutUserGestureMS = 5000;
|
| +
|
| // DOM Level 2 says (letters added):
|
| //
|
| // a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl.
|
| @@ -3189,6 +3193,21 @@ int Document::elapsedTime() const {
|
| return static_cast<int>((currentTime() - m_startTime) * 1000);
|
| }
|
|
|
| +bool Document::canCreateHistoryEntry() const {
|
| + // TODO(japhet): This flag controls an intervention to require a user gesture
|
| + // or a long time on page in order for a content-initiated navigation to add
|
| + // an entry to the back/forward list. Removing the flag and making this the
|
| + // default will require updating a couple hundred tests that currently depend
|
| + // on creating history entries without user gestures. I'm waiting to update
|
| + // the tests until the feature is proven to minimize churn.
|
| + // https://bugs.chromium.org/p/chromium/issues/detail?id=638198
|
| + if (!m_frame->settings()->getHistoryEntryRequiresUserGesture())
|
| + return true;
|
| + if (m_frame->hasReceivedUserGesture())
|
| + return true;
|
| + return elapsedTime() >= cElapsedTimeForHistoryEntryWithoutUserGestureMS;
|
| +}
|
| +
|
| void Document::write(const SegmentedString& text,
|
| Document* enteredDocument,
|
| ExceptionState& exceptionState) {
|
|
|