Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2780953002: When historyEntryRequiresUserGesture is enabled, exempt docs that have been committed for 5 seconds (Closed)
Patch Set: Centralize checking the setting Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3184 if (documentElement() && !isHTMLHtmlElement(*documentElement())) 3184 if (documentElement() && !isHTMLHtmlElement(*documentElement()))
3185 return true; 3185 return true;
3186 3186
3187 return false; 3187 return false;
3188 } 3188 }
3189 3189
3190 int Document::elapsedTime() const { 3190 int Document::elapsedTime() const {
3191 return static_cast<int>((currentTime() - m_startTime) * 1000); 3191 return static_cast<int>((currentTime() - m_startTime) * 1000);
3192 } 3192 }
3193 3193
3194 bool Document::canCreateHistoryEntry() const {
3195 if (!m_frame->settings()->getHistoryEntryRequiresUserGesture())
3196 return true;
3197 return elapsedTime() >= 5000 || m_frame->hasReceivedUserGesture();
ojan 2017/04/03 21:03:54 I think you could test this as a SimTest that fast
Nate Chapin 2017/04/04 20:42:19 I could find ways to mess with last time of a comp
3198 }
3199
3194 void Document::write(const SegmentedString& text, 3200 void Document::write(const SegmentedString& text,
3195 Document* enteredDocument, 3201 Document* enteredDocument,
3196 ExceptionState& exceptionState) { 3202 ExceptionState& exceptionState) {
3197 if (importLoader()) { 3203 if (importLoader()) {
3198 exceptionState.throwDOMException( 3204 exceptionState.throwDOMException(
3199 InvalidStateError, "Imported document doesn't support write()."); 3205 InvalidStateError, "Imported document doesn't support write().");
3200 return; 3206 return;
3201 } 3207 }
3202 3208
3203 if (!isHTMLDocument()) { 3209 if (!isHTMLDocument()) {
(...skipping 3465 matching lines...) Expand 10 before | Expand all | Expand 10 after
6669 } 6675 }
6670 6676
6671 void showLiveDocumentInstances() { 6677 void showLiveDocumentInstances() {
6672 WeakDocumentSet& set = liveDocumentSet(); 6678 WeakDocumentSet& set = liveDocumentSet();
6673 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6679 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6674 for (blink::Document* document : set) 6680 for (blink::Document* document : set)
6675 fprintf(stderr, "- Document %p URL: %s\n", document, 6681 fprintf(stderr, "- Document %p URL: %s\n", document,
6676 document->url().getString().utf8().data()); 6682 document->url().getString().utf8().data());
6677 } 6683 }
6678 #endif 6684 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698