| Index: Source/WebCore/loader/DocumentLoader.cpp
|
| ===================================================================
|
| --- Source/WebCore/loader/DocumentLoader.cpp (revision 148290)
|
| +++ Source/WebCore/loader/DocumentLoader.cpp (working copy)
|
| @@ -276,20 +276,18 @@
|
| return;
|
|
|
| m_isStopping = true;
|
| -
|
| - FrameLoader* frameLoader = DocumentLoader::frameLoader();
|
|
|
| if (isLoadingMainResource())
|
| // Stop the main resource loader and let it send the cancelled message.
|
| - cancelMainResourceLoad(frameLoader->cancelledError(m_request));
|
| + cancelMainResourceLoad(ResourceError::createCancelledError(m_request.url()));
|
| else if (!m_subresourceLoaders.isEmpty())
|
| // The main resource loader already finished loading. Set the cancelled error on the
|
| // document and let the subresourceLoaders send individual cancelled messages below.
|
| - setMainDocumentError(frameLoader->cancelledError(m_request));
|
| + setMainDocumentError(ResourceError::createCancelledError(m_request.url()));
|
| else
|
| // If there are no resource loaders, we need to manufacture a cancelled message.
|
| // (A back/forward navigation has no resource loaders because its resources are cached.)
|
| - mainReceivedError(frameLoader->cancelledError(m_request));
|
| + mainReceivedError(ResourceError::createCancelledError(m_request.url()));
|
|
|
| stopLoadingSubresources();
|
|
|
| @@ -426,7 +424,7 @@
|
| ASSERT(!newRequest.isNull());
|
|
|
| if (!frameLoader()->checkIfFormActionAllowedByCSP(newRequest.url())) {
|
| - cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
|
| + cancelMainResourceLoad(ResourceError::createCancelledError(newRequest.url()));
|
| return;
|
| }
|
|
|
| @@ -437,7 +435,7 @@
|
| RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectResponse.url());
|
| if (!redirectingOrigin->canDisplay(newRequest.url())) {
|
| FrameLoader::reportLocalLoadFailed(m_frame, newRequest.url().string());
|
| - cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
|
| + cancelMainResourceLoad(ResourceError::createCancelledError(newRequest.url()));
|
| return;
|
| }
|
| timing()->addRedirect(redirectResponse.url(), newRequest.url());
|
| @@ -458,7 +456,7 @@
|
| Frame* top = m_frame->tree()->top();
|
| if (top != m_frame) {
|
| if (!frameLoader()->mixedContentChecker()->canDisplayInsecureContent(top->document()->securityOrigin(), newRequest.url())) {
|
| - cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
|
| + cancelMainResourceLoad(ResourceError::createCancelledError(newRequest.url()));
|
| return;
|
| }
|
| }
|
| @@ -539,7 +537,7 @@
|
| frame()->document()->enforceSandboxFlags(SandboxOrigin);
|
| if (HTMLFrameOwnerElement* ownerElement = frame()->ownerElement())
|
| ownerElement->dispatchEvent(Event::create(eventNames().loadEvent, false, false));
|
| - cancelMainResourceLoad(frameLoader()->cancelledError(m_request));
|
| + cancelMainResourceLoad(ResourceError::createCancelledError(m_request.url()));
|
| return;
|
| }
|
| }
|
| @@ -592,8 +590,7 @@
|
| bool isRemoteWebArchive = equalIgnoringCase("multipart/related", mimeType)
|
| && !m_substituteData.isValid() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol());
|
| if (!frameLoader()->client()->canShowMIMEType(mimeType) || isRemoteWebArchive) {
|
| - frameLoader()->policyChecker()->cannotShowMIMEType(m_response);
|
| - // Check reachedTerminalState since the load may have already been canceled inside of _handleUnimplementablePolicyWithErrorCode::.
|
| + ASSERT_NOT_REACHED();
|
| stopLoadingForPolicyChange();
|
| return;
|
| }
|
| @@ -601,11 +598,7 @@
|
| }
|
|
|
| case PolicyDownload: {
|
| - // m_mainResource can be null, e.g. when loading a substitute resource from application cache.
|
| - if (!m_mainResource) {
|
| - mainReceivedError(frameLoader()->client()->cannotShowURLError(m_request));
|
| - return;
|
| - }
|
| + ASSERT(m_mainResource);
|
| InspectorInstrumentation::continueWithPolicyDownload(m_frame, this, mainResourceLoader()->identifier(), m_response);
|
|
|
| // When starting the request, we didn't know that it would result in download and not navigation. Now we know that main document URL didn't change.
|
| @@ -632,7 +625,7 @@
|
| // keep trying to process data from their load
|
|
|
| if (hostedByObject)
|
| - cancelMainResourceLoad(frameLoader()->cancelledError(m_request));
|
| + cancelMainResourceLoad(ResourceError::createCancelledError(m_request.url()));
|
| }
|
| }
|
|
|
| @@ -665,14 +658,9 @@
|
| frameLoader->client()->committedLoad(this, data, length);
|
| }
|
|
|
| -ResourceError DocumentLoader::interruptedForPolicyChangeError() const
|
| -{
|
| - return frameLoader()->client()->interruptedForPolicyChangeError(request());
|
| -}
|
| -
|
| void DocumentLoader::stopLoadingForPolicyChange()
|
| {
|
| - ResourceError error = interruptedForPolicyChangeError();
|
| + ResourceError error = ResourceError::createPolicyChangeError(m_request.url());
|
| error.setIsCancellation(true);
|
| cancelMainResourceLoad(error);
|
| }
|
| @@ -926,6 +914,7 @@
|
| for (SubstituteResourceMap::const_iterator it = copy.begin(); it != end; ++it) {
|
| RefPtr<ResourceLoader> loader = it->key;
|
| SubstituteResource* resource = it->value.get();
|
| + ASSERT(resource);
|
|
|
| if (resource) {
|
| SharedBuffer* data = resource->data();
|
| @@ -945,10 +934,6 @@
|
| return;
|
|
|
| loader->didFinishLoading(0);
|
| - } else {
|
| - // A null resource means that we should fail the load.
|
| - // FIXME: Maybe we should use another error here - something like "not in cache".
|
| - loader->didFail(loader->cannotShowURLError());
|
| }
|
| }
|
| }
|
| @@ -1167,7 +1152,7 @@
|
| void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError)
|
| {
|
| RefPtr<DocumentLoader> protect(this);
|
| - ResourceError error = resourceError.isNull() ? frameLoader()->cancelledError(m_request) : resourceError;
|
| + ResourceError error = resourceError.isNull() ? ResourceError::createCancelledError(m_request.url()) : resourceError;
|
|
|
| m_dataLoadTimer.stop();
|
| if (m_waitingForContentPolicy) {
|
|
|