| 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 8c1c043632fe2f3c0c3b70dba4d5747165f0aaf8..7fcdc2af9138b3bd0928e08051d0a4b369f412db 100644
|
| --- a/third_party/WebKit/Source/core/dom/Document.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp
|
| @@ -193,6 +193,7 @@
|
| #include "core/loader/FrameLoaderClient.h"
|
| #include "core/loader/ImageLoader.h"
|
| #include "core/loader/NavigationScheduler.h"
|
| +#include "core/loader/PrerendererClient.h"
|
| #include "core/loader/appcache/ApplicationCacheHost.h"
|
| #include "core/observer/ResizeObserverController.h"
|
| #include "core/page/ChromeClient.h"
|
| @@ -1320,6 +1321,15 @@ PageVisibilityState Document::pageVisibilityState() const
|
| return m_frame->page()->visibilityState();
|
| }
|
|
|
| +bool Document::isPrefetchOnly() const
|
| +{
|
| + if (!m_frame || !m_frame->page())
|
| + return false;
|
| +
|
| + PrerendererClient* prerendererClient = PrerendererClient::from(m_frame->page());
|
| + return prerendererClient && prerendererClient->isPrefetchOnly();
|
| +}
|
| +
|
| String Document::visibilityState() const
|
| {
|
| return pageVisibilityStateString(pageVisibilityState());
|
| @@ -2430,8 +2440,12 @@ DocumentParser* Document::implicitOpen(ParserSynchronizationPolicy parserSyncPol
|
|
|
| setCompatibilityMode(NoQuirksMode);
|
|
|
| - if (!threadedParsingEnabledForTesting())
|
| + if (!threadedParsingEnabledForTesting()) {
|
| parserSyncPolicy = ForceSynchronousParsing;
|
| + } else if (parserSyncPolicy == AllowAsynchronousParsing && isPrefetchOnly()) {
|
| + // Prefetch must be synchronous.
|
| + parserSyncPolicy = ForceSynchronousParsing;
|
| + }
|
|
|
| m_parserSyncPolicy = parserSyncPolicy;
|
| m_parser = createParser();
|
|
|