diff options
Diffstat (limited to 'Source/WebCore/loader')
40 files changed, 273 insertions, 192 deletions
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp index 121045b..1437adc 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -649,7 +649,7 @@ void DocumentLoader::stopRecordingResponses() m_stopRecordingResponses = true; } -void DocumentLoader::setTitle(const String& title) +void DocumentLoader::setTitle(const StringWithDirection& title) { if (title.isEmpty()) return; diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h index 1f88272..c6f0bc5 100644 --- a/Source/WebCore/loader/DocumentLoader.h +++ b/Source/WebCore/loader/DocumentLoader.h @@ -36,6 +36,7 @@ #include "ResourceError.h" #include "ResourceRequest.h" #include "ResourceResponse.h" +#include "StringWithDirection.h" #include "SubstituteData.h" #include "Timer.h" #include <wtf/HashSet.h> @@ -121,7 +122,7 @@ namespace WebCore { bool wasOnloadHandled() { return m_wasOnloadHandled; } bool isLoadingInAPISense() const; void setPrimaryLoadComplete(bool); - void setTitle(const String&); + void setTitle(const StringWithDirection&); void setIconURL(const String&); const String& overrideEncoding() const { return m_overrideEncoding; } @@ -168,7 +169,7 @@ namespace WebCore { const ResourceRequest& lastCheckedRequest() { return m_lastCheckedRequest; } void stopRecordingResponses(); - const String& title() const { return m_pageTitle; } + const StringWithDirection& title() const { return m_pageTitle; } const String& iconURL() const { return m_pageIconURL; } KURL urlForHistory() const; @@ -298,7 +299,7 @@ namespace WebCore { bool m_isClientRedirect; bool m_wasOnloadHandled; - String m_pageTitle; + StringWithDirection m_pageTitle; String m_pageIconURL; String m_overrideEncoding; diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp index 73c3e80..f02994a 100644 --- a/Source/WebCore/loader/DocumentThreadableLoader.cpp +++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp @@ -232,7 +232,7 @@ void DocumentThreadableLoader::didReceiveResponse(SubresourceLoader* loader, con } } -void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const char* data, int lengthReceived) +void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const char* data, int dataLength) { ASSERT(m_client); ASSERT_UNUSED(loader, loader == m_loader); @@ -241,10 +241,10 @@ void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const c if (m_actualRequest) return; - m_client->didReceiveData(data, lengthReceived); + m_client->didReceiveData(data, dataLength); } -void DocumentThreadableLoader::didReceiveCachedMetadata(SubresourceLoader* loader, const char* data, int lengthReceived) +void DocumentThreadableLoader::didReceiveCachedMetadata(SubresourceLoader* loader, const char* data, int dataLength) { ASSERT(m_client); ASSERT_UNUSED(loader, loader == m_loader); @@ -253,7 +253,7 @@ void DocumentThreadableLoader::didReceiveCachedMetadata(SubresourceLoader* loade if (m_actualRequest) return; - m_client->didReceiveCachedMetadata(data, lengthReceived); + m_client->didReceiveCachedMetadata(data, dataLength); } void DocumentThreadableLoader::didFinishLoading(SubresourceLoader* loader, double finishTime) diff --git a/Source/WebCore/loader/DocumentThreadableLoader.h b/Source/WebCore/loader/DocumentThreadableLoader.h index c511306..50f60ca 100644 --- a/Source/WebCore/loader/DocumentThreadableLoader.h +++ b/Source/WebCore/loader/DocumentThreadableLoader.h @@ -76,8 +76,8 @@ namespace WebCore { virtual void didSendData(SubresourceLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&); - virtual void didReceiveData(SubresourceLoader*, const char*, int lengthReceived); - virtual void didReceiveCachedMetadata(SubresourceLoader*, const char*, int lengthReceived); + virtual void didReceiveData(SubresourceLoader*, const char*, int dataLength); + virtual void didReceiveCachedMetadata(SubresourceLoader*, const char*, int dataLength); virtual void didFinishLoading(SubresourceLoader*, double); virtual void didFail(SubresourceLoader*, const ResourceError&); diff --git a/Source/WebCore/loader/DocumentWriter.cpp b/Source/WebCore/loader/DocumentWriter.cpp index af9ea53..2fc02d1 100644 --- a/Source/WebCore/loader/DocumentWriter.cpp +++ b/Source/WebCore/loader/DocumentWriter.cpp @@ -121,6 +121,8 @@ void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origi if (document->isPluginDocument() && m_frame->loader()->isSandboxed(SandboxPlugins)) document = SinkDocument::create(m_frame, url); + // FIXME: Do we need to consult the content security policy here about blocked plug-ins? + bool resetScripting = !(m_frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->document()->securityOrigin()->isSecureTransitionTo(url)); m_frame->loader()->clear(resetScripting, resetScripting); clear(); diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index cabb4ae..f082317 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -196,6 +196,10 @@ public: virtual NotificationPresenter* notificationPresenter() const { return 0; } #endif +#if ENABLE(DIRECTORY_UPLOAD) + virtual void enumerateChosenDirectory(const String&, FileChooser*) { } +#endif + virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { } virtual void chooseIconForFiles(const Vector<String>&, FileChooser*) { } @@ -270,7 +274,7 @@ public: virtual void dispatchWillClose() { } virtual void dispatchDidReceiveIcon() { } virtual void dispatchDidStartProvisionalLoad() { } - virtual void dispatchDidReceiveTitle(const String&) { } + virtual void dispatchDidReceiveTitle(const StringWithDirection&) { } virtual void dispatchDidChangeIcons() { } virtual void dispatchDidCommitLoad() { } virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { } @@ -338,7 +342,7 @@ public: virtual void prepareForDataSourceReplacement() { } virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return DocumentLoader::create(request, substituteData); } - virtual void setTitle(const String&, const KURL&) { } + virtual void setTitle(const StringWithDirection&, const KURL&) { } virtual String userAgent(const KURL&) { return ""; } @@ -415,11 +419,11 @@ public: virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) { } #if USE(UNIFIED_TEXT_CHECKING) - virtual void checkTextOfParagraph(const UChar*, int, uint64_t, Vector<TextCheckingResult>&) { }; + virtual void checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&) { }; #endif virtual void getGuessesForWord(const String&, const String&, Vector<String>&) { } - virtual void requestCheckingOfString(SpellChecker*, int, const String&) { } + virtual void requestCheckingOfString(SpellChecker*, int, TextCheckingTypeMask, const String&) { } }; class EmptyEditorClient : public EditorClient { diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 6819e71..dcaf03a 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -615,7 +615,7 @@ void FrameLoader::receivedFirstData() dispatchDidClearWindowObjectsInAllWorlds(); if (m_documentLoader) { - String ptitle = m_documentLoader->title(); + StringWithDirection ptitle = m_documentLoader->title(); // If we have a title let the WebView know about it. if (!ptitle.isNull()) m_client->dispatchDidReceiveTitle(ptitle); @@ -712,10 +712,10 @@ void FrameLoader::startIconLoader() if (urlString.isEmpty()) return; - // People who want to avoid loading images generally want to avoid loading all images. + // People who want to avoid loading images generally want to avoid loading all images, unless an exception has been made for site icons. // Now that we've accounted for URL mapping, avoid starting the network load if images aren't set to display automatically. Settings* settings = m_frame->settings(); - if (settings && !settings->loadsImagesAutomatically()) + if (settings && !settings->loadsImagesAutomatically() && !settings->loadsSiteIconsIgnoringImageLoadingSetting()) return; // If we're reloading the page, always start the icon load now. @@ -798,11 +798,11 @@ void FrameLoader::commitIconURLToIconDatabase(const KURL& icon) void FrameLoader::finishedParsing() { + m_frame->injectUserScripts(InjectAtDocumentEnd); + if (m_stateMachine.creatingInitialEmptyDocument()) return; - m_frame->injectUserScripts(InjectAtDocumentEnd); - // This can be called from the Frame's destructor, in which case we shouldn't protect ourselves // because doing so will cause us to re-enter the destructor when protector goes out of scope. // Null-checking the FrameView indicates whether or not we're in the destructor. @@ -1478,6 +1478,11 @@ void FrameLoader::load(DocumentLoader* newDocumentLoader) // shouldn't a more explicit type of reload be defined, that means roughly // "load without affecting history" ? if (shouldReloadToHandleUnreachableURL(newDocumentLoader)) { + // shouldReloadToHandleUnreachableURL() returns true only when the original load type is back-forward. + // In this case we should save the document state now. Otherwise the state can be lost because load type is + // changed and updateForBackForwardNavigation() will not be called when loading is committed. + history()->saveDocumentAndScrollState(); + ASSERT(type == FrameLoadTypeStandard); type = FrameLoadTypeReload; } @@ -1936,9 +1941,9 @@ void FrameLoader::commitProvisionalLoad() dispatchDidCommitLoad(); // If we have a title let the WebView know about it. - String title = m_documentLoader->title(); - if (!title.isNull()) - m_client->dispatchDidReceiveTitle(title); + StringWithDirection title = m_documentLoader->title(); + if (!title.isNull()) + m_client->dispatchDidReceiveTitle(title); checkCompleted(); } else { @@ -2839,7 +2844,8 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ } #endif } - notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, data.size(), static_cast<int>(response.expectedContentLength()), error); + int encodedDataLength = response.resourceLoadInfo() ? static_cast<int>(response.resourceLoadInfo()->encodedDataLength) : -1; + notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, data.size(), encodedDataLength, error); return identifier; } @@ -3393,7 +3399,7 @@ bool FrameLoader::canAuthenticateAgainstProtectionSpace(ResourceLoader* loader, } #endif -void FrameLoader::setTitle(const String& title) +void FrameLoader::setTitle(const StringWithDirection& title) { documentLoader()->setTitle(title); } diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h index 1fb9e3c..ae4c6d3 100644 --- a/Source/WebCore/loader/FrameLoader.h +++ b/Source/WebCore/loader/FrameLoader.h @@ -38,6 +38,7 @@ #include "IconDatabaseBase.h" #include "PolicyChecker.h" #include "ResourceLoadNotifier.h" +#include "ScriptValue.h" #include "SubframeLoader.h" #include "ThreadableLoader.h" #include "Timer.h" @@ -78,6 +79,7 @@ class ScriptValue; class SecurityOrigin; class SerializedScriptValue; class SharedBuffer; +class StringWithDirection; class SubstituteData; class TextResourceDecoder; @@ -282,7 +284,7 @@ public: void cancelAndClear(); - void setTitle(const String&); + void setTitle(const StringWithDirection&); void setIconURL(const String&); void commitProvisionalLoad(); diff --git a/Source/WebCore/loader/FrameLoaderClient.h b/Source/WebCore/loader/FrameLoaderClient.h index e89056d..3709335 100644 --- a/Source/WebCore/loader/FrameLoaderClient.h +++ b/Source/WebCore/loader/FrameLoaderClient.h @@ -84,6 +84,7 @@ namespace WebCore { class ResourceResponse; class SecurityOrigin; class SharedBuffer; + class StringWithDirection; class SubstituteData; class Widget; @@ -122,7 +123,7 @@ namespace WebCore { virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long identifier, const ProtectionSpace&) = 0; #endif virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&) = 0; - virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) = 0; + virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength) = 0; virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) = 0; virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&) = 0; virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) = 0; @@ -139,7 +140,7 @@ namespace WebCore { virtual void dispatchWillClose() = 0; virtual void dispatchDidReceiveIcon() = 0; virtual void dispatchDidStartProvisionalLoad() = 0; - virtual void dispatchDidReceiveTitle(const String& title) = 0; + virtual void dispatchDidReceiveTitle(const StringWithDirection&) = 0; virtual void dispatchDidChangeIcons() = 0; virtual void dispatchDidCommitLoad() = 0; virtual void dispatchDidFailProvisionalLoad(const ResourceError&) = 0; @@ -227,7 +228,7 @@ namespace WebCore { virtual void prepareForDataSourceReplacement() = 0; virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) = 0; - virtual void setTitle(const String& title, const KURL&) = 0; + virtual void setTitle(const StringWithDirection&, const KURL&) = 0; virtual String userAgent(const KURL&) = 0; diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp index b8bece9..f9d85bc 100644 --- a/Source/WebCore/loader/HistoryController.cpp +++ b/Source/WebCore/loader/HistoryController.cpp @@ -79,7 +79,7 @@ void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item) if (!item || !m_frame->view()) return; - item->setScrollPoint(m_frame->view()->scrollPosition()); + item->setScrollPoint(m_frame->view()->cachedScrollPosition()); item->setPageScaleFactor(m_frame->pageScaleFactor()); // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client. @@ -265,7 +265,7 @@ void HistoryController::updateForBackForwardNavigation() { #if !LOG_DISABLED if (m_frame->loader()->documentLoader()) - LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); + LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif // Must grab the current scroll position before disturbing it @@ -281,7 +281,7 @@ void HistoryController::updateForReload() { #if !LOG_DISABLED if (m_frame->loader()->documentLoader()) - LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); + LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif if (m_currentItem) { @@ -343,7 +343,7 @@ void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED if (m_frame->loader()->documentLoader()) - LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); + LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif Settings* settings = m_frame->settings(); @@ -385,7 +385,7 @@ void HistoryController::updateForClientRedirect() { #if !LOG_DISABLED if (m_frame->loader()->documentLoader()) - LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); + LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif // Clear out form data so we don't try to restore it into the incoming page. Must happen after @@ -410,7 +410,7 @@ void HistoryController::updateForCommit() FrameLoader* frameLoader = m_frame->loader(); #if !LOG_DISABLED if (frameLoader->documentLoader()) - LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().utf8().data()); + LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().string().utf8().data()); #endif FrameLoadType type = frameLoader->loadType(); if (isBackForwardLoadType(type) @@ -526,10 +526,11 @@ void HistoryController::setCurrentItem(HistoryItem* item) m_currentItem = item; } -void HistoryController::setCurrentItemTitle(const String& title) +void HistoryController::setCurrentItemTitle(const StringWithDirection& title) { if (m_currentItem) - m_currentItem->setTitle(title); + // FIXME: make use of title.direction() as well. + m_currentItem->setTitle(title.string()); } bool HistoryController::currentItemShouldBeReplaced() const @@ -576,12 +577,13 @@ void HistoryController::initializeItem(HistoryItem* item) Frame* parentFrame = m_frame->tree()->parent(); String parent = parentFrame ? parentFrame->tree()->uniqueName() : ""; - String title = documentLoader->title(); + StringWithDirection title = documentLoader->title(); item->setURL(url); item->setTarget(m_frame->tree()->uniqueName()); item->setParent(parent); - item->setTitle(title); + // FIXME: should store title directionality in history as well. + item->setTitle(title.string()); item->setOriginalURLString(originalURL.string()); if (!unreachableURL.isEmpty() || documentLoader->response().httpStatusCode() >= 400) @@ -797,6 +799,10 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, m_currentItem->setURLString(urlString); page->backForward()->addItem(topItem.release()); + + addVisitedLink(page, KURL(ParsedURLString, urlString)); + m_frame->loader()->client()->updateGlobalHistory(); + } void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) @@ -808,6 +814,10 @@ void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObje m_currentItem->setURLString(urlString); m_currentItem->setTitle(title); m_currentItem->setStateObject(stateObject); + + ASSERT(m_frame->page()); + addVisitedLink(m_frame->page(), KURL(ParsedURLString, urlString)); + m_frame->loader()->client()->updateGlobalHistory(); } } // namespace WebCore diff --git a/Source/WebCore/loader/HistoryController.h b/Source/WebCore/loader/HistoryController.h index 59f11a2..15e12c0 100644 --- a/Source/WebCore/loader/HistoryController.h +++ b/Source/WebCore/loader/HistoryController.h @@ -40,6 +40,7 @@ namespace WebCore { class Frame; class HistoryItem; class SerializedScriptValue; +class StringWithDirection; class HistoryController { WTF_MAKE_NONCOPYABLE(HistoryController); @@ -71,7 +72,7 @@ public: HistoryItem* currentItem() const { return m_currentItem.get(); } void setCurrentItem(HistoryItem*); - void setCurrentItemTitle(const String&); + void setCurrentItemTitle(const StringWithDirection&); bool currentItemShouldBeReplaced() const; HistoryItem* previousItem() const { return m_previousItem.get(); } diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 0cdbc21..2078fdc 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -31,6 +31,7 @@ #include "MainResourceLoader.h" #include "ApplicationCacheHost.h" +#include "DOMWindow.h" #include "Document.h" #include "DocumentLoadTiming.h" #include "DocumentLoader.h" @@ -39,6 +40,7 @@ #include "FrameLoader.h" #include "FrameLoaderClient.h" #include "HTMLFormElement.h" +#include "InspectorInstrumentation.h" #include "Page.h" #if PLATFORM(QT) #include "PluginDatabase.h" @@ -262,6 +264,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, receivedError(cannotShowURLError()); return; } + InspectorInstrumentation::continueWithPolicyDownload(m_frame.get(), documentLoader(), identifier(), r); frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->firstRequest(), r); // It might have gone missing if (frameLoader()) @@ -269,6 +272,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, return; case PolicyIgnore: + InspectorInstrumentation::continueWithPolicyIgnore(m_frame.get(), documentLoader(), identifier(), r); stopLoadingForPolicyChange(); return; @@ -355,6 +359,10 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) if (it != r.httpHeaderFields().end()) { String content = it->second; if (m_frame->loader()->shouldInterruptLoadForXFrameOptions(content, r.url())) { + InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame.get(), documentLoader(), identifier(), r); + DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to display document because display forbidden by X-Frame-Options.\n")); + m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String()); + cancel(); return; } @@ -411,7 +419,7 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) frameLoader()->policyChecker()->checkContentPolicy(m_response, callContinueAfterContentPolicy, this); } -void MainResourceLoader::didReceiveData(const char* data, int length, long long lengthReceived, bool allAtOnce) +void MainResourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce) { ASSERT(data); ASSERT(length != 0); @@ -434,7 +442,7 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) - documentLoader()->applicationCacheHost()->mainResourceDataReceived(data, length, lengthReceived, allAtOnce); + documentLoader()->applicationCacheHost()->mainResourceDataReceived(data, length, encodedDataLength, allAtOnce); #endif // The additional processing can do anything including possibly removing the last @@ -443,7 +451,7 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long m_timeOfLastDataReceived = currentTime(); - ResourceLoader::didReceiveData(data, length, lengthReceived, allAtOnce); + ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); } void MainResourceLoader::didFinishLoading(double finishTime) diff --git a/Source/WebCore/loader/MainResourceLoader.h b/Source/WebCore/loader/MainResourceLoader.h index 1620f7a..73e7cfd 100644 --- a/Source/WebCore/loader/MainResourceLoader.h +++ b/Source/WebCore/loader/MainResourceLoader.h @@ -57,7 +57,7 @@ namespace WebCore { virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse); virtual void didReceiveResponse(const ResourceResponse&); - virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce); + virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce); virtual void didFinishLoading(double finishTime); virtual void didFail(const ResourceError&); diff --git a/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp b/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp index 75a2fe9..97a3ce6 100644 --- a/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp +++ b/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp @@ -92,13 +92,13 @@ void NetscapePlugInStreamLoader::didReceiveResponse(const ResourceResponse& resp didCancel(frameLoader()->fileDoesNotExistError(response)); } -void NetscapePlugInStreamLoader::didReceiveData(const char* data, int length, long long lengthReceived, bool allAtOnce) +void NetscapePlugInStreamLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce) { RefPtr<NetscapePlugInStreamLoader> protect(this); m_client->didReceiveData(this, data, length); - ResourceLoader::didReceiveData(data, length, lengthReceived, allAtOnce); + ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); } void NetscapePlugInStreamLoader::didFinishLoading(double finishTime) diff --git a/Source/WebCore/loader/NetscapePlugInStreamLoader.h b/Source/WebCore/loader/NetscapePlugInStreamLoader.h index 8db555e..1e7c629 100644 --- a/Source/WebCore/loader/NetscapePlugInStreamLoader.h +++ b/Source/WebCore/loader/NetscapePlugInStreamLoader.h @@ -57,7 +57,7 @@ namespace WebCore { private: virtual void didReceiveResponse(const ResourceResponse&); - virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce); + virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce); virtual void didFinishLoading(double finishTime); virtual void didFail(const ResourceError&); diff --git a/Source/WebCore/loader/ResourceLoadNotifier.cpp b/Source/WebCore/loader/ResourceLoadNotifier.cpp index 3a02aa3..ea6cf22 100644 --- a/Source/WebCore/loader/ResourceLoadNotifier.cpp +++ b/Source/WebCore/loader/ResourceLoadNotifier.cpp @@ -74,12 +74,12 @@ void ResourceLoadNotifier::didReceiveResponse(ResourceLoader* loader, const Reso dispatchDidReceiveResponse(loader->documentLoader(), loader->identifier(), r); } -void ResourceLoadNotifier::didReceiveData(ResourceLoader* loader, const char* data, int dataLength, int lengthReceived) +void ResourceLoadNotifier::didReceiveData(ResourceLoader* loader, const char* data, int dataLength, int encodedDataLength) { if (Page* page = m_frame->page()) page->progress()->incrementProgress(loader->identifier(), data, dataLength); - dispatchDidReceiveContentLength(loader->documentLoader(), loader->identifier(), dataLength, lengthReceived); + dispatchDidReceiveContentLength(loader->documentLoader(), loader->identifier(), dataLength, encodedDataLength); } void ResourceLoadNotifier::didFinishLoad(ResourceLoader* loader, double finishTime) @@ -130,11 +130,11 @@ void ResourceLoadNotifier::dispatchDidReceiveResponse(DocumentLoader* loader, un InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r); } -void ResourceLoadNotifier::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int dataLength, int lengthReceived) +void ResourceLoadNotifier::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int dataLength, int encodedDataLength) { m_frame->loader()->client()->dispatchDidReceiveContentLength(loader, identifier, dataLength); - InspectorInstrumentation::didReceiveContentLength(m_frame, identifier, dataLength, lengthReceived); + InspectorInstrumentation::didReceiveContentLength(m_frame, identifier, dataLength, encodedDataLength); } void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier, double finishTime) @@ -152,13 +152,13 @@ void ResourceLoadNotifier::dispatchTransferLoadingResourceFromPage(unsigned long oldPage->progress()->completeProgress(identifier); } -void ResourceLoadNotifier::sendRemainingDelegateMessages(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response, int dataLength, int lengthReceived, const ResourceError& error) +void ResourceLoadNotifier::sendRemainingDelegateMessages(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response, int dataLength, int encodedDataLength, const ResourceError& error) { if (!response.isNull()) dispatchDidReceiveResponse(loader, identifier, response); if (dataLength > 0) - dispatchDidReceiveContentLength(loader, identifier, dataLength, lengthReceived); + dispatchDidReceiveContentLength(loader, identifier, dataLength, encodedDataLength); if (error.isNull()) dispatchDidFinishLoading(loader, identifier, 0); diff --git a/Source/WebCore/loader/ResourceLoadNotifier.h b/Source/WebCore/loader/ResourceLoadNotifier.h index 5753c28..dafd619 100644 --- a/Source/WebCore/loader/ResourceLoadNotifier.h +++ b/Source/WebCore/loader/ResourceLoadNotifier.h @@ -53,18 +53,18 @@ public: void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); void didReceiveResponse(ResourceLoader*, const ResourceResponse&); - void didReceiveData(ResourceLoader*, const char*, int dataLength, int lengthReceived); + void didReceiveData(ResourceLoader*, const char*, int dataLength, int encodedDataLength); void didFinishLoad(ResourceLoader*, double finishTime); void didFailToLoad(ResourceLoader*, const ResourceError&); void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&); void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse); void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&); - void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength, int lengthReceived); + void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength, int encodedDataLength); void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, double finishTime); void dispatchTransferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*); - void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceResponse&, int dataLength, int lengthReceived, const ResourceError&); + void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceResponse&, int dataLength, int encodedDataLength, const ResourceError&); private: Frame* m_frame; diff --git a/Source/WebCore/loader/ResourceLoadScheduler.cpp b/Source/WebCore/loader/ResourceLoadScheduler.cpp index 7cceff7..0c0abb1 100644 --- a/Source/WebCore/loader/ResourceLoadScheduler.cpp +++ b/Source/WebCore/loader/ResourceLoadScheduler.cpp @@ -183,7 +183,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource LOG(ResourceLoading, "ResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'", host->name().latin1().data()); for (int priority = ResourceLoadPriorityHighest; priority >= minimumPriority; --priority) { - HostInformation::RequestQueue& requestsPending = host->requestsPending((ResourceLoadPriority) priority); + HostInformation::RequestQueue& requestsPending = host->requestsPending(ResourceLoadPriority(priority)); while (!requestsPending.isEmpty()) { RefPtr<ResourceLoader> resourceLoader = requestsPending.first(); @@ -193,7 +193,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource // and we don't know all stylesheets yet. Document* document = resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0; bool shouldLimitRequests = !host->name().isNull() || (document && (document->parsing() || !document->haveStylesheetsLoaded())); - if (shouldLimitRequests && host->limitRequests()) + if (shouldLimitRequests && host->limitRequests(ResourceLoadPriority(priority))) return; requestsPending.removeFirst(); @@ -283,8 +283,10 @@ bool ResourceLoadScheduler::HostInformation::hasRequests() const return false; } -bool ResourceLoadScheduler::HostInformation::limitRequests() const -{ +bool ResourceLoadScheduler::HostInformation::limitRequests(ResourceLoadPriority priority) const +{ + if (priority == ResourceLoadPriorityVeryLow && !m_requestsLoading.isEmpty()) + return true; return m_requestsLoading.size() >= (resourceLoadScheduler()->isSerialLoadingEnabled() ? 1 : m_maxRequestsInFlight); } diff --git a/Source/WebCore/loader/ResourceLoadScheduler.h b/Source/WebCore/loader/ResourceLoadScheduler.h index 49a4546..a32b307 100644 --- a/Source/WebCore/loader/ResourceLoadScheduler.h +++ b/Source/WebCore/loader/ResourceLoadScheduler.h @@ -82,7 +82,7 @@ private: void addLoadInProgress(ResourceLoader*); void remove(ResourceLoader*); bool hasRequests() const; - bool limitRequests() const; + bool limitRequests(ResourceLoadPriority) const; typedef Deque<RefPtr<ResourceLoader> > RequestQueue; RequestQueue& requestsPending(ResourceLoadPriority priority) { return m_requestsPending[priority]; } diff --git a/Source/WebCore/loader/ResourceLoader.cpp b/Source/WebCore/loader/ResourceLoader.cpp index 78c86d9..5172e92 100644 --- a/Source/WebCore/loader/ResourceLoader.cpp +++ b/Source/WebCore/loader/ResourceLoader.cpp @@ -273,7 +273,7 @@ void ResourceLoader::didReceiveResponse(const ResourceResponse& r) frameLoader()->notifier()->didReceiveResponse(this, m_response); } -void ResourceLoader::didReceiveData(const char* data, int length, long long lengthReceived, bool allAtOnce) +void ResourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce) { // The following assertions are not quite valid here, since a subclass // might override didReceiveData in a way that invalidates them. This @@ -290,7 +290,7 @@ void ResourceLoader::didReceiveData(const char* data, int length, long long leng // However, with today's computers and networking speeds, this won't happen in practice. // Could be an issue with a giant local file. if (m_sendResourceLoadCallbacks && m_frame) - frameLoader()->notifier()->didReceiveData(this, data, length, static_cast<int>(lengthReceived)); + frameLoader()->notifier()->didReceiveData(this, data, length, static_cast<int>(encodedDataLength)); } void ResourceLoader::willStopBufferingData(const char* data, int length) @@ -433,10 +433,10 @@ void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& didReceiveResponse(response); } -void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int lengthReceived) +void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int encodedDataLength) { InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier()); - didReceiveData(data, length, lengthReceived, false); + didReceiveData(data, length, encodedDataLength, false); InspectorInstrumentation::didReceiveResourceData(cookie); } diff --git a/Source/WebCore/loader/ResourceLoader.h b/Source/WebCore/loader/ResourceLoader.h index 339b130..571f568 100644 --- a/Source/WebCore/loader/ResourceLoader.h +++ b/Source/WebCore/loader/ResourceLoader.h @@ -83,7 +83,7 @@ namespace WebCore { virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse); virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(const ResourceResponse&); - virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce); + virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce); virtual void didReceiveCachedMetadata(const char*, int) { } void willStopBufferingData(const char*, int); virtual void didFinishLoading(double finishTime); @@ -104,7 +104,7 @@ namespace WebCore { virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& redirectResponse); virtual void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); - virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived); + virtual void didReceiveData(ResourceHandle*, const char*, int, int encodedDataLength); virtual void didReceiveCachedMetadata(ResourceHandle*, const char* data, int length) { didReceiveCachedMetadata(data, length); } virtual void didFinishLoading(ResourceHandle*, double finishTime); virtual void didFail(ResourceHandle*, const ResourceError&); diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp index e7f851f..d290765 100644 --- a/Source/WebCore/loader/SubframeLoader.cpp +++ b/Source/WebCore/loader/SubframeLoader.cpp @@ -33,6 +33,7 @@ #include "config.h" #include "SubframeLoader.h" +#include "ContentSecurityPolicy.h" #include "Frame.h" #include "FrameLoaderClient.h" #include "HTMLAppletElement.h" @@ -109,8 +110,12 @@ bool SubframeLoader::requestPlugin(HTMLPlugInImageElement* ownerElement, const K || (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) return false; - if (m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(SandboxPlugins)) - return false; + if (m_frame->document()) { + if (m_frame->document()->securityOrigin()->isSandboxed(SandboxPlugins)) + return false; + if (!m_frame->document()->contentSecurityPolicy()->allowObjectFromSource(url)) + return false; + } ASSERT(ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag)); return loadPlugin(ownerElement, url, mimeType, paramNames, paramValues, useFallback); diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp index cfe8d0a..3e37c1c 100644 --- a/Source/WebCore/loader/SubresourceLoader.cpp +++ b/Source/WebCore/loader/SubresourceLoader.cpp @@ -154,13 +154,13 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& r) } } -void SubresourceLoader::didReceiveData(const char* data, int length, long long lengthReceived, bool allAtOnce) +void SubresourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce) { // Reference the object in this method since the additional processing can do // anything including removing the last reference to this object; one example of this is 3266216. RefPtr<SubresourceLoader> protect(this); - ResourceLoader::didReceiveData(data, length, lengthReceived, allAtOnce); + ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); // A subresource loader does not load multipart sections progressively. // So don't deliver any data to the loader yet. diff --git a/Source/WebCore/loader/SubresourceLoader.h b/Source/WebCore/loader/SubresourceLoader.h index b3aefb6..a33b166 100644 --- a/Source/WebCore/loader/SubresourceLoader.h +++ b/Source/WebCore/loader/SubresourceLoader.h @@ -52,7 +52,7 @@ namespace WebCore { virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse); virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(const ResourceResponse&); - virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce); + virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce); virtual void didReceiveCachedMetadata(const char*, int); virtual void didFinishLoading(double finishTime); virtual void didFail(const ResourceError&); diff --git a/Source/WebCore/loader/SubresourceLoaderClient.h b/Source/WebCore/loader/SubresourceLoaderClient.h index c4b082c..53ac561 100644 --- a/Source/WebCore/loader/SubresourceLoaderClient.h +++ b/Source/WebCore/loader/SubresourceLoaderClient.h @@ -46,8 +46,8 @@ public: virtual void didSendData(SubresourceLoader*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&) { } - virtual void didReceiveData(SubresourceLoader*, const char*, int /*lengthReceived*/) { } - virtual void didReceiveCachedMetadata(SubresourceLoader*, const char*, int /*lengthReceived*/) { } + virtual void didReceiveData(SubresourceLoader*, const char*, int /*dataLength*/) { } + virtual void didReceiveCachedMetadata(SubresourceLoader*, const char*, int /*dataLength*/) { } virtual void didFinishLoading(SubresourceLoader*, double /*finishTime*/) { } virtual void didFail(SubresourceLoader*, const ResourceError&) { } diff --git a/Source/WebCore/loader/WorkerThreadableLoader.cpp b/Source/WebCore/loader/WorkerThreadableLoader.cpp index d753ecb..6672eee 100644 --- a/Source/WebCore/loader/WorkerThreadableLoader.cpp +++ b/Source/WebCore/loader/WorkerThreadableLoader.cpp @@ -191,10 +191,10 @@ static void workerContextDidReceiveData(ScriptExecutionContext* context, RefPtr< workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size()); } -void WorkerThreadableLoader::MainThreadBridge::didReceiveData(const char* data, int lengthReceived) +void WorkerThreadableLoader::MainThreadBridge::didReceiveData(const char* data, int dataLength) { - OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(lengthReceived)); // needs to be an OwnPtr for usage with createCallbackTask. - memcpy(vector->data(), data, lengthReceived); + OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // needs to be an OwnPtr for usage with createCallbackTask. + memcpy(vector->data(), data, dataLength); m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveData, m_workerClientWrapper, vector.release()), m_taskMode); } @@ -204,10 +204,10 @@ static void workerContextDidReceiveCachedMetadata(ScriptExecutionContext* contex workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData->size()); } -void WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata(const char* data, int lengthReceived) +void WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata(const char* data, int dataLength) { - OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(lengthReceived)); // needs to be an OwnPtr for usage with createCallbackTask. - memcpy(vector->data(), data, lengthReceived); + OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // needs to be an OwnPtr for usage with createCallbackTask. + memcpy(vector->data(), data, dataLength); m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveCachedMetadata, m_workerClientWrapper, vector.release()), m_taskMode); } diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp index 01c3836..1d347a8 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -553,9 +553,9 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res m_currentResource = ApplicationCacheResource::create(url, response, type); } -void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* data, int length, int lengthReceived) +void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* data, int length, int encodedDataLength) { - UNUSED_PARAM(lengthReceived); + UNUSED_PARAM(encodedDataLength); #if ENABLE(INSPECTOR) InspectorInstrumentation::didReceiveContentLength(m_frame, m_currentResourceIdentifier, length, 0); diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.h b/Source/WebCore/loader/appcache/ApplicationCacheGroup.h index f3a117e..ab7b16b 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.h @@ -112,7 +112,7 @@ private: virtual bool shouldUseCredentialStorage(ResourceHandle*) { return true; } virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); - virtual void didReceiveData(ResourceHandle*, const char*, int length, int lengthReceived); + virtual void didReceiveData(ResourceHandle*, const char*, int length, int encodedDataLength); virtual void didFinishLoading(ResourceHandle*, double finishTime); virtual void didFail(ResourceHandle*, const ResourceError&); diff --git a/Source/WebCore/loader/appcache/ApplicationCacheHost.h b/Source/WebCore/loader/appcache/ApplicationCacheHost.h index 56a5f57..24073cf 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheHost.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheHost.h @@ -126,7 +126,7 @@ namespace WebCore { void maybeLoadMainResourceForRedirect(ResourceRequest&, SubstituteData&); bool maybeLoadFallbackForMainResponse(const ResourceRequest&, const ResourceResponse&); bool maybeLoadFallbackForMainError(const ResourceRequest&, const ResourceError&); - void mainResourceDataReceived(const char* data, int length, long long lengthReceived, bool allAtOnce); + void mainResourceDataReceived(const char* data, int length, long long encodedDataLength, bool allAtOnce); void finishedLoadingMainResource(); void failedLoadingMainResource(); diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp index ea2ee14..60f0d6c 100644 --- a/Source/WebCore/loader/cache/CachedFont.cpp +++ b/Source/WebCore/loader/cache/CachedFont.cpp @@ -27,7 +27,8 @@ #include "config.h" #include "CachedFont.h" -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX) || OS(FREEBSD))) || PLATFORM(HAIKU) || OS(WINCE) || PLATFORM(ANDROID) || PLATFORM(BREWMP) +// FIXME: This should really be a blacklist instead of a whitelist +#if USE(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) || USE(SKIA_MAC_ON_CHROME))) || PLATFORM(HAIKU) || OS(WINCE) || PLATFORM(ANDROID) || PLATFORM(BREWMP) #define STORE_FONT_CUSTOM_PLATFORM_DATA #endif @@ -58,9 +59,6 @@ CachedFont::CachedFont(const String &url) : CachedResource(url, FontResource) , m_fontData(0) , m_loadInitiated(false) -#if ENABLE(SVG_FONTS) - , m_isSVGFont(false) -#endif { } @@ -105,9 +103,6 @@ void CachedFont::beginLoadIfNeeded(CachedResourceLoader* dl) bool CachedFont::ensureCustomFontData() { #ifdef STORE_FONT_CUSTOM_PLATFORM_DATA -#if ENABLE(SVG_FONTS) - ASSERT(!m_isSVGFont); -#endif if (!m_fontData && !errorOccurred() && !isLoading() && m_data) { m_fontData = createFontCustomPlatformData(m_data.get()); if (!m_fontData) @@ -134,13 +129,14 @@ FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, b #if ENABLE(SVG_FONTS) bool CachedFont::ensureSVGFontData() { - ASSERT(m_isSVGFont); if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) { m_externalSVGDocument = SVGDocument::create(0, KURL()); RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); - - m_externalSVGDocument->setContent(decoder->decode(m_data->data(), m_data->size()) + decoder->flush()); + String svgSource = decoder->decode(m_data->data(), m_data->size()); + svgSource += decoder->flush(); + + m_externalSVGDocument->setContent(svgSource); if (decoder->sawError()) m_externalSVGDocument = 0; @@ -151,7 +147,6 @@ bool CachedFont::ensureSVGFontData() SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const { - ASSERT(m_isSVGFont); RefPtr<NodeList> list = m_externalSVGDocument->getElementsByTagNameNS(SVGNames::fontTag.namespaceURI(), SVGNames::fontTag.localName()); if (!list) return 0; diff --git a/Source/WebCore/loader/cache/CachedFont.h b/Source/WebCore/loader/cache/CachedFont.h index d677f7b..dd9d60e 100644 --- a/Source/WebCore/loader/cache/CachedFont.h +++ b/Source/WebCore/loader/cache/CachedFont.h @@ -68,8 +68,6 @@ public: FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); #if ENABLE(SVG_FONTS) - bool isSVGFont() const { return m_isSVGFont; } - void setSVGFont(bool isSVG) { m_isSVGFont = isSVG; } bool ensureSVGFontData(); SVGFontElement* getSVGFontById(const String&) const; #endif @@ -79,7 +77,6 @@ private: bool m_loadInitiated; #if ENABLE(SVG_FONTS) - bool m_isSVGFont; RefPtr<SVGDocument> m_externalSVGDocument; #endif diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp index cc49415..ba30860 100644 --- a/Source/WebCore/loader/cache/CachedImage.cpp +++ b/Source/WebCore/loader/cache/CachedImage.cpp @@ -40,7 +40,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/Vector.h> -#if PLATFORM(CG) +#if USE(CG) #include "PDFDocumentImage.h" #endif @@ -244,7 +244,7 @@ inline void CachedImage::createImage() // Create the image if it doesn't yet exist. if (m_image) return; -#if PLATFORM(CG) && !USE(WEBKIT_IMAGE_DECODERS) +#if USE(CG) && !USE(WEBKIT_IMAGE_DECODERS) if (m_response.mimeType() == "application/pdf") { m_image = PDFDocumentImage::create(); return; diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp index 9413472..95f5522 100644 --- a/Source/WebCore/loader/cache/CachedResource.cpp +++ b/Source/WebCore/loader/cache/CachedResource.cpp @@ -62,7 +62,7 @@ static ResourceLoadPriority defaultPriorityForResourceType(CachedResource::Type case CachedResource::ImageResource: return ResourceLoadPriorityLow; #if ENABLE(LINK_PREFETCH) - case CachedResource::LinkPrefetch: + case CachedResource::LinkResource: return ResourceLoadPriorityVeryLow; #endif } @@ -504,10 +504,7 @@ bool CachedResource::canUseCacheValidator() const if (m_response.cacheControlContainsNoStore()) return false; - - DEFINE_STATIC_LOCAL(const AtomicString, lastModifiedHeader, ("last-modified")); - DEFINE_STATIC_LOCAL(const AtomicString, eTagHeader, ("etag")); - return !m_response.httpHeaderField(lastModifiedHeader).isEmpty() || !m_response.httpHeaderField(eTagHeader).isEmpty(); + return m_response.hasCacheValidatorFields(); } bool CachedResource::mustRevalidateDueToCacheHeaders(CachePolicy cachePolicy) const diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h index 16920a5..72b00e5 100644 --- a/Source/WebCore/loader/cache/CachedResource.h +++ b/Source/WebCore/loader/cache/CachedResource.h @@ -65,7 +65,7 @@ public: , XSLStyleSheet #endif #if ENABLE(LINK_PREFETCH) - , LinkPrefetch + , LinkResource #endif }; @@ -129,10 +129,10 @@ public: void setLoading(bool b) { m_loading = b; } virtual bool isImage() const { return false; } - bool isPrefetch() const + bool isLinkResource() const { #if ENABLE(LINK_PREFETCH) - return type() == LinkPrefetch; + return type() == LinkResource; #else return false; #endif diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp index 9103eff..38fcee4 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -47,6 +47,7 @@ #include "ResourceLoadScheduler.h" #include "SecurityOrigin.h" #include "Settings.h" +#include <wtf/UnusedParam.h> #include <wtf/text/CString.h> #include <wtf/text/StringConcatenate.h> @@ -70,8 +71,8 @@ static CachedResource* createResource(CachedResource::Type type, const KURL& url return new CachedXSLStyleSheet(url.string()); #endif #if ENABLE(LINK_PREFETCH) - case CachedResource::LinkPrefetch: - return new CachedResource(url.string(), CachedResource::LinkPrefetch); + case CachedResource::LinkResource: + return new CachedResource(url.string(), CachedResource::LinkResource); #endif } ASSERT_NOT_REACHED(); @@ -195,10 +196,10 @@ CachedXSLStyleSheet* CachedResourceLoader::requestXSLStyleSheet(const String& ur #endif #if ENABLE(LINK_PREFETCH) -CachedResource* CachedResourceLoader::requestLinkPrefetch(const String& url) +CachedResource* CachedResourceLoader::requestLinkResource(const String& url, ResourceLoadPriority priority) { ASSERT(frame()); - return requestResource(CachedResource::LinkPrefetch, url, String()); + return requestResource(CachedResource::LinkResource, url, String(), priority); } #endif @@ -213,7 +214,7 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url case CachedResource::Script: case CachedResource::FontResource: #if ENABLE(LINK_PREFETCH) - case CachedResource::LinkPrefetch: + case CachedResource::LinkResource: #endif // These types of resources can be loaded from any origin. // FIXME: Are we sure about CachedResource::FontResource? @@ -255,15 +256,39 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url break; } #if ENABLE(LINK_PREFETCH) - case CachedResource::LinkPrefetch: + case CachedResource::LinkResource: // Prefetch cannot affect the current document. break; #endif } // FIXME: Consider letting the embedder block mixed content loads. - if (type == CachedResource::Script && !m_document->contentSecurityPolicy()->allowScriptFromSource(url)) - return false; + switch (type) { + case CachedResource::Script: + if (!m_document->contentSecurityPolicy()->allowScriptFromSource(url)) + return false; + break; +#if ENABLE(XSLT) + case CachedResource::XSLStyleSheet: +#endif + case CachedResource::CSSStyleSheet: + if (!m_document->contentSecurityPolicy()->allowStyleFromSource(url)) + return false; + break; + case CachedResource::ImageResource: + if (!m_document->contentSecurityPolicy()->allowImageFromSource(url)) + return false; + break; + case CachedResource::FontResource: { + if (!m_document->contentSecurityPolicy()->allowFontFromSource(url)) + return false; + break; + } +#if ENABLE(LINK_PREFETCH) + case CachedResource::LinkResource: + break; +#endif + } return true; } @@ -615,7 +640,7 @@ void CachedResourceLoader::notifyLoadedFromMemoryCache(CachedResource* resource) void CachedResourceLoader::incrementRequestCount(const CachedResource* res) { - if (res->isPrefetch()) + if (res->isLinkResource()) return; ++m_requestCount; @@ -623,7 +648,7 @@ void CachedResourceLoader::incrementRequestCount(const CachedResource* res) void CachedResourceLoader::decrementRequestCount(const CachedResource* res) { - if (res->isPrefetch()) + if (res->isLinkResource()) return; --m_requestCount; @@ -639,10 +664,14 @@ int CachedResourceLoader::requestCount() void CachedResourceLoader::preload(CachedResource::Type type, const String& url, const String& charset, bool referencedFromBody) { + // FIXME: Rip this out when we are sure it is no longer necessary (even for mobile). + UNUSED_PARAM(referencedFromBody); + bool hasRendering = m_document->body() && m_document->body()->renderer(); - if (!hasRendering && (referencedFromBody || type == CachedResource::ImageResource)) { - // Don't preload images or body resources before we have something to draw. This prevents - // preloads from body delaying first display when bandwidth is limited. + bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet; + if (!hasRendering && !canBlockParser) { + // Don't preload subresources that can't block the parser before we have something to draw. + // This helps prevent preloads from delaying first display when bandwidth is limited. PendingPreload pendingPreload = { type, url, charset }; m_pendingPreloads.append(pendingPreload); return; diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h index 881ad2f..79c63b9 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.h +++ b/Source/WebCore/loader/cache/CachedResourceLoader.h @@ -69,7 +69,7 @@ public: CachedXSLStyleSheet* requestXSLStyleSheet(const String& url); #endif #if ENABLE(LINK_PREFETCH) - CachedResource* requestLinkPrefetch(const String &url); + CachedResource* requestLinkResource(const String &url, ResourceLoadPriority priority = ResourceLoadPriorityUnresolved); #endif // Logs an access denied message to the console for the specified URL. diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.cpp b/Source/WebCore/loader/cache/CachedResourceRequest.cpp index 02cf13e..9e7fe8f 100644 --- a/Source/WebCore/loader/cache/CachedResourceRequest.cpp +++ b/Source/WebCore/loader/cache/CachedResourceRequest.cpp @@ -42,8 +42,11 @@ namespace WebCore { -static ResourceRequest::TargetType cachedResourceTypeToTargetType(CachedResource::Type type) +static ResourceRequest::TargetType cachedResourceTypeToTargetType(CachedResource::Type type, ResourceLoadPriority priority) { +#if !ENABLE(LINK_PREFETCH) + UNUSED_PARAM(priority); +#endif switch (type) { case CachedResource::CSSStyleSheet: #if ENABLE(XSLT) @@ -57,8 +60,10 @@ static ResourceRequest::TargetType cachedResourceTypeToTargetType(CachedResource case CachedResource::ImageResource: return ResourceRequest::TargetIsImage; #if ENABLE(LINK_PREFETCH) - case CachedResource::LinkPrefetch: - return ResourceRequest::TargetIsPrefetch; + case CachedResource::LinkResource: + if (priority == ResourceLoadPriorityLowest) + return ResourceRequest::TargetIsPrefetch; + return ResourceRequest::TargetIsSubresource; #endif } ASSERT_NOT_REACHED(); @@ -85,7 +90,7 @@ PassRefPtr<CachedResourceRequest> CachedResourceRequest::load(CachedResourceLoad RefPtr<CachedResourceRequest> request = adoptRef(new CachedResourceRequest(cachedResourceLoader, resource, incremental)); ResourceRequest resourceRequest(resource->url()); - resourceRequest.setTargetType(cachedResourceTypeToTargetType(resource->type())); + resourceRequest.setTargetType(cachedResourceTypeToTargetType(resource->type(), resource->loadPriority())); if (!resource->accept().isEmpty()) resourceRequest.setHTTPAccept(resource->accept()); @@ -108,7 +113,7 @@ PassRefPtr<CachedResourceRequest> CachedResourceRequest::load(CachedResourceLoad } #if ENABLE(LINK_PREFETCH) - if (resource->type() == CachedResource::LinkPrefetch) + if (resource->type() == CachedResource::LinkResource) resourceRequest.setHTTPHeaderField("Purpose", "prefetch"); #endif diff --git a/Source/WebCore/loader/icon/IconDatabase.cpp b/Source/WebCore/loader/icon/IconDatabase.cpp index e5578e0..3cefea7 100644 --- a/Source/WebCore/loader/icon/IconDatabase.cpp +++ b/Source/WebCore/loader/icon/IconDatabase.cpp @@ -533,7 +533,7 @@ void IconDatabase::setIconDataForIconURL(PassRefPtr<SharedBuffer> dataOriginal, icon = getOrCreateIconRecord(iconURL); // Update the data and set the time stamp - icon->setImageData(data); + icon->setImageData(data.release()); icon->setTimestamp((int)currentTime()); // Copy the current retaining pageURLs - if any - to notify them of the change @@ -1487,7 +1487,7 @@ bool IconDatabase::readFromDatabase() if (m_iconsPendingReading.contains(icons[i])) { // Set the new data - icons[i]->setImageData(imageData.get()); + icons[i]->setImageData(imageData.release()); // Remove this icon from the set that needs to be read m_iconsPendingReading.remove(icons[i]); @@ -1576,41 +1576,44 @@ bool IconDatabase::writeToDatabase() // We can copy the current work queue then clear it out - If any new work comes in while we're writing out, // we'll pick it up on the next pass. This greatly simplifies the locking strategy for this method and remains cohesive with changes // asked for by the database on the main thread - Vector<IconSnapshot> iconSnapshots; - Vector<PageURLSnapshot> pageSnapshots; { - MutexLocker locker(m_pendingSyncLock); - - iconSnapshots.appendRange(m_iconsPendingSync.begin().values(), m_iconsPendingSync.end().values()); - m_iconsPendingSync.clear(); - - pageSnapshots.appendRange(m_pageURLsPendingSync.begin().values(), m_pageURLsPendingSync.end().values()); - m_pageURLsPendingSync.clear(); - } - - if (iconSnapshots.size() || pageSnapshots.size()) - didAnyWork = true; - - SQLiteTransaction syncTransaction(m_syncDB); - syncTransaction.begin(); - - for (unsigned i = 0; i < iconSnapshots.size(); ++i) { - writeIconSnapshotToSQLDatabase(iconSnapshots[i]); - LOG(IconDatabase, "Wrote IconRecord for IconURL %s with timeStamp of %i to the DB", urlForLogging(iconSnapshots[i].iconURL).ascii().data(), iconSnapshots[i].timestamp); - } - - for (unsigned i = 0; i < pageSnapshots.size(); ++i) { - // If the icon URL is empty, this page is meant to be deleted - // ASSERTs are sanity checks to make sure the mappings exist if they should and don't if they shouldn't - if (pageSnapshots[i].iconURL.isEmpty()) - removePageURLFromSQLDatabase(pageSnapshots[i].pageURL); - else - setIconURLForPageURLInSQLDatabase(pageSnapshots[i].iconURL, pageSnapshots[i].pageURL); - LOG(IconDatabase, "Committed IconURL for PageURL %s to database", urlForLogging(pageSnapshots[i].pageURL).ascii().data()); + MutexLocker locker(m_urlAndIconLock); + Vector<IconSnapshot> iconSnapshots; + Vector<PageURLSnapshot> pageSnapshots; + { + MutexLocker locker(m_pendingSyncLock); + + iconSnapshots.appendRange(m_iconsPendingSync.begin().values(), m_iconsPendingSync.end().values()); + m_iconsPendingSync.clear(); + + pageSnapshots.appendRange(m_pageURLsPendingSync.begin().values(), m_pageURLsPendingSync.end().values()); + m_pageURLsPendingSync.clear(); + } + + if (iconSnapshots.size() || pageSnapshots.size()) + didAnyWork = true; + + SQLiteTransaction syncTransaction(m_syncDB); + syncTransaction.begin(); + + for (unsigned i = 0; i < iconSnapshots.size(); ++i) { + writeIconSnapshotToSQLDatabase(iconSnapshots[i]); + LOG(IconDatabase, "Wrote IconRecord for IconURL %s with timeStamp of %i to the DB", urlForLogging(iconSnapshots[i].iconURL()).ascii().data(), iconSnapshots[i].timestamp()); + } + + for (unsigned i = 0; i < pageSnapshots.size(); ++i) { + // If the icon URL is empty, this page is meant to be deleted + // ASSERTs are sanity checks to make sure the mappings exist if they should and don't if they shouldn't + if (pageSnapshots[i].iconURL().isEmpty()) + removePageURLFromSQLDatabase(pageSnapshots[i].pageURL()); + else + setIconURLForPageURLInSQLDatabase(pageSnapshots[i].iconURL(), pageSnapshots[i].pageURL()); + LOG(IconDatabase, "Committed IconURL for PageURL %s to database", urlForLogging(pageSnapshots[i].pageURL()).ascii().data()); + } + + syncTransaction.commit(); } - syncTransaction.commit(); - // Check to make sure there are no dangling PageURLs - If there are, we want to output one log message but not spam the console potentially every few seconds if (didAnyWork) checkForDanglingPageURLs(false); @@ -2029,13 +2032,13 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot) { ASSERT_ICON_SYNC_THREAD(); - if (snapshot.iconURL.isEmpty()) + if (snapshot.iconURL().isEmpty()) return; // A nulled out timestamp and data means this icon is destined to be deleted - do that instead of writing it out - if (!snapshot.timestamp && !snapshot.data) { - LOG(IconDatabase, "Removing %s from on-disk database", urlForLogging(snapshot.iconURL).ascii().data()); - removeIconFromSQLDatabase(snapshot.iconURL); + if (!snapshot.timestamp() && !snapshot.data()) { + LOG(IconDatabase, "Removing %s from on-disk database", urlForLogging(snapshot.iconURL()).ascii().data()); + removeIconFromSQLDatabase(snapshot.iconURL()); return; } @@ -2043,18 +2046,18 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot) // In practice the only caller of this method is always wrapped in a transaction itself so placing another here is unnecessary // Get the iconID for this url - int64_t iconID = getIconIDForIconURLFromSQLDatabase(snapshot.iconURL); + int64_t iconID = getIconIDForIconURLFromSQLDatabase(snapshot.iconURL()); // If there is already an iconID in place, update the database. // Otherwise, insert new records if (iconID) { readySQLiteStatement(m_updateIconInfoStatement, m_syncDB, "UPDATE IconInfo SET stamp = ?, url = ? WHERE iconID = ?;"); - m_updateIconInfoStatement->bindInt64(1, snapshot.timestamp); - m_updateIconInfoStatement->bindText(2, snapshot.iconURL); + m_updateIconInfoStatement->bindInt64(1, snapshot.timestamp()); + m_updateIconInfoStatement->bindText(2, snapshot.iconURL()); m_updateIconInfoStatement->bindInt64(3, iconID); if (m_updateIconInfoStatement->step() != SQLResultDone) - LOG_ERROR("Failed to update icon info for url %s", urlForLogging(snapshot.iconURL).ascii().data()); + LOG_ERROR("Failed to update icon info for url %s", urlForLogging(snapshot.iconURL()).ascii().data()); m_updateIconInfoStatement->reset(); @@ -2063,22 +2066,22 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot) // If we *have* image data, bind it to this statement - Otherwise bind "null" for the blob data, // signifying that this icon doesn't have any data - if (snapshot.data && snapshot.data->size()) - m_updateIconDataStatement->bindBlob(1, snapshot.data->data(), snapshot.data->size()); + if (snapshot.data() && snapshot.data()->size()) + m_updateIconDataStatement->bindBlob(1, snapshot.data()->data(), snapshot.data()->size()); else m_updateIconDataStatement->bindNull(1); if (m_updateIconDataStatement->step() != SQLResultDone) - LOG_ERROR("Failed to update icon data for url %s", urlForLogging(snapshot.iconURL).ascii().data()); + LOG_ERROR("Failed to update icon data for url %s", urlForLogging(snapshot.iconURL()).ascii().data()); m_updateIconDataStatement->reset(); } else { readySQLiteStatement(m_setIconInfoStatement, m_syncDB, "INSERT INTO IconInfo (url,stamp) VALUES (?, ?);"); - m_setIconInfoStatement->bindText(1, snapshot.iconURL); - m_setIconInfoStatement->bindInt64(2, snapshot.timestamp); + m_setIconInfoStatement->bindText(1, snapshot.iconURL()); + m_setIconInfoStatement->bindInt64(2, snapshot.timestamp()); if (m_setIconInfoStatement->step() != SQLResultDone) - LOG_ERROR("Failed to set icon info for url %s", urlForLogging(snapshot.iconURL).ascii().data()); + LOG_ERROR("Failed to set icon info for url %s", urlForLogging(snapshot.iconURL()).ascii().data()); m_setIconInfoStatement->reset(); @@ -2089,13 +2092,13 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot) // If we *have* image data, bind it to this statement - Otherwise bind "null" for the blob data, // signifying that this icon doesn't have any data - if (snapshot.data && snapshot.data->size()) - m_setIconDataStatement->bindBlob(2, snapshot.data->data(), snapshot.data->size()); + if (snapshot.data() && snapshot.data()->size()) + m_setIconDataStatement->bindBlob(2, snapshot.data()->data(), snapshot.data()->size()); else m_setIconDataStatement->bindNull(2); if (m_setIconDataStatement->step() != SQLResultDone) - LOG_ERROR("Failed to set icon data for url %s", urlForLogging(snapshot.iconURL).ascii().data()); + LOG_ERROR("Failed to set icon data for url %s", urlForLogging(snapshot.iconURL()).ascii().data()); m_setIconDataStatement->reset(); } diff --git a/Source/WebCore/loader/icon/IconRecord.h b/Source/WebCore/loader/icon/IconRecord.h index f1fe12f..50ef7f7 100644 --- a/Source/WebCore/loader/icon/IconRecord.h +++ b/Source/WebCore/loader/icon/IconRecord.h @@ -38,6 +38,10 @@ #include <wtf/OwnPtr.h> #include <wtf/text/StringHash.h> +#if OS(SOLARIS) +#include <sys/types.h> // For time_t structure. +#endif + namespace WebCore { class IconDataSnapshot; @@ -51,17 +55,22 @@ enum ImageDataStatus { class IconSnapshot { public: - IconSnapshot() : timestamp(0) { } + IconSnapshot() : m_timestamp(0) { } - IconSnapshot(const String& url, int stamp, SharedBuffer* theData) - : iconURL(url) - , timestamp(stamp) - , data(theData) + IconSnapshot(const String& iconURL, int timestamp, SharedBuffer* data) + : m_iconURL(iconURL) + , m_timestamp(timestamp) + , m_data(data) { } - - String iconURL; - int timestamp; - RefPtr<SharedBuffer> data; + + const String& iconURL() const { return m_iconURL; } + int timestamp() const { return m_timestamp; } + SharedBuffer* data() const { return m_data.get(); } + +private: + String m_iconURL; + int m_timestamp; + RefPtr<SharedBuffer> m_data; }; class IconRecord : public RefCounted<IconRecord> { diff --git a/Source/WebCore/loader/icon/PageURLRecord.h b/Source/WebCore/loader/icon/PageURLRecord.h index 7935dc9..b9e0a41 100644 --- a/Source/WebCore/loader/icon/PageURLRecord.h +++ b/Source/WebCore/loader/icon/PageURLRecord.h @@ -42,13 +42,17 @@ class PageURLSnapshot { public: PageURLSnapshot() { } - PageURLSnapshot(const String& page, const String& icon) - : pageURL(page) - , iconURL(icon) + PageURLSnapshot(const String& pageURL, const String& iconURL) + : m_pageURL(pageURL) + , m_iconURL(iconURL) { } - - String pageURL; - String iconURL; + + const String& pageURL() const { return m_pageURL; } + const String& iconURL() const { return m_iconURL; } + +private: + String m_pageURL; + String m_iconURL; }; class PageURLRecord { |