diff options
author | Ben Murdoch <benm@google.com> | 2010-07-22 15:37:06 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-07-27 10:20:25 +0100 |
commit | 967717af5423377c967781471ee106e2bb4e11c8 (patch) | |
tree | 1e701dc0a12f7f07cce1df4a7681717de77a211b /WebCore/loader | |
parent | dcc30a9fca45f634b1d3a12b276d3a0ccce99fc3 (diff) | |
download | external_webkit-967717af5423377c967781471ee106e2bb4e11c8.zip external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.gz external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.bz2 |
Merge WebKit at r63859 : Initial merge by git.
Change-Id: Ie8096c63ec7c991c9a9cba8bdd9c3b74a3b8ed62
Diffstat (limited to 'WebCore/loader')
-rw-r--r-- | WebCore/loader/CachedScript.cpp | 7 | ||||
-rw-r--r-- | WebCore/loader/CachedScript.h | 1 | ||||
-rw-r--r-- | WebCore/loader/DocumentLoader.h | 4 | ||||
-rw-r--r-- | WebCore/loader/DocumentThreadableLoader.cpp | 10 | ||||
-rw-r--r-- | WebCore/loader/EmptyClients.h | 8 | ||||
-rw-r--r-- | WebCore/loader/FrameLoader.cpp | 63 | ||||
-rw-r--r-- | WebCore/loader/FrameLoader.h | 2 | ||||
-rw-r--r-- | WebCore/loader/FrameLoaderClient.h | 2 | ||||
-rw-r--r-- | WebCore/loader/FrameLoaderTypes.h | 23 | ||||
-rw-r--r-- | WebCore/loader/MainResourceLoader.cpp | 22 | ||||
-rw-r--r-- | WebCore/loader/SubframeLoader.cpp | 15 | ||||
-rw-r--r-- | WebCore/loader/SubresourceLoader.cpp | 10 | ||||
-rw-r--r-- | WebCore/loader/appcache/ApplicationCacheGroup.cpp | 25 | ||||
-rw-r--r-- | WebCore/loader/appcache/DOMApplicationCache.idl | 3 | ||||
-rw-r--r-- | WebCore/loader/icon/IconLoader.cpp | 6 | ||||
-rw-r--r-- | WebCore/loader/loader.cpp | 2 |
16 files changed, 139 insertions, 64 deletions
diff --git a/WebCore/loader/CachedScript.cpp b/WebCore/loader/CachedScript.cpp index e3d618a..58895d6 100644 --- a/WebCore/loader/CachedScript.cpp +++ b/WebCore/loader/CachedScript.cpp @@ -37,7 +37,6 @@ namespace WebCore { CachedScript::CachedScript(const String& url, const String& charset) : CachedResource(url, Script) - , m_scriptHasBOMs(SourceCouldHaveBOMs) , m_decoder(TextResourceDecoder::create("application/javascript", charset)) , m_decodedDataDeletionTimer(this, &CachedScript::decodedDataDeletionTimerFired) { @@ -73,14 +72,8 @@ const String& CachedScript::script() if (!m_script && m_data) { m_script = m_decoder->decode(m_data->data(), encodedSize()); m_script += m_decoder->flush(); - if (m_scriptHasBOMs != SourceHasNoBOMs && m_script.length()) { - bool hasBOMs = false; - m_script = String(m_script.impl()->copyStringWithoutBOMs(m_scriptHasBOMs == SourceHasBOMs, hasBOMs)); - m_scriptHasBOMs = hasBOMs ? SourceHasBOMs : SourceHasNoBOMs; - } setDecodedSize(m_script.length() * sizeof(UChar)); } - m_decodedDataDeletionTimer.startOneShot(0); return m_script; } diff --git a/WebCore/loader/CachedScript.h b/WebCore/loader/CachedScript.h index a36d735..beab508 100644 --- a/WebCore/loader/CachedScript.h +++ b/WebCore/loader/CachedScript.h @@ -56,7 +56,6 @@ namespace WebCore { void decodedDataDeletionTimerFired(Timer<CachedScript>*); String m_script; - enum { SourceHasNoBOMs, SourceCouldHaveBOMs, SourceHasBOMs } m_scriptHasBOMs; RefPtr<TextResourceDecoder> m_decoder; Timer<CachedScript> m_decodedDataDeletionTimer; }; diff --git a/WebCore/loader/DocumentLoader.h b/WebCore/loader/DocumentLoader.h index ea6f58b..f5935c9 100644 --- a/WebCore/loader/DocumentLoader.h +++ b/WebCore/loader/DocumentLoader.h @@ -209,6 +209,8 @@ namespace WebCore { void recordMemoryCacheLoadForFutureClientNotification(const String& url); void takeMemoryCacheLoadsForClientNotification(Vector<String>& loads); + DocumentLoadTiming* timing() { return &m_documentLoadTiming; } + #if ENABLE(OFFLINE_WEB_APPLICATIONS) ApplicationCacheHost* applicationCacheHost() const { return m_applicationCacheHost.get(); } #endif @@ -300,6 +302,8 @@ namespace WebCore { String m_clientRedirectSourceForHistory; bool m_didCreateGlobalHistoryEntry; + DocumentLoadTiming m_documentLoadTiming; + #if ENABLE(OFFLINE_WEB_APPLICATIONS) friend class ApplicationCacheHost; // for substitute resource delivery OwnPtr<ApplicationCacheHost> m_applicationCacheHost; diff --git a/WebCore/loader/DocumentThreadableLoader.cpp b/WebCore/loader/DocumentThreadableLoader.cpp index 4a7a88b..16f114d 100644 --- a/WebCore/loader/DocumentThreadableLoader.cpp +++ b/WebCore/loader/DocumentThreadableLoader.cpp @@ -37,10 +37,12 @@ #include "Document.h" #include "Frame.h" #include "FrameLoader.h" +#include "ResourceHandle.h" #include "ResourceRequest.h" #include "SecurityOrigin.h" #include "SubresourceLoader.h" #include "ThreadableLoaderClient.h" +#include <wtf/UnusedParam.h> namespace WebCore { @@ -264,14 +266,20 @@ bool DocumentThreadableLoader::getShouldUseCredentialStorage(SubresourceLoader* return false; // Only FrameLoaderClient can ultimately permit credential use. } -void DocumentThreadableLoader::didReceiveAuthenticationChallenge(SubresourceLoader* loader, const AuthenticationChallenge&) +void DocumentThreadableLoader::didReceiveAuthenticationChallenge(SubresourceLoader* loader, const AuthenticationChallenge& challenge) { ASSERT(loader == m_loader); // Users are not prompted for credentials for cross-origin requests. if (!m_sameOriginRequest) { +#if PLATFORM(MAC) || USE(CFNETWORK) || USE(CURL) + loader->handle()->receivedRequestToContinueWithoutCredential(challenge); +#else + // These platforms don't provide a way to continue without credentials, cancel the load altogether. + UNUSED_PARAM(challenge); RefPtr<DocumentThreadableLoader> protect(this); m_client->didFail(loader->blockedError()); cancel(); +#endif } } diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index 869de22..aab30fc 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -157,7 +157,7 @@ public: virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; } - virtual bool setCursor(PlatformCursorHandle) { return false; } + virtual void setCursor(const Cursor&) { } virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {} @@ -170,6 +170,9 @@ public: virtual void scheduleCompositingLayerSync() {}; #endif +#if PLATFORM(WIN) + virtual void setLastSetCursorToCurrentCursor() { } +#endif #if ENABLE(TOUCH_EVENTS) virtual void needTouchEvents(bool) { } #endif @@ -309,6 +312,8 @@ public: virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) virtual PassRefPtr<Widget> createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&) { return 0; } + virtual void hideMediaPlayerProxyPlugin(Widget*) { } + virtual void showMediaPlayerProxyPlugin(Widget*) { } #endif virtual ObjectContentType objectContentType(const KURL&, const String&) { return ObjectContentType(); } @@ -439,6 +444,7 @@ public: virtual void showSpellingUI(bool) { } virtual bool spellingUIIsShowing() { return false; } virtual void getGuessesForWord(const String&, Vector<String>&) { } + virtual void willSetInputMethodState() { } virtual void setInputMethodState(bool) { } diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 7b7487f..0ec4c98 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -66,6 +66,9 @@ #endif // PLATFORM(ANDROID) #include "HTMLAnchorElement.h" #include "HTMLFormElement.h" +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +#include "HTMLMediaElement.h" +#endif #include "HTMLNames.h" #include "HTMLObjectElement.h" #include "HTTPParsers.h" @@ -104,11 +107,6 @@ #include <wtf/StdLibExtras.h> #include <wtf/text/CString.h> -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -#include "HTMLMediaElement.h" -#include "RenderVideo.h" -#endif - #if ENABLE(SHARED_WORKERS) #include "SharedWorkerRepository.h" #endif @@ -460,9 +458,18 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic if (m_frame->domWindow()) { if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document()); - if (!m_frame->document()->inPageCache()) + if (!m_frame->document()->inPageCache()) { m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document()); - m_frameLoadTimeline.unloadEventEnd = currentTime(); + + if (m_provisionalDocumentLoader) { + DocumentLoadTiming* timing = m_provisionalDocumentLoader->timing(); + ASSERT(timing->navigationStart); + // FIXME: This fails in Safari (https://bugs.webkit.org/show_bug.cgi?id=42772). Understand why. + // ASSERT(!timing->unloadEventEnd); + timing->unloadEventEnd = currentTime(); + ASSERT(timing->unloadEventEnd >= timing->navigationStart); + } + } } m_pageDismissalEventBeingDispatched = false; if (m_frame->document()) @@ -1531,9 +1538,6 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t if (m_pageDismissalEventBeingDispatched) return; - m_frameLoadTimeline = FrameLoadTimeline(); - m_frameLoadTimeline.navigationStart = currentTime(); - policyChecker()->setLoadType(type); RefPtr<FormState> formState = prpFormState; bool isFormSubmission = formState; @@ -2249,6 +2253,8 @@ void FrameLoader::finishedLoading() RefPtr<Frame> protect(m_frame); RefPtr<DocumentLoader> dl = activeDocumentLoader(); + ASSERT(!dl->timing()->responseEnd); + dl->timing()->responseEnd = currentTime(); dl->finishedLoading(); if (!dl->mainDocumentError().isNull() || !dl->frameLoader()) return; @@ -2367,6 +2373,9 @@ bool FrameLoader::subframeIsLoading() const documentLoader = childLoader->provisionalDocumentLoader(); if (documentLoader && documentLoader->isLoadingInAPISense()) return true; + documentLoader = childLoader->policyDocumentLoader(); + if (documentLoader) + return true; } return false; } @@ -2546,6 +2555,9 @@ void FrameLoader::continueLoadAfterWillSubmitForm() notifier()->assignIdentifierToInitialRequest(identifier, m_provisionalDocumentLoader.get(), m_provisionalDocumentLoader->originalRequest()); } + ASSERT(!m_provisionalDocumentLoader->timing()->navigationStart); + m_provisionalDocumentLoader->timing()->navigationStart = currentTime(); + if (!m_provisionalDocumentLoader->startLoadingMainResource(identifier)) m_provisionalDocumentLoader->updateLoading(); } @@ -2649,8 +2661,6 @@ void FrameLoader::handledOnloadEvents() { m_client->dispatchDidHandleOnloadEvents(); - m_loadType = FrameLoadTypeStandard; - #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (documentLoader()) documentLoader()->applicationCacheHost()->stopDeferringEvents(); @@ -2730,7 +2740,14 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp // 2. Delegates that modify the cache policy using willSendRequest: should // not affect any other resources. Such changes need to be done // per request. - if (loadType == FrameLoadTypeReload) { + if (!mainResource) { + if (request.isConditional()) + request.setCachePolicy(ReloadIgnoringCacheData); + else if (documentLoader()->isLoadingInAPISense()) + request.setCachePolicy(documentLoader()->originalRequest().cachePolicy()); + else + request.setCachePolicy(UseProtocolCachePolicy); + } else if (loadType == FrameLoadTypeReload) { request.setCachePolicy(ReloadIgnoringCacheData); request.setHTTPHeaderField("Cache-Control", "max-age=0"); } else if (loadType == FrameLoadTypeReloadFromOrigin) { @@ -2739,10 +2756,8 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp request.setHTTPHeaderField("Pragma", "no-cache"); } else if (request.isConditional()) request.setCachePolicy(ReloadIgnoringCacheData); - else if (isBackForwardLoadType(loadType) && !request.url().protocolIs("https")) + else if (isBackForwardLoadType(loadType) && m_stateMachine.committedFirstRealDocumentLoad() && !request.url().protocolIs("https")) request.setCachePolicy(ReturnCacheDataElseLoad); - else if (!mainResource && documentLoader()->isLoadingInAPISense()) - request.setCachePolicy(documentLoader()->originalRequest().cachePolicy()); if (mainResource) request.setHTTPAccept(defaultAcceptHeader); @@ -3038,7 +3053,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && USE(JSC) if (Page* page = m_frame->page()) { if (page->mainFrame() == m_frame) - page->inspectorController()->resumeDebugger(); + page->inspectorController()->resume(); } #endif @@ -3114,14 +3129,13 @@ void FrameLoader::loadedResourceFromMemoryCache(const CachedResource* resource) if (!page) return; -#if ENABLE(INSPECTOR) - page->inspectorController()->didLoadResourceFromMemoryCache(m_documentLoader.get(), resource); -#endif - if (!resource->sendResourceLoadCallbacks() || m_documentLoader->haveToldClientAboutLoad(resource->url())) return; if (!page->areMemoryCacheClientCallsEnabled()) { +#if ENABLE(INSPECTOR) + page->inspectorController()->didLoadResourceFromMemoryCache(m_documentLoader.get(), resource); +#endif m_documentLoader->recordMemoryCacheLoadForFutureClientNotification(resource->url()); m_documentLoader->didTellClientAboutLoad(resource->url()); return; @@ -3129,6 +3143,9 @@ void FrameLoader::loadedResourceFromMemoryCache(const CachedResource* resource) ResourceRequest request(resource->url()); if (m_client->dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, resource->response(), resource->encodedSize())) { +#if ENABLE(INSPECTOR) + page->inspectorController()->didLoadResourceFromMemoryCache(m_documentLoader.get(), resource); +#endif m_documentLoader->didTellClientAboutLoad(resource->url()); return; } @@ -3289,7 +3306,9 @@ void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType l case FrameLoadTypeBackWMLDeckNotAccessible: case FrameLoadTypeForward: case FrameLoadTypeIndexedBackForward: - if (!itemURL.protocolIs("https")) + // If the first load within a frame is a navigation within a back/forward list that was attached + // without any of the items being loaded then we should use the default caching policy (<rdar://problem/8131355>). + if (m_stateMachine.committedFirstRealDocumentLoad() && !itemURL.protocolIs("https")) request.setCachePolicy(ReturnCacheDataElseLoad); break; case FrameLoadTypeStandard: diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index 491e6ef..de043d2 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -197,7 +197,6 @@ public: void didChangeIcons(DocumentLoader*); FrameLoadType loadType() const; - FrameLoadTimeline* frameLoadTimeline() { return &m_frameLoadTimeline; } CachePolicy subresourceCachePolicy() const; @@ -450,7 +449,6 @@ private: FrameState m_state; FrameLoadType m_loadType; - FrameLoadTimeline m_frameLoadTimeline; // Document loaders for the three phases of frame loading. Note that while // a new request is being loaded, the old document loader may still be referenced. diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h index c74933b..c7bd456 100644 --- a/WebCore/loader/FrameLoaderClient.h +++ b/WebCore/loader/FrameLoaderClient.h @@ -237,6 +237,8 @@ namespace WebCore { virtual void dispatchDidFailToStartPlugin(const PluginView*) const { } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) virtual PassRefPtr<Widget> createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&) = 0; + virtual void hideMediaPlayerProxyPlugin(Widget*) = 0; + virtual void showMediaPlayerProxyPlugin(Widget*) = 0; #endif virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0; diff --git a/WebCore/loader/FrameLoaderTypes.h b/WebCore/loader/FrameLoaderTypes.h index b1388a5..387b067 100644 --- a/WebCore/loader/FrameLoaderTypes.h +++ b/WebCore/loader/FrameLoaderTypes.h @@ -60,17 +60,28 @@ namespace WebCore { FrameLoadTypeBackWMLDeckNotAccessible }; - struct FrameLoadTimeline { - FrameLoadTimeline() - : navigationStart(0) - , unloadEventEnd(0) - , loadEventStart(0) - , loadEventEnd(0) + // FIXME: Move to DocumentLoadTiming.h. + struct DocumentLoadTiming { + DocumentLoadTiming() + : navigationStart(0.0) + , unloadEventEnd(0.0) + , redirectStart(0.0) + , redirectEnd(0.0) + , redirectCount(0) + , fetchStart(0.0) + , responseEnd(0.0) + , loadEventStart(0.0) + , loadEventEnd(0.0) { } double navigationStart; double unloadEventEnd; + double redirectStart; + double redirectEnd; + short redirectCount; + double fetchStart; + double responseEnd; double loadEventStart; double loadEventEnd; }; diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp index 0a5bf40..504a5ea 100644 --- a/WebCore/loader/MainResourceLoader.cpp +++ b/WebCore/loader/MainResourceLoader.cpp @@ -44,6 +44,7 @@ #include "ResourceError.h" #include "ResourceHandle.h" #include "Settings.h" +#include <wtf/CurrentTime.h> // FIXME: More that is in common with SubresourceLoader should move up into ResourceLoader. @@ -157,7 +158,17 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso // The additional processing can do anything including possibly removing the last // reference to this object; one example of this is 3266216. RefPtr<MainResourceLoader> protect(this); - + + ASSERT(documentLoader()->timing()->fetchStart); + if (!redirectResponse.isNull()) { + DocumentLoadTiming* documentLoadTiming = documentLoader()->timing(); + documentLoadTiming->redirectCount++; + if (!documentLoadTiming->redirectStart) + documentLoadTiming->redirectStart = documentLoadTiming->fetchStart; + documentLoadTiming->redirectEnd = currentTime(); + documentLoadTiming->fetchStart = documentLoadTiming->redirectEnd; + } + // Update cookie policy base URL as URL changes, except for subframes, which use the // URL of the main frame which doesn't change when we redirect. if (frameLoader()->isLoadingMainFrame()) @@ -223,7 +234,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, receivedError(cannotShowURLError()); return; } - frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->request(), r); + frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->firstRequest(), r); // It might have gone missing if (frameLoader()) receivedError(interruptionForPolicyChangeError()); @@ -464,6 +475,10 @@ void MainResourceLoader::handleDataLoadNow(MainResourceLoaderTimer*) KURL url = m_substituteData.responseURL(); if (url.isEmpty()) url = m_initialRequest.url(); + + // Clear the initial request here so that subsequent entries into the + // loader will not think there's still a deferred load left to do. + m_initialRequest = ResourceRequest(); ResourceResponse response(url, m_substituteData.mimeType(), m_substituteData.content()->size(), m_substituteData.textEncoding(), ""); didReceiveResponse(response); @@ -528,6 +543,9 @@ bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& su m_substituteData = substituteData; + ASSERT(documentLoader()->timing()->navigationStart); + ASSERT(!documentLoader()->timing()->fetchStart); + documentLoader()->timing()->fetchStart = currentTime(); ResourceRequest request(r); #if ENABLE(OFFLINE_WEB_APPLICATIONS) diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp index f5a4c18..2206b4e 100644 --- a/WebCore/loader/SubframeLoader.cpp +++ b/WebCore/loader/SubframeLoader.cpp @@ -179,12 +179,23 @@ PassRefPtr<Widget> FrameLoader::loadMediaPlayerProxyPlugin(Node* node, const KUR if (widget && renderer) { renderer->setWidget(widget); - m_containsPlugIns = true; renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange); } + m_containsPlugIns = true; return widget ? widget.release() : 0; } + +void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget) +{ + m_client->hideMediaPlayerProxyPlugin(widget); +} + +void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget) +{ + m_client->showMediaPlayerProxyPlugin(widget); +} + #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) @@ -272,7 +283,7 @@ Frame* SubframeLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const K // FIXME: In this case the Frame will have finished loading before // it's being added to the child list. It would be a good idea to // create the child first, then invoke the loader separately. - if (frame->loader()->state() == FrameStateComplete) + if (frame->loader()->state() == FrameStateComplete && !frame->loader()->policyDocumentLoader()) frame->loader()->checkCompleted(); return frame.get(); diff --git a/WebCore/loader/SubresourceLoader.cpp b/WebCore/loader/SubresourceLoader.cpp index 7aef353..1e22fb1 100644 --- a/WebCore/loader/SubresourceLoader.cpp +++ b/WebCore/loader/SubresourceLoader.cpp @@ -248,14 +248,20 @@ void SubresourceLoader::didReceiveAuthenticationChallenge(const AuthenticationCh { RefPtr<SubresourceLoader> protect(this); + ASSERT(handle()->hasAuthenticationChallenge()); + if (m_client) m_client->didReceiveAuthenticationChallenge(this, challenge); // The SubResourceLoaderClient may have cancelled this ResourceLoader in response to the challenge. - // If that's the case, don't call didReceiveAuthenticationChallenge + // If that's the case, don't call didReceiveAuthenticationChallenge. if (reachedTerminalState()) return; - + + // It may have also handled authentication on its own. + if (!handle()->hasAuthenticationChallenge()) + return; + ResourceLoader::didReceiveAuthenticationChallenge(challenge); } diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp index 2effba7..9b05e0d 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -481,7 +481,7 @@ PassRefPtr<ResourceHandle> ApplicationCacheGroup::createResourceHandle(const KUR m_currentResourceIdentifier = m_frame->page()->progress()->createUniqueIdentifier(); if (Page* page = m_frame->page()) { InspectorController* inspectorController = page->inspectorController(); - inspectorController->identifierForInitialRequest(m_currentResourceIdentifier, m_frame->loader()->documentLoader(), handle->request()); + inspectorController->identifierForInitialRequest(m_currentResourceIdentifier, m_frame->loader()->documentLoader(), handle->firstRequest()); ResourceResponse redirectResponse = ResourceResponse(); inspectorController->willSendRequest(m_currentResourceIdentifier, request, redirectResponse); } @@ -517,7 +517,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res ASSERT(handle == m_currentHandle); - KURL url(handle->request().url()); + KURL url(handle->firstRequest().url()); if (url.hasFragmentIdentifier()) url.removeFragmentIdentifier(); @@ -534,7 +534,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res ApplicationCacheResource* newestCachedResource = m_newestCache->resourceForURL(url); if (newestCachedResource) { m_cacheBeingUpdated->addResource(ApplicationCacheResource::create(url, newestCachedResource->response(), type, newestCachedResource->data())); - m_pendingEntries.remove(m_currentHandle->request().url()); + m_pendingEntries.remove(m_currentHandle->firstRequest().url()); m_currentHandle->cancel(); m_currentHandle = 0; // Load the next resource, if any. @@ -544,7 +544,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res // The server could return 304 for an unconditional request - in this case, we handle the response as a normal error. } - if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->request().url()) { + if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->firstRequest().url()) { if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) { // Note that cacheUpdateFailed() can cause the cache group to be deleted. cacheUpdateFailed(); @@ -559,10 +559,10 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res // Copy the resource and its metadata from the newest application cache in cache group whose completeness flag is complete, and act // as if that was the fetched resource, ignoring the resource obtained from the network. ASSERT(m_newestCache); - ApplicationCacheResource* newestCachedResource = m_newestCache->resourceForURL(handle->request().url()); + ApplicationCacheResource* newestCachedResource = m_newestCache->resourceForURL(handle->firstRequest().url()); ASSERT(newestCachedResource); m_cacheBeingUpdated->addResource(ApplicationCacheResource::create(url, newestCachedResource->response(), type, newestCachedResource->data())); - m_pendingEntries.remove(m_currentHandle->request().url()); + m_pendingEntries.remove(m_currentHandle->firstRequest().url()); m_currentHandle->cancel(); m_currentHandle = 0; // Load the next resource, if any. @@ -607,9 +607,9 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) } ASSERT(m_currentHandle == handle); - ASSERT(m_pendingEntries.contains(handle->request().url())); + ASSERT(m_pendingEntries.contains(handle->firstRequest().url())); - m_pendingEntries.remove(handle->request().url()); + m_pendingEntries.remove(handle->firstRequest().url()); ASSERT(m_cacheBeingUpdated); @@ -634,8 +634,8 @@ void ApplicationCacheGroup::didFail(ResourceHandle* handle, const ResourceError& return; } - unsigned type = m_currentResource ? m_currentResource->type() : m_pendingEntries.get(handle->request().url()); - KURL url(handle->request().url()); + unsigned type = m_currentResource ? m_currentResource->type() : m_pendingEntries.get(handle->firstRequest().url()); + KURL url(handle->firstRequest().url()); if (url.hasFragmentIdentifier()) url.removeFragmentIdentifier(); @@ -671,13 +671,12 @@ void ApplicationCacheGroup::didReceiveManifestResponse(const ResourceResponse& r if (response.httpStatusCode() == 304) return; - if (response.httpStatusCode() / 100 != 2 || response.url() != m_manifestHandle->request().url() || !equalIgnoringCase(response.mimeType(), "text/cache-manifest")) { + if (response.httpStatusCode() / 100 != 2 || response.url() != m_manifestHandle->firstRequest().url() || !equalIgnoringCase(response.mimeType(), "text/cache-manifest")) { cacheUpdateFailed(); return; } - m_manifestResource = ApplicationCacheResource::create(m_manifestHandle->request().url(), response, - ApplicationCacheResource::Manifest); + m_manifestResource = ApplicationCacheResource::create(m_manifestHandle->firstRequest().url(), response, ApplicationCacheResource::Manifest); } void ApplicationCacheGroup::didReceiveManifestData(const char* data, int length) diff --git a/WebCore/loader/appcache/DOMApplicationCache.idl b/WebCore/loader/appcache/DOMApplicationCache.idl index 8525fe6..9113ffa 100644 --- a/WebCore/loader/appcache/DOMApplicationCache.idl +++ b/WebCore/loader/appcache/DOMApplicationCache.idl @@ -28,7 +28,8 @@ module offline { interface [ Conditional=OFFLINE_WEB_APPLICATIONS, EventTarget, - OmitConstructor + OmitConstructor, + DontCheckEnums ] DOMApplicationCache { // update status const unsigned short UNCACHED = 0; diff --git a/WebCore/loader/icon/IconLoader.cpp b/WebCore/loader/icon/IconLoader.cpp index eb49087..6e2762f 100644 --- a/WebCore/loader/icon/IconLoader.cpp +++ b/WebCore/loader/icon/IconLoader.cpp @@ -91,7 +91,7 @@ void IconLoader::didReceiveResponse(SubresourceLoader* resourceLoader, const Res if (status && (status < 200 || status > 299)) { ResourceHandle* handle = resourceLoader->handle(); - finishLoading(handle ? handle->request().url() : KURL(), 0); + finishLoading(handle ? handle->firstRequest().url() : KURL(), 0); } } @@ -115,7 +115,7 @@ void IconLoader::didFail(SubresourceLoader* resourceLoader, const ResourceError& if (m_loadIsInProgress) { ASSERT(resourceLoader == m_resourceLoader); ResourceHandle* handle = resourceLoader->handle(); - finishLoading(handle ? handle->request().url() : KURL(), 0); + finishLoading(handle ? handle->firstRequest().url() : KURL(), 0); } } @@ -137,7 +137,7 @@ void IconLoader::didFinishLoading(SubresourceLoader* resourceLoader) if (m_loadIsInProgress) { ASSERT(resourceLoader == m_resourceLoader); ResourceHandle* handle = resourceLoader->handle(); - finishLoading(handle ? handle->request().url() : KURL(), m_resourceLoader->resourceData()); + finishLoading(handle ? handle->firstRequest().url() : KURL(), m_resourceLoader->resourceData()); } } diff --git a/WebCore/loader/loader.cpp b/WebCore/loader/loader.cpp index e137a5f..230d6ea 100644 --- a/WebCore/loader/loader.cpp +++ b/WebCore/loader/loader.cpp @@ -590,8 +590,8 @@ void Loader::Host::cancelPendingRequests(RequestQueue& requestsPending, DocLoade Request* request = *it; if (request->docLoader() == docLoader) { cache()->remove(request->cachedResource()); - delete request; docLoader->decrementRequestCount(request->cachedResource()); + delete request; } else remaining.append(request); } |