| 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 f8d81f74113d91ab2d04a58971a36c4c6f6bf22a..4f4d89c6d8ec706d4dd89bd94994ec059c8de610 100644
|
| --- a/third_party/WebKit/Source/core/dom/Document.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp
|
| @@ -195,6 +195,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"
|
| @@ -1327,6 +1328,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());
|
| @@ -2437,8 +2447,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();
|
|
|