summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/test_runner/web_test_proxy.cc1
-rw-r--r--third_party/WebKit/Source/core/dom/Document.cpp6
-rw-r--r--third_party/WebKit/Source/core/dom/Document.h6
-rw-r--r--third_party/WebKit/Source/core/dom/DocumentParser.h5
-rw-r--r--third_party/WebKit/Source/core/fetch/RawResource.cpp3
-rw-r--r--third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp22
-rw-r--r--third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h5
-rw-r--r--third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp22
-rw-r--r--third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h19
-rw-r--r--third_party/WebKit/Source/core/loader/DocumentLoader.cpp78
-rw-r--r--third_party/WebKit/Source/core/loader/DocumentLoader.h5
-rw-r--r--third_party/WebKit/Source/core/loader/FrameLoader.cpp38
-rw-r--r--third_party/WebKit/Source/core/loader/FrameLoader.h2
-rw-r--r--third_party/WebKit/Source/core/loader/NavigationScheduler.cpp2
14 files changed, 43 insertions, 171 deletions
diff --git a/components/test_runner/web_test_proxy.cc b/components/test_runner/web_test_proxy.cc
index 7e76f1f7b..5a163ee 100644
--- a/components/test_runner/web_test_proxy.cc
+++ b/components/test_runner/web_test_proxy.cc
@@ -964,6 +964,7 @@ bool WebTestProxyBase::DidFailProvisionalLoad(
blink::WebLocalFrame* frame,
const blink::WebURLError& error,
blink::WebHistoryCommitType commit_type) {
+ DCHECK(frame->provisionalDataSource());
if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->PrintMessage(" - didFailProvisionalLoadWithError\n");
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 0787418b..a876708 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -395,7 +395,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_frame(initializer.frame())
, m_domWindow(m_frame ? m_frame->localDOMWindow() : 0)
, m_importsController(initializer.importsController())
- , m_activeParserCount(0)
, m_contextFeatures(ContextFeatures::defaultSwitch())
, m_wellFormed(false)
, m_printing(false)
@@ -5553,11 +5552,6 @@ bool Document::threadedParsingEnabledForTesting()
return s_threadedParsingEnabledForTesting;
}
-bool Document::hasActiveParser()
-{
- return m_activeParserCount || (m_parser && m_parser->processingData());
-}
-
void Document::setContextFeatures(ContextFeatures& features)
{
m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features);
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h
index 23198e7..88e183f35 100644
--- a/third_party/WebKit/Source/core/dom/Document.h
+++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -956,11 +956,6 @@ public:
void adjustFloatQuadsForScrollAndAbsoluteZoom(Vector<FloatQuad>&, LayoutObject&);
void adjustFloatRectForScrollAndAbsoluteZoom(FloatRect&, LayoutObject&);
- bool hasActiveParser();
- unsigned activeParserCount() { return m_activeParserCount; }
- void incrementActiveParserCount() { ++m_activeParserCount; }
- void decrementActiveParserCount() { --m_activeParserCount; }
-
void setContextFeatures(ContextFeatures&);
ContextFeatures& contextFeatures() const { return *m_contextFeatures; }
@@ -1189,7 +1184,6 @@ private:
PersistentWillBeMember<ResourceFetcher> m_fetcher;
RefPtrWillBeMember<DocumentParser> m_parser;
- unsigned m_activeParserCount;
RefPtrWillBeMember<ContextFeatures> m_contextFeatures;
bool m_wellFormed;
diff --git a/third_party/WebKit/Source/core/dom/DocumentParser.h b/third_party/WebKit/Source/core/dom/DocumentParser.h
index b5ff387..abbf48d 100644
--- a/third_party/WebKit/Source/core/dom/DocumentParser.h
+++ b/third_party/WebKit/Source/core/dom/DocumentParser.h
@@ -61,11 +61,6 @@ public:
virtual void finish() = 0;
- // FIXME: processingData() is only used by DocumentLoader::isLoadingInAPISense
- // and is very unclear as to what it actually means. The LegacyHTMLDocumentParser
- // used to implement it.
- virtual bool processingData() const { return false; }
-
// document() will return 0 after detach() is called.
Document* document() const { ASSERT(m_document); return m_document; }
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp
index fb1f585..39c9ef9 100644
--- a/third_party/WebKit/Source/core/fetch/RawResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -130,12 +130,13 @@ void RawResource::didAddClient(ResourceClient* c)
void RawResource::willFollowRedirect(ResourceRequest& newRequest, const ResourceResponse& redirectResponse)
{
+ Resource::willFollowRedirect(newRequest, redirectResponse);
+
RefPtrWillBeRawPtr<RawResource> protect(this);
ASSERT(!redirectResponse.isNull());
ResourceClientWalker<RawResourceClient> w(m_clients);
while (RawResourceClient* c = w.next())
c->redirectReceived(this, newRequest, redirectResponse);
- Resource::willFollowRedirect(newRequest, redirectResponse);
}
void RawResource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle)
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
index 46dc923..2bc5e32 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -261,11 +261,6 @@ bool HTMLDocumentParser::isParsingFragment() const
return m_treeBuilder->isParsingFragment();
}
-bool HTMLDocumentParser::processingData() const
-{
- return isScheduledForResume() || inPumpSession() || m_haveBackgroundParser;
-}
-
void HTMLDocumentParser::pumpTokenizerIfPossible()
{
if (isStopped() || isWaitingForScripts())
@@ -436,7 +431,8 @@ size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Par
TRACE_EVENT0("blink", "HTMLDocumentParser::processParsedChunkFromBackgroundParser");
TemporaryChange<bool> hasLineNumber(m_isParsingAtLineNumber, true);
- ASSERT_WITH_SECURITY_IMPLICATION(document()->activeParserCount() == 1);
+ ASSERT_WITH_SECURITY_IMPLICATION(m_pumpSpeculationsSessionNestingLevel == 1);
+ ASSERT_WITH_SECURITY_IMPLICATION(!inPumpSession());
ASSERT(!isParsingFragment());
ASSERT(!isWaitingForScripts());
ASSERT(!isStopped());
@@ -562,7 +558,7 @@ void HTMLDocumentParser::pumpPendingSpeculations()
// FIXME: Pass in current input length.
TRACE_EVENT_BEGIN1("devtools.timeline", "ParseHTML", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt()));
- SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel, contextForParsingSession());
+ SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel);
while (!m_speculations.isEmpty()) {
ASSERT(!isScheduledForResume());
size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_speculations.takeFirst().release());
@@ -596,15 +592,6 @@ void HTMLDocumentParser::forcePlaintextForTextDocument()
m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
}
-Document* HTMLDocumentParser::contextForParsingSession()
-{
- // The parsing session should interact with the document only when parsing
- // non-fragments. Otherwise, we might delay the load event mistakenly.
- if (isParsingFragment())
- return nullptr;
- return document();
-}
-
void HTMLDocumentParser::pumpTokenizer()
{
ASSERT(!isStopped());
@@ -615,7 +602,7 @@ void HTMLDocumentParser::pumpTokenizer()
ASSERT(m_tokenizer);
ASSERT(m_token);
- PumpSession session(m_pumpSessionNestingLevel, contextForParsingSession());
+ PumpSession session(m_pumpSessionNestingLevel);
// We tell the InspectorInstrumentation about every pump, even if we
// end up pumping nothing. It can filter out empty pumps itself.
@@ -1073,7 +1060,6 @@ void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFra
RefPtrWillBeRawPtr<HTMLDocumentParser> parser = HTMLDocumentParser::create(fragment, contextElement, parserContentPolicy);
parser->append(source);
parser->finish();
- ASSERT(!parser->processingData()); // Make sure we're done. <rdar://problem/3963151>
parser->detach(); // Allows ~DocumentParser to assert it was detached before destruction.
}
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
index b3068bf..2748dfc 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
@@ -111,8 +111,6 @@ public:
void flush() final;
void setDecoder(PassOwnPtr<TextResourceDecoder>) final;
- UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSession()); }
-
protected:
void insert(const SegmentedString&) final;
void append(const String&) override;
@@ -134,7 +132,6 @@ private:
// DocumentParser
void detach() final;
bool hasInsertionPoint() final;
- bool processingData() const final;
void prepareToStopParsing() final;
void stopParsing() final;
bool isWaitingForScripts() const final;
@@ -154,8 +151,6 @@ private:
size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>);
void pumpPendingSpeculations();
- Document* contextForParsingSession();
-
bool canTakeNextToken();
void pumpTokenizer();
void pumpTokenizerIfPossible();
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp
index 70b70ad..ae74514 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp
@@ -35,24 +35,8 @@
namespace blink {
-ActiveParserSession::ActiveParserSession(unsigned& nestingLevel, Document* document)
+PumpSession::PumpSession(unsigned& nestingLevel)
: NestingLevelIncrementer(nestingLevel)
- , m_document(document)
-{
- if (!m_document)
- return;
- m_document->incrementActiveParserCount();
-}
-
-ActiveParserSession::~ActiveParserSession()
-{
- if (!m_document)
- return;
- m_document->decrementActiveParserCount();
-}
-
-PumpSession::PumpSession(unsigned& nestingLevel, Document* document)
- : ActiveParserSession(nestingLevel, document)
{
}
@@ -60,8 +44,8 @@ PumpSession::~PumpSession()
{
}
-SpeculationsPumpSession::SpeculationsPumpSession(unsigned& nestingLevel, Document* document)
- : ActiveParserSession(nestingLevel, document)
+SpeculationsPumpSession::SpeculationsPumpSession(unsigned& nestingLevel)
+ : NestingLevelIncrementer(nestingLevel)
, m_startTime(currentTime())
, m_processedElementTokens(0)
{
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h
index da8cddc..0445b84 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h
@@ -34,31 +34,20 @@
namespace blink {
-class Document;
class HTMLDocumentParser;
class WebTaskRunner;
-class ActiveParserSession : public NestingLevelIncrementer {
+class PumpSession : public NestingLevelIncrementer {
STACK_ALLOCATED();
public:
- ActiveParserSession(unsigned& nestingLevel, Document*);
- ~ActiveParserSession();
-
-private:
- RefPtrWillBeMember<Document> m_document;
-};
-
-class PumpSession : public ActiveParserSession {
- STACK_ALLOCATED();
-public:
- PumpSession(unsigned& nestingLevel, Document*);
+ PumpSession(unsigned& nestingLevel);
~PumpSession();
};
-class SpeculationsPumpSession : public ActiveParserSession {
+class SpeculationsPumpSession : public NestingLevelIncrementer {
STACK_ALLOCATED();
public:
- SpeculationsPumpSession(unsigned& nestingLevel, Document*);
+ SpeculationsPumpSession(unsigned& nestingLevel);
~SpeculationsPumpSession();
double elapsedTime() const;
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index 1c68b66..df38588 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -128,7 +128,7 @@ ResourceLoader* DocumentLoader::mainResourceLoader() const
DocumentLoader::~DocumentLoader()
{
- ASSERT(!m_frame || !isLoading());
+ ASSERT(!m_frame);
ASSERT(!m_mainResource);
ASSERT(!m_applicationCacheHost);
}
@@ -149,13 +149,6 @@ unsigned long DocumentLoader::mainResourceIdentifier() const
return m_mainResource ? m_mainResource->identifier() : 0;
}
-Document* DocumentLoader::document() const
-{
- if (m_frame && m_frame->loader().documentLoader() == this)
- return m_frame->document();
- return nullptr;
-}
-
const ResourceRequest& DocumentLoader::originalRequest() const
{
return m_originalRequest;
@@ -237,33 +230,6 @@ const KURL& DocumentLoader::urlForHistory() const
return unreachableURL().isEmpty() ? url() : unreachableURL();
}
-void DocumentLoader::mainReceivedError(const ResourceError& error)
-{
- ASSERT(!error.isNull());
- ASSERT(!m_frame || !m_frame->page()->defersLoading() || InspectorInstrumentation::isDebuggerPaused(m_frame));
- if (m_applicationCacheHost)
- m_applicationCacheHost->failedLoadingMainResource();
- if (!frameLoader())
- return;
- m_state = MainResourceDone;
- frameLoader()->receivedMainResourceError(this, error);
- clearMainResourceHandle();
-}
-
-// Cancels the data source's pending loads. Conceptually, a data source only loads
-// one document at a time, but one document may have many related resources.
-// stopLoading will stop all loads initiated by the data source,
-// but not loads initiated by child frames' data sources -- that's the WebFrame's job.
-void DocumentLoader::stopLoading()
-{
- RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get());
- RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this);
-
- if (isLoading())
- cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
- m_fetcher->stopFetching();
-}
-
void DocumentLoader::commitIfReady()
{
if (m_state < Committed) {
@@ -272,14 +238,6 @@ void DocumentLoader::commitIfReady()
}
}
-bool DocumentLoader::isLoading() const
-{
- if (document() && document()->hasActiveParser())
- return true;
-
- return (m_state > NotStarted && m_state < MainResourceDone) || m_fetcher->isFetching();
-}
-
void DocumentLoader::notifyFinished(Resource* resource)
{
ASSERT_UNUSED(resource, m_mainResource == resource);
@@ -292,7 +250,11 @@ void DocumentLoader::notifyFinished(Resource* resource)
return;
}
- mainReceivedError(m_mainResource->resourceError());
+ if (m_applicationCacheHost)
+ m_applicationCacheHost->failedLoadingMainResource();
+ m_state = MainResourceDone;
+ frameLoader()->loadFailed(this, m_mainResource->resourceError());
+ clearMainResourceHandle();
}
void DocumentLoader::finishedLoading(double finishTime)
@@ -341,11 +303,11 @@ void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque
RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectResponse.url());
if (!redirectingOrigin->canDisplay(requestURL)) {
FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString());
- cancelMainResourceLoad(ResourceError::cancelledError(requestURL));
+ m_fetcher->stopFetching();
return;
}
if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteData(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurrentTab, replacesCurrentHistoryItem(), isClientRedirect())) {
- cancelMainResourceLoad(ResourceError::cancelledError(requestURL));
+ m_fetcher->stopFetching();
return;
}
@@ -449,7 +411,7 @@ void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
if (!shouldContinueForResponse()) {
InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_mainResource->identifier(), m_response);
- cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
+ m_fetcher->stopFetching();
return;
}
@@ -507,10 +469,8 @@ void DocumentLoader::commitData(const char* bytes, size_t length)
// This can happen if document.close() is called by an event handler while
// there's still pending incoming data.
- if (m_frame && !m_frame->document()->parsing()) {
- cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
+ if (m_frame && !m_frame->document()->parsing())
return;
- }
if (length)
m_state = DataReceived;
@@ -574,7 +534,7 @@ void DocumentLoader::processData(const char* data, size_t length)
// If we are sending data to MediaDocument, we should stop here
// and cancel the request.
if (m_frame && m_frame->document()->isMediaDocument())
- cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
+ m_fetcher->stopFetching();
}
void DocumentLoader::clearRedirectChain()
@@ -595,7 +555,7 @@ void DocumentLoader::detachFromFrame()
// It never makes sense to have a document loader that is detached from its
// frame have any loads active, so go ahead and kill all the loads.
- stopLoading();
+ m_fetcher->stopFetching();
// If that load cancellation triggered another detach, leave.
// (fast/frames/detach-frame-nested-no-crash.html is an example of this.)
@@ -603,7 +563,6 @@ void DocumentLoader::detachFromFrame()
return;
m_fetcher->clearContext();
-
m_applicationCacheHost->detachFromDocumentLoader();
m_applicationCacheHost.clear();
WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this);
@@ -634,7 +593,7 @@ bool DocumentLoader::maybeCreateArchive()
ensureWriter(mainResource->mimeType(), mainResource->url());
// The Document has now been created.
- document()->enforceSandboxFlags(SandboxAll);
+ m_frame->document()->enforceSandboxFlags(SandboxAll);
commitData(mainResource->data()->data(), mainResource->data()->size());
return true;
@@ -705,17 +664,6 @@ void DocumentLoader::startLoadingMainResource()
m_mainResource->addClient(this);
}
-void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError)
-{
- RefPtrWillBeRawPtr<DocumentLoader> protect(this);
- ResourceError error = resourceError.isNull() ? ResourceError::cancelledError(m_request.url()) : resourceError;
-
- if (mainResourceLoader())
- mainResourceLoader()->cancel(error);
-
- mainReceivedError(error);
-}
-
void DocumentLoader::endWriting(DocumentWriter* writer)
{
ASSERT_UNUSED(writer, m_writer == writer);
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.h b/third_party/WebKit/Source/core/loader/DocumentLoader.h
index bdda337..0be0143 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.h
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.h
@@ -93,8 +93,6 @@ public:
void didChangePerformanceTiming();
void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSource);
- void stopLoading();
- bool isLoading() const;
const ResourceResponse& response() const { return m_response; }
bool isClientRedirect() const { return m_isClientRedirect; }
void setIsClientRedirect(bool isClientRedirect) { m_isClientRedirect = isClientRedirect; }
@@ -110,7 +108,6 @@ public:
void setNavigationType(NavigationType navigationType) { m_navigationType = navigationType; }
void startLoadingMainResource();
- void cancelMainResourceLoad(const ResourceError&);
void acceptDataFromThreadedReceiver(const char* data, int dataLength, int encodedDataLength);
DocumentLoadTiming& timing() { return m_documentLoadTiming; }
@@ -156,7 +153,6 @@ private:
void ensureWriter(const AtomicString& mimeType, const KURL& overridingURL = KURL());
void endWriting(DocumentWriter*);
- Document* document() const;
FrameLoader* frameLoader() const;
void commitIfReady();
@@ -167,7 +163,6 @@ private:
bool maybeCreateArchive();
void finishedLoading(double finishTime);
- void mainReceivedError(const ResourceError&);
void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&);
void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) final;
void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) final;
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 9baa21f..9026d06 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -715,12 +715,9 @@ void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip
ASSERT(!stateObject || frameLoadType == FrameLoadTypeBackForward);
// If we have a provisional request for a different document, a fragment scroll should cancel it.
- if (m_provisionalDocumentLoader) {
- m_provisionalDocumentLoader->stopLoading();
- detachDocumentLoader(m_provisionalDocumentLoader);
- if (!m_frame->host())
- return;
- }
+ detachDocumentLoader(m_provisionalDocumentLoader);
+ if (!m_frame->host())
+ return;
TemporaryChange<FrameLoadType> loadTypeChange(m_loadType, frameLoadType);
saveScrollState();
@@ -1000,8 +997,7 @@ void FrameLoader::stopAllLoaders()
if (m_inStopAllLoaders)
return;
- // Calling stopLoading() on the provisional document loader can blow away
- // the frame from underneath.
+ // Stopping a document loader can blow away the frame from underneath.
RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
m_inStopAllLoaders = true;
@@ -1012,20 +1008,21 @@ void FrameLoader::stopAllLoaders()
}
m_frame->document()->suppressLoadEvent();
- // Don't stop loading the provisional loader if it is being protected (i.e.
- // it is about to be committed) See prepareForCommit() for more details.
- if (m_provisionalDocumentLoader && !m_protectProvisionalLoader)
- m_provisionalDocumentLoader->stopLoading();
if (m_documentLoader)
- m_documentLoader->stopLoading();
+ m_documentLoader->fetcher()->stopFetching();
m_frame->document()->cancelParsing();
-
if (!m_protectProvisionalLoader)
detachDocumentLoader(m_provisionalDocumentLoader);
m_checkTimer.stop();
m_frame->navigationScheduler().cancel();
+ // It's possible that the above actions won't have stopped loading if load
+ // completion had been blocked on parsing or if we were in the middle of
+ // committing an empty document. In that case, emulate a failed navigation.
+ if (!m_provisionalDocumentLoader && m_documentLoader && m_frame->isLoading())
+ loadFailed(m_documentLoader.get(), ResourceError::cancelledError(m_documentLoader->url()));
+
m_inStopAllLoaders = false;
}
@@ -1237,16 +1234,13 @@ void FrameLoader::detach()
}
}
-void FrameLoader::receivedMainResourceError(DocumentLoader* loader, const ResourceError& error)
+void FrameLoader::loadFailed(DocumentLoader* loader, const ResourceError& error)
{
// Retain because the stop may release the last reference to it.
RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
RefPtrWillBeRawPtr<DocumentLoader> protectDocumentLoader(loader);
- // FIXME: We really ought to be able to just check for isCancellation() here, but there are some
- // ResourceErrors that setIsCancellation() but aren't created by ResourceError::cancelledError().
- ResourceError c(ResourceError::cancelledError(KURL()));
- if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) {
+ if (!error.isCancellation() && m_frame->owner()) {
// FIXME: For now, fallback content doesn't work cross process.
if (m_frame->owner()->isLocal())
m_frame->deprecatedLocalOwner()->renderFallbackContent();
@@ -1405,11 +1399,7 @@ void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty
return;
m_frame->document()->cancelParsing();
-
- if (m_provisionalDocumentLoader) {
- m_provisionalDocumentLoader->stopLoading();
- detachDocumentLoader(m_provisionalDocumentLoader);
- }
+ detachDocumentLoader(m_provisionalDocumentLoader);
// beforeunload fired above, and detaching a DocumentLoader can fire
// events, which can detach this frame.
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.h b/third_party/WebKit/Source/core/loader/FrameLoader.h
index 2fa071d..6f2b14b 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.h
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.h
@@ -110,7 +110,7 @@ public:
DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
DocumentLoader* provisionalDocumentLoader() const { return m_provisionalDocumentLoader.get(); }
- void receivedMainResourceError(DocumentLoader*, const ResourceError&);
+ void loadFailed(DocumentLoader*, const ResourceError&);
bool isLoadingMainFrame() const;
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
index a5f2726..147c9a0 100644
--- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
+++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -393,7 +393,7 @@ void NavigationScheduler::schedule(PassOwnPtrWillBeRawPtr<ScheduledNavigation> r
// FIXME: This check seems out of place.
if (!m_frame->loader().stateMachine()->committedFirstRealDocumentLoad() && m_frame->loader().provisionalDocumentLoader()) {
RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
- m_frame->loader().provisionalDocumentLoader()->stopLoading();
+ m_frame->loader().stopAllLoaders();
if (!m_frame->host())
return;
}