<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160841] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160841">160841</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-19 10:10:07 -0800 (Thu, 19 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Upstream WebCore/loader changes
https://bugs.webkit.org/show_bug.cgi?id=125879

Reviewed by Darin Adler.

* WebCore.exp.in: Added symbols for MemoryCache::{addImageToCache, removeImageFromCache}().
* loader/DocumentLoader.cpp:
(WebCore::areAllLoadersPageCacheAcceptable): Added.
(WebCore::DocumentLoader::DocumentLoader): Initialize m_subresourceLoadersArePageCacheAcceptable.
(WebCore::DocumentLoader::stopLoading): Modified to conditionally call areAllLoadersPageCacheAcceptable().
(WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Modified to query FrameLoader::loadsSynchronously()
whether to load substitute data immediately or to schedule a load.
(WebCore::DocumentLoader::responseReceived): Modified to create a content filer when the response protocol
is either HTTP or HTTPS, assuming content filtering is enabled.
(WebCore::DocumentLoader::dataReceived): Modified to call DocumentLoader::setContentFilterForBlockedLoad()
as appropriate.
(WebCore::DocumentLoader::clearMainResourceLoader): Added PLATFORM(IOS)-guarded code. Also added a
FIXME comment to remove the PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
(WebCore::DocumentLoader::setResponseMIMEType): Added; guard by PLATFORM(IOS). Also added FIXME comment.
(WebCore::DocumentLoader::startLoadingMainResource): Added PLATFORM(IOS)-guarded code. Also added a
FIXME comment to remove the PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
I also substituted static NeverDestroyed&lt;&gt; for DEFINE_STATIC_LOCAL.
(WebCore::DocumentLoader::setContentFilterForBlockedLoad): Added; guarded by USE(CONTENT_FILTERING).
(WebCore::DocumentLoader::handleContentFilterRequest): Added; guarded by USE(CONTENT_FILTERING) and PLATFORM(IOS).
Also added a FIXME comment to remove the PLATFORM(IOS) guard inside its function body once we upstream
file ContentFilterIOS.mm and implement ContentFilter::requestUnblockAndDispatchIfSuccessful() for Mac.
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setResponse): Added; guard by PLATFORM(IOS). Also added a FIXME comment as
this method seems to violate the encapsulation of DocumentLoader.
(WebCore::DocumentLoader::subresourceLoadersArePageCacheAcceptable): Added.
(WebCore::DocumentLoader::documentURL): Added; returns the URL of the document resulting from the DocumentLoader.
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::createDocument): Added iOS-specific code to create a PDF document.
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::openDateTimeChooser): Opt out of compiling this code for iOS. Also substituted
nullptr for 0.
* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameProgressTracker::~FrameProgressTracker):
(WebCore::FrameLoader::FrameLoader): Initialize m_loadsSynchronously.
(WebCore::FrameLoader::initForSynthesizedDocument): Added; guarded by PLATFORM(IOS). Also added FIXME comment.
(WebCore::FrameLoader::checkCompleted): Added iOS-specific code with FIXME comment.
(WebCore::FrameLoader::willLoadMediaElementURL): Added iOS-specific code.
(WebCore::FrameLoader::stopForUserCancel): Added iOS-specific code and FIXME comment.
(WebCore::FrameLoader::commitProvisionalLoad): Added iOS-specific code and FIXME comment.
(WebCore::FrameLoader::transitionToCommitted): Opt out of ENABLE(TOUCH_EVENTS) logic when building for iOS.
(WebCore::FrameLoader::didFirstLayout): Added iOS-specific code.
(WebCore::FrameLoader::connectionProperties): Added; guarded by PLATFORM(IOS).
(WebCore::createWindow): Added iOS-specific code and FIXME comment.
* loader/FrameLoader.h:
(WebCore::FrameLoader::setLoadsSynchronously): Added.
(WebCore::FrameLoader::loadsSynchronously): Added.
* loader/FrameLoaderClient.h:
* loader/HistoryController.cpp:
(WebCore::HistoryController::restoreScrollPositionAndViewState): Opt out of scroll position logic when building for iOS.
(WebCore::HistoryController::replaceCurrentItem): Added.
* loader/HistoryController.h:
* loader/PlaceholderDocument.h: Changed access control of constructor from private to protected and removed the FINAL
keyword from the class so that we can subclass PlaceholderDocument on iOS.
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy): Added USE(QUICK_LOOK)- and USE(CONTENT_FILTERING)-guarded code.
* loader/ResourceBuffer.cpp:
(WebCore::ResourceBuffer::shouldUsePurgeableMemory): Added; guarded by PLATFORM(IOS).
* loader/ResourceBuffer.h:
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest): Added USE(QUICK_LOOK)-guarded code.
* loader/ResourceLoadScheduler.cpp:
(WebCore::ResourceLoadScheduler::scheduleSubresourceLoad): Added iOS-specific code.
(WebCore::ResourceLoadScheduler::scheduleLoad): Ditto.
(WebCore::ResourceLoadScheduler::remove): Added iOS-specific code with FIXME comment.
(WebCore::ResourceLoadScheduler::crossOriginRedirectReceived): Added null-check for variable oldHost. Also added
iOS-specific code.
(WebCore::ResourceLoadScheduler::servePendingRequests): Added iOS-specific code.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init): Ditto.
(WebCore::ResourceLoader::willSendRequest): Ditto.
(WebCore::ResourceLoader::connectionProperties): Added; guarded by PLATFORM(IOS).
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::startLoading): Added; guarded by PLATFORM(IOS).
(WebCore::ResourceLoader::iOSOriginalRequest): Added; iOS-specific.
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::loadPlugin): Added iOS-specific code.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::create): Ditto.
(WebCore::SubresourceLoader::startLoading): Added; guarded by PLATFORM(IOS).
(WebCore::SubresourceLoader::didFinishLoading): Added iOS-specific code.
(WebCore::SubresourceLoader::willCancel): Ditto.
(WebCore::SubresourceLoader::notifyDone): Ditto.
(WebCore::SubresourceLoader::releaseResources): Ditto.
* loader/SubresourceLoader.h:
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::loadCacheGroup): Added iOS-specific code.
(WebCore::ApplicationCacheStorage::loadManifestHostHashes): Ditto.
(WebCore::ApplicationCacheStorage::cacheGroupForURL): Ditto.
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL): Ditto.
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Ditto.
(WebCore::ApplicationCacheStorage::calculateUsageForOrigin): Ditto.
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): Ditto.
(WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): Ditto.
(WebCore::ApplicationCacheStorage::executeSQLCommand): Ditto.
(WebCore::ApplicationCacheStorage::verifySchemaVersion): Ditto.
(WebCore::ApplicationCacheStorage::openDatabase): Ditto.
(WebCore::ApplicationCacheStorage::executeStatement): Ditto.
(WebCore::ApplicationCacheStorage::store): Ditto.
(WebCore::ApplicationCacheStorage::storeUpdatedType): Ditto.
(WebCore::ApplicationCacheStorage::ensureOriginRecord): Ditto.
(WebCore::ApplicationCacheStorage::loadCache): Ditto.
(WebCore::ApplicationCacheStorage::remove): Ditto.
(WebCore::ApplicationCacheStorage::empty): Ditto.
(WebCore::ApplicationCacheStorage::storeCopyOfCache): Ditto.
(WebCore::ApplicationCacheStorage::manifestURLs): Ditto.
(WebCore::ApplicationCacheStorage::cacheGroupSize): Ditto.
(WebCore::ApplicationCacheStorage::deleteCacheGroup): Ditto.
(WebCore::ApplicationCacheStorage::vacuumDatabaseFile): Ditto.
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::CachedImage): Added.
(WebCore::CachedImage::imageSizeForRenderer): Added iOS-specific code.
(WebCore::CachedImageManual::CachedImageManual): Added; guarded by USE(CF). Also added FIXME comment to incorporate
the functionality of this class into CachedImage and to remove the USE(CF)-guard once we make MemoryCache::addImageToCache()
platform-independent.
(WebCore::CachedImageManual::mustRevalidateDueToCacheHeaders): Added; guarded by USE(CF).
* loader/cache/CachedImage.h: Removed FINAL keyword from class so that we can define derived class CachedImageManual.
(WebCore::CachedImage::isManual): Added; guarded by USE(CF). Also added FIXME comment.
(WebCore::CachedImageManual::addFakeClient): Added; guarded by USE(CF).
(WebCore::CachedImageManual::removeFakeClient): Added; guarded by USE(CF).
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load): Added iOS-specific code.
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::loadDone): Added argument shouldPerformPostLoadActions, defaults to true. Modified
to conditionally call performPostLoadActions() with respect to the argument shouldPerformPostLoadActions.
(WebCore::CachedResourceLoader::preload): Added iOS-specific code.
(WebCore::CachedResourceLoader::checkForPendingPreloads): Ditto.
* loader/cache/CachedResourceLoader.h:
* loader/cache/MemoryCache.cpp:
(WebCore::memoryCache):
(WebCore::MemoryCache::add): Added iOS-specific code.
(WebCore::MemoryCache::revalidationFailed): Ditto.
(WebCore::MemoryCache::resourceForRequest): Ditto.
(WebCore::MemoryCache::addImageToCache): Added; guarded by USE(CF). Also added FIXME comment.
(WebCore::MemoryCache::removeImageFromCache): Added; guarded by USE(CF). Also added FIXME comment.
(WebCore::MemoryCache::pruneLiveResources): Modified to take argument shouldDestroyDecodedDataForAllLiveResources.
(WebCore::MemoryCache::pruneLiveResourcesToSize): Modified to take argument shouldDestroyDecodedDataForAllLiveResources,
defaults to false. When this argument is true we destroy the decoded data for all live resources from the memory cache.
Such functionality is useful when the system is running low on memory.
(WebCore::MemoryCache::evict): Added iOS-specific code.
* loader/cache/MemoryCache.h:
* loader/cf/SubresourceLoaderCF.cpp:
(WebCore::SubresourceLoader::didReceiveDataArray): Actually make this code compile. In particular, there is no
method called sendDataToResource on SubresourceLoader or in its class hierarchy.
* loader/mac/DocumentLoaderMac.cpp:
(WebCore::DocumentLoader::schedule): This method has an empty implementation when building for iOS.
(WebCore::DocumentLoader::unschedule): Ditto.
* platform/graphics/BitmapImage.h: Exposed decodedSize() to access the decoded size of the bitmap image.
This functionality is used in MemoryCache::addImageToCache().</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoaderh">trunk/Source/WebCore/loader/DocumentLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentWritercpp">trunk/Source/WebCore/loader/DocumentWriter.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientscpp">trunk/Source/WebCore/loader/EmptyClients.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderh">trunk/Source/WebCore/loader/FrameLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderClienth">trunk/Source/WebCore/loader/FrameLoaderClient.h</a></li>
<li><a href="#trunkSourceWebCoreloaderHistoryControllercpp">trunk/Source/WebCore/loader/HistoryController.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderHistoryControllerh">trunk/Source/WebCore/loader/HistoryController.h</a></li>
<li><a href="#trunkSourceWebCoreloaderPlaceholderDocumenth">trunk/Source/WebCore/loader/PlaceholderDocument.h</a></li>
<li><a href="#trunkSourceWebCoreloaderPolicyCheckercpp">trunk/Source/WebCore/loader/PolicyChecker.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceBuffercpp">trunk/Source/WebCore/loader/ResourceBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceBufferh">trunk/Source/WebCore/loader/ResourceBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadNotifiercpp">trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadSchedulercpp">trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoaderh">trunk/Source/WebCore/loader/ResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubframeLoadercpp">trunk/Source/WebCore/loader/SubframeLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoaderh">trunk/Source/WebCore/loader/SubresourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheStoragecpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedImagecpp">trunk/Source/WebCore/loader/cache/CachedImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedImageh">trunk/Source/WebCore/loader/cache/CachedImage.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceh">trunk/Source/WebCore/loader/cache/CachedResource.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoaderh">trunk/Source/WebCore/loader/cache/CachedResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheMemoryCachecpp">trunk/Source/WebCore/loader/cache/MemoryCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheMemoryCacheh">trunk/Source/WebCore/loader/cache/MemoryCache.h</a></li>
<li><a href="#trunkSourceWebCoreloadercfSubresourceLoaderCFcpp">trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadermacDocumentLoaderMaccpp">trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsBitmapImageh">trunk/Source/WebCore/platform/graphics/BitmapImage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/ChangeLog        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -1,3 +1,161 @@
</span><ins>+2013-12-19  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        [iOS] Upstream WebCore/loader changes
+        https://bugs.webkit.org/show_bug.cgi?id=125879
+
+        Reviewed by Darin Adler.
+
+        * WebCore.exp.in: Added symbols for MemoryCache::{addImageToCache, removeImageFromCache}().
+        * loader/DocumentLoader.cpp:
+        (WebCore::areAllLoadersPageCacheAcceptable): Added.
+        (WebCore::DocumentLoader::DocumentLoader): Initialize m_subresourceLoadersArePageCacheAcceptable.
+        (WebCore::DocumentLoader::stopLoading): Modified to conditionally call areAllLoadersPageCacheAcceptable().
+        (WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Modified to query FrameLoader::loadsSynchronously()
+        whether to load substitute data immediately or to schedule a load.
+        (WebCore::DocumentLoader::responseReceived): Modified to create a content filer when the response protocol
+        is either HTTP or HTTPS, assuming content filtering is enabled.
+        (WebCore::DocumentLoader::dataReceived): Modified to call DocumentLoader::setContentFilterForBlockedLoad()
+        as appropriate.
+        (WebCore::DocumentLoader::clearMainResourceLoader): Added PLATFORM(IOS)-guarded code. Also added a
+        FIXME comment to remove the PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
+        (WebCore::DocumentLoader::setResponseMIMEType): Added; guard by PLATFORM(IOS). Also added FIXME comment.
+        (WebCore::DocumentLoader::startLoadingMainResource): Added PLATFORM(IOS)-guarded code. Also added a
+        FIXME comment to remove the PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
+        I also substituted static NeverDestroyed&lt;&gt; for DEFINE_STATIC_LOCAL.
+        (WebCore::DocumentLoader::setContentFilterForBlockedLoad): Added; guarded by USE(CONTENT_FILTERING).
+        (WebCore::DocumentLoader::handleContentFilterRequest): Added; guarded by USE(CONTENT_FILTERING) and PLATFORM(IOS).
+        Also added a FIXME comment to remove the PLATFORM(IOS) guard inside its function body once we upstream
+        file ContentFilterIOS.mm and implement ContentFilter::requestUnblockAndDispatchIfSuccessful() for Mac.
+        * loader/DocumentLoader.h:
+        (WebCore::DocumentLoader::setResponse): Added; guard by PLATFORM(IOS). Also added a FIXME comment as
+        this method seems to violate the encapsulation of DocumentLoader.
+        (WebCore::DocumentLoader::subresourceLoadersArePageCacheAcceptable): Added.
+        (WebCore::DocumentLoader::documentURL): Added; returns the URL of the document resulting from the DocumentLoader.
+        * loader/DocumentWriter.cpp:
+        (WebCore::DocumentWriter::createDocument): Added iOS-specific code to create a PDF document.
+        * loader/EmptyClients.cpp:
+        (WebCore::EmptyChromeClient::openDateTimeChooser): Opt out of compiling this code for iOS. Also substituted
+        nullptr for 0.
+        * loader/EmptyClients.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::FrameProgressTracker::~FrameProgressTracker):
+        (WebCore::FrameLoader::FrameLoader): Initialize m_loadsSynchronously.
+        (WebCore::FrameLoader::initForSynthesizedDocument): Added; guarded by PLATFORM(IOS). Also added FIXME comment.
+        (WebCore::FrameLoader::checkCompleted): Added iOS-specific code with FIXME comment.
+        (WebCore::FrameLoader::willLoadMediaElementURL): Added iOS-specific code.
+        (WebCore::FrameLoader::stopForUserCancel): Added iOS-specific code and FIXME comment.
+        (WebCore::FrameLoader::commitProvisionalLoad): Added iOS-specific code and FIXME comment.
+        (WebCore::FrameLoader::transitionToCommitted): Opt out of ENABLE(TOUCH_EVENTS) logic when building for iOS.
+        (WebCore::FrameLoader::didFirstLayout): Added iOS-specific code.
+        (WebCore::FrameLoader::connectionProperties): Added; guarded by PLATFORM(IOS).
+        (WebCore::createWindow): Added iOS-specific code and FIXME comment.
+        * loader/FrameLoader.h:
+        (WebCore::FrameLoader::setLoadsSynchronously): Added.
+        (WebCore::FrameLoader::loadsSynchronously): Added.
+        * loader/FrameLoaderClient.h:
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::restoreScrollPositionAndViewState): Opt out of scroll position logic when building for iOS.
+        (WebCore::HistoryController::replaceCurrentItem): Added.
+        * loader/HistoryController.h:
+        * loader/PlaceholderDocument.h: Changed access control of constructor from private to protected and removed the FINAL
+        keyword from the class so that we can subclass PlaceholderDocument on iOS.
+        * loader/PolicyChecker.cpp:
+        (WebCore::PolicyChecker::checkNavigationPolicy): Added USE(QUICK_LOOK)- and USE(CONTENT_FILTERING)-guarded code.
+        * loader/ResourceBuffer.cpp:
+        (WebCore::ResourceBuffer::shouldUsePurgeableMemory): Added; guarded by PLATFORM(IOS).
+        * loader/ResourceBuffer.h:
+        * loader/ResourceLoadNotifier.cpp:
+        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest): Added USE(QUICK_LOOK)-guarded code.
+        * loader/ResourceLoadScheduler.cpp:
+        (WebCore::ResourceLoadScheduler::scheduleSubresourceLoad): Added iOS-specific code.
+        (WebCore::ResourceLoadScheduler::scheduleLoad): Ditto.
+        (WebCore::ResourceLoadScheduler::remove): Added iOS-specific code with FIXME comment.
+        (WebCore::ResourceLoadScheduler::crossOriginRedirectReceived): Added null-check for variable oldHost. Also added
+        iOS-specific code.
+        (WebCore::ResourceLoadScheduler::servePendingRequests): Added iOS-specific code.
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::init): Ditto.
+        (WebCore::ResourceLoader::willSendRequest): Ditto.
+        (WebCore::ResourceLoader::connectionProperties): Added; guarded by PLATFORM(IOS).
+        * loader/ResourceLoader.h:
+        (WebCore::ResourceLoader::startLoading): Added; guarded by PLATFORM(IOS).
+        (WebCore::ResourceLoader::iOSOriginalRequest): Added; iOS-specific.
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::loadPlugin): Added iOS-specific code.
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::create): Ditto.
+        (WebCore::SubresourceLoader::startLoading): Added; guarded by PLATFORM(IOS).
+        (WebCore::SubresourceLoader::didFinishLoading): Added iOS-specific code.
+        (WebCore::SubresourceLoader::willCancel): Ditto.
+        (WebCore::SubresourceLoader::notifyDone): Ditto.
+        (WebCore::SubresourceLoader::releaseResources): Ditto.
+        * loader/SubresourceLoader.h:
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::loadCacheGroup): Added iOS-specific code.
+        (WebCore::ApplicationCacheStorage::loadManifestHostHashes): Ditto.
+        (WebCore::ApplicationCacheStorage::cacheGroupForURL): Ditto.
+        (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL): Ditto.
+        (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Ditto.
+        (WebCore::ApplicationCacheStorage::calculateUsageForOrigin): Ditto.
+        (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): Ditto.
+        (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): Ditto.
+        (WebCore::ApplicationCacheStorage::executeSQLCommand): Ditto.
+        (WebCore::ApplicationCacheStorage::verifySchemaVersion): Ditto.
+        (WebCore::ApplicationCacheStorage::openDatabase): Ditto.
+        (WebCore::ApplicationCacheStorage::executeStatement): Ditto.
+        (WebCore::ApplicationCacheStorage::store): Ditto.
+        (WebCore::ApplicationCacheStorage::storeUpdatedType): Ditto.
+        (WebCore::ApplicationCacheStorage::ensureOriginRecord): Ditto.
+        (WebCore::ApplicationCacheStorage::loadCache): Ditto.
+        (WebCore::ApplicationCacheStorage::remove): Ditto.
+        (WebCore::ApplicationCacheStorage::empty): Ditto.
+        (WebCore::ApplicationCacheStorage::storeCopyOfCache): Ditto.
+        (WebCore::ApplicationCacheStorage::manifestURLs): Ditto.
+        (WebCore::ApplicationCacheStorage::cacheGroupSize): Ditto.
+        (WebCore::ApplicationCacheStorage::deleteCacheGroup): Ditto.
+        (WebCore::ApplicationCacheStorage::vacuumDatabaseFile): Ditto.
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::CachedImage): Added.
+        (WebCore::CachedImage::imageSizeForRenderer): Added iOS-specific code.
+        (WebCore::CachedImageManual::CachedImageManual): Added; guarded by USE(CF). Also added FIXME comment to incorporate
+        the functionality of this class into CachedImage and to remove the USE(CF)-guard once we make MemoryCache::addImageToCache()
+        platform-independent.
+        (WebCore::CachedImageManual::mustRevalidateDueToCacheHeaders): Added; guarded by USE(CF).
+        * loader/cache/CachedImage.h: Removed FINAL keyword from class so that we can define derived class CachedImageManual.
+        (WebCore::CachedImage::isManual): Added; guarded by USE(CF). Also added FIXME comment.
+        (WebCore::CachedImageManual::addFakeClient): Added; guarded by USE(CF).
+        (WebCore::CachedImageManual::removeFakeClient): Added; guarded by USE(CF).
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::load): Added iOS-specific code.
+        * loader/cache/CachedResource.h:
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::loadDone): Added argument shouldPerformPostLoadActions, defaults to true. Modified
+        to conditionally call performPostLoadActions() with respect to the argument shouldPerformPostLoadActions.
+        (WebCore::CachedResourceLoader::preload): Added iOS-specific code.
+        (WebCore::CachedResourceLoader::checkForPendingPreloads): Ditto.
+        * loader/cache/CachedResourceLoader.h:
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::memoryCache):
+        (WebCore::MemoryCache::add): Added iOS-specific code.
+        (WebCore::MemoryCache::revalidationFailed): Ditto.
+        (WebCore::MemoryCache::resourceForRequest): Ditto.
+        (WebCore::MemoryCache::addImageToCache): Added; guarded by USE(CF). Also added FIXME comment.
+        (WebCore::MemoryCache::removeImageFromCache): Added; guarded by USE(CF). Also added FIXME comment.
+        (WebCore::MemoryCache::pruneLiveResources): Modified to take argument shouldDestroyDecodedDataForAllLiveResources.
+        (WebCore::MemoryCache::pruneLiveResourcesToSize): Modified to take argument shouldDestroyDecodedDataForAllLiveResources,
+        defaults to false. When this argument is true we destroy the decoded data for all live resources from the memory cache.
+        Such functionality is useful when the system is running low on memory.
+        (WebCore::MemoryCache::evict): Added iOS-specific code.
+        * loader/cache/MemoryCache.h:
+        * loader/cf/SubresourceLoaderCF.cpp:
+        (WebCore::SubresourceLoader::didReceiveDataArray): Actually make this code compile. In particular, there is no
+        method called sendDataToResource on SubresourceLoader or in its class hierarchy.
+        * loader/mac/DocumentLoaderMac.cpp:
+        (WebCore::DocumentLoader::schedule): This method has an empty implementation when building for iOS.
+        (WebCore::DocumentLoader::unschedule): Ditto.
+        * platform/graphics/BitmapImage.h: Exposed decodedSize() to access the decoded size of the bitmap image.
+        This functionality is used in MemoryCache::addImageToCache().
+
</ins><span class="cx"> 2013-12-19  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Build fix for platforms which do not define -[AVSampleBufferAudioRenderer muted].
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/WebCore.exp.in        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -174,8 +174,10 @@
</span><span class="cx"> __ZN7WebCore11MemoryCache13setCapacitiesEjjj
</span><span class="cx"> __ZN7WebCore11MemoryCache14evictResourcesEv
</span><span class="cx"> __ZN7WebCore11MemoryCache14resourceForURLERKNS_3URLE
</span><ins>+__ZN7WebCore11MemoryCache15addImageToCacheEP7CGImageRKNS_3URLERKN3WTF6StringE
</ins><span class="cx"> __ZN7WebCore11MemoryCache18resourceForRequestERKNS_15ResourceRequestE
</span><span class="cx"> __ZN7WebCore11MemoryCache19getOriginsWithCacheERN3WTF7HashSetINS1_6RefPtrINS_14SecurityOriginEEENS_18SecurityOriginHashENS1_10HashTraitsIS5_EEEE
</span><ins>+__ZN7WebCore11MemoryCache20removeImageFromCacheERKNS_3URLERKN3WTF6StringE
</ins><span class="cx"> __ZN7WebCore11MemoryCache25removeResourcesWithOriginEPNS_14SecurityOriginE
</span><span class="cx"> __ZN7WebCore11PageConsole21shouldPrintExceptionsEv
</span><span class="cx"> __ZN7WebCore11PageConsole24setShouldPrintExceptionsEb
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -56,12 +56,14 @@
</span><span class="cx"> #include &quot;PolicyChecker.h&quot;
</span><span class="cx"> #include &quot;ProgressTracker.h&quot;
</span><span class="cx"> #include &quot;ResourceBuffer.h&quot;
</span><ins>+#include &quot;ResourceHandle.h&quot;
</ins><span class="cx"> #include &quot;SchemeRegistry.h&quot;
</span><span class="cx"> #include &quot;SecurityPolicy.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;SubresourceLoader.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><ins>+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -95,6 +97,26 @@
</span><span class="cx">         loadersCopy[i]-&gt;setDefersLoading(defers);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool areAllLoadersPageCacheAcceptable(const ResourceLoaderSet&amp; loaders)
+{
+    Vector&lt;RefPtr&lt;ResourceLoader&gt;&gt; loadersCopy;
+    copyToVector(loaders, loadersCopy);
+    for (auto&amp; loader : loadersCopy) {
+        ResourceHandle* handle = loader-&gt;handle();
+        if (!handle)
+            return false;
+
+        CachedResource* cachedResource = memoryCache()-&gt;resourceForURL(handle-&gt;firstRequest().url());
+        if (!cachedResource)
+            return false;
+
+        // All non-image loads will prevent the page from entering the PageCache.
+        if (!cachedResource-&gt;isImage())
+            return false;
+    }
+    return true;
+}
+
</ins><span class="cx"> DocumentLoader::DocumentLoader(const ResourceRequest&amp; req, const SubstituteData&amp; substituteData)
</span><span class="cx">     : m_deferMainResourceDataLoad(true)
</span><span class="cx">     , m_frame(0)
</span><span class="lines">@@ -119,6 +141,7 @@
</span><span class="cx">     , m_identifierForLoadWithoutResourceLoader(0)
</span><span class="cx">     , m_dataLoadTimer(this, &amp;DocumentLoader::handleSubstituteDataLoadNow)
</span><span class="cx">     , m_waitingForContentPolicy(false)
</span><ins>+    , m_subresourceLoadersArePageCacheAcceptable(false)
</ins><span class="cx">     , m_applicationCacheHost(adoptPtr(new ApplicationCacheHost(this)))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -256,7 +279,14 @@
</span><span class="cx">     // (This can happen when there's a single XMLHttpRequest currently loading and stopLoading causes it
</span><span class="cx">     // to stop loading. Because of this, we need to save it so we don't return early.
</span><span class="cx">     bool loading = isLoading();
</span><del>-    
</del><ins>+
+    // We may want to audit the existing subresource loaders when we are on a page which has completed
+    // loading but there are subresource loads during cancellation. This must be done before the
+    // frame-&gt;stopLoading() call, which may evict the CachedResources, which we rely on to check
+    // the type of the resource loads.
+    if (loading &amp;&amp; m_committed &amp;&amp; !mainResourceLoader() &amp;&amp; !m_subresourceLoaders.isEmpty())
+        m_subresourceLoadersArePageCacheAcceptable = areAllLoadersPageCacheAcceptable(m_subresourceLoaders);
+
</ins><span class="cx">     if (m_committed) {
</span><span class="cx">         // Attempt to stop the frame if the document loader is loading, or if it is done loading but
</span><span class="cx">         // still  parsing. Failure to do so can cause a world leak.
</span><span class="lines">@@ -381,6 +411,9 @@
</span><span class="cx">         const char* data = m_contentFilter-&gt;getReplacementData(length);
</span><span class="cx">         if (data)
</span><span class="cx">             dataReceived(m_mainResource.get(), data, length);
</span><ins>+
+        if (m_contentFilter-&gt;didBlockData())
+            setContentFilterForBlockedLoad(m_contentFilter);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -455,10 +488,10 @@
</span><span class="cx"> 
</span><span class="cx"> void DocumentLoader::handleSubstituteDataLoadSoon()
</span><span class="cx"> {
</span><del>-    if (m_deferMainResourceDataLoad)
</del><ins>+    if (!m_deferMainResourceDataLoad || frameLoader()-&gt;loadsSynchronously())
+        handleSubstituteDataLoadNow(0);
+    else
</ins><span class="cx">         startDataLoadTimer();
</span><del>-    else
-        handleSubstituteDataLoadNow(0);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DocumentLoader::redirectReceived(CachedResource* resource, ResourceRequest&amp; request, const ResourceResponse&amp; redirectResponse)
</span><span class="lines">@@ -633,7 +666,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(CONTENT_FILTERING)
</span><del>-    if (response.url().protocolIs(&quot;https&quot;) &amp;&amp; ContentFilter::isEnabled())
</del><ins>+    if (response.url().protocolIsInHTTPFamily() &amp;&amp; ContentFilter::isEnabled())
</ins><span class="cx">         m_contentFilter = ContentFilter::create(response);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -844,6 +877,9 @@
</span><span class="cx"> 
</span><span class="cx">         data = m_contentFilter-&gt;getReplacementData(length);
</span><span class="cx">         loadWasBlockedBeforeFinishing = m_contentFilter-&gt;didBlockData();
</span><ins>+
+        if (loadWasBlockedBeforeFinishing)
+            setContentFilterForBlockedLoad(m_contentFilter);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -927,6 +963,12 @@
</span><span class="cx"> void DocumentLoader::clearMainResourceLoader()
</span><span class="cx"> {
</span><span class="cx">     m_loadingMainResource = false;
</span><ins>+
+#if PLATFORM(IOS)
+    // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
+    m_request.setMainResourceRequest(false);
+#endif
+
</ins><span class="cx">     if (this == frameLoader()-&gt;activeDocumentLoader())
</span><span class="cx">         checkLoadComplete();
</span><span class="cx"> }
</span><span class="lines">@@ -1256,6 +1298,14 @@
</span><span class="cx">     return m_response.mimeType();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+// FIXME: This method seems to violate the encapsulation of this class.
+void DocumentLoader::setResponseMIMEType(const String&amp; responseMimeType)
+{
+    m_response.setMimeType(responseMimeType);
+}
+#endif
+
</ins><span class="cx"> const URL&amp; DocumentLoader::unreachableURL() const
</span><span class="cx"> {
</span><span class="cx">     return m_substituteData.failingURL();
</span><span class="lines">@@ -1380,9 +1430,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
+    m_request.setMainResourceRequest(true);
+#endif
+
</ins><span class="cx">     ResourceRequest request(m_request);
</span><del>-    DEFINE_STATIC_LOCAL(ResourceLoaderOptions, mainResourceLoadOptions,
-        (SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType));
</del><ins>+    static NeverDestroyed&lt;ResourceLoaderOptions&gt; mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType);
</ins><span class="cx">     CachedResourceRequest cachedResourceRequest(request, mainResourceLoadOptions);
</span><span class="cx">     m_mainResource = m_cachedResourceLoader-&gt;requestMainResource(cachedResourceRequest);
</span><span class="cx">     if (!m_mainResource) {
</span><span class="lines">@@ -1506,4 +1560,38 @@
</span><span class="cx">     applicationCacheHost()-&gt;stopDeferringEvents();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CONTENT_FILTERING)
+void DocumentLoader::setContentFilterForBlockedLoad(PassRefPtr&lt;ContentFilter&gt; contentFilter)
+{
+    ASSERT(!m_contentFilterForBlockedLoad);
+    ASSERT(contentFilter);
+    ASSERT(contentFilter-&gt;didBlockData());
+    m_contentFilterForBlockedLoad = contentFilter;
+}
+
+bool DocumentLoader::handleContentFilterRequest(const ResourceRequest&amp; request)
+{
+    // FIXME: Remove PLATFORM(IOS)-guard once we upstream ContentFilterIOS.mm and
+    // implement ContentFilter::requestUnblockAndDispatchIfSuccessful() for Mac.
+#if PLATFORM(IOS)
+    if (!m_contentFilterForBlockedLoad)
+        return false;
+
+    if (!request.url().protocolIs(ContentFilter::scheme()))
+        return false;
+
+    if (equalIgnoringCase(request.url().host(), &quot;unblock&quot;)) {
+        // Tell the FrameLoader to reload if the unblock is successful.
+        m_contentFilterForBlockedLoad-&gt;requestUnblockAndDispatchIfSuccessful(bind(&amp;FrameLoader::reload, &amp;(m_frame-&gt;loader()), false));
+        return true;
+    }
+
+    return false;
+#else
+    UNUSED_PARAM(request);
+    return false;
+#endif
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/DocumentLoader.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -116,6 +116,10 @@
</span><span class="cx">         const URL&amp; requestURL() const;
</span><span class="cx">         const URL&amp; responseURL() const;
</span><span class="cx">         const String&amp; responseMIMEType() const;
</span><ins>+#if PLATFORM(IOS)
+        // FIXME: This method seems to violate the encapsulation of this class.
+        void setResponseMIMEType(const String&amp;);
+#endif
</ins><span class="cx"> 
</span><span class="cx">         void replaceRequestURLForSameDocumentNavigation(const URL&amp;);
</span><span class="cx">         bool isStopping() const { return m_isStopping; }
</span><span class="lines">@@ -123,8 +127,15 @@
</span><span class="cx">         void setCommitted(bool committed) { m_committed = committed; }
</span><span class="cx">         bool isCommitted() const { return m_committed; }
</span><span class="cx">         bool isLoading() const;
</span><ins>+
+        const ResourceError&amp; mainDocumentError() const { return m_mainDocumentError; }
+
</ins><span class="cx">         const ResourceResponse&amp; response() const { return m_response; }
</span><del>-        const ResourceError&amp; mainDocumentError() const { return m_mainDocumentError; }
</del><ins>+#if PLATFORM(IOS)
+        // FIXME: This method seems to violate the encapsulation of this class.
+        void setResponse(const ResourceResponse&amp; response) { m_response = response; }
+#endif
+
</ins><span class="cx">         bool isClientRedirect() const { return m_isClientRedirect; }
</span><span class="cx">         void setIsClientRedirect(bool isClientRedirect) { m_isClientRedirect = isClientRedirect; }
</span><span class="cx">         void handledOnloadEvents();
</span><span class="lines">@@ -193,7 +204,9 @@
</span><span class="cx"> 
</span><span class="cx">         bool didCreateGlobalHistoryEntry() const { return m_didCreateGlobalHistoryEntry; }
</span><span class="cx">         void setDidCreateGlobalHistoryEntry(bool didCreateGlobalHistoryEntry) { m_didCreateGlobalHistoryEntry = didCreateGlobalHistoryEntry; }
</span><del>-        
</del><ins>+
+        bool subresourceLoadersArePageCacheAcceptable() const { return m_subresourceLoadersArePageCacheAcceptable; }
+
</ins><span class="cx">         void setDefersLoading(bool);
</span><span class="cx">         void setMainResourceDataBufferingPolicy(DataBufferingPolicy);
</span><span class="cx"> 
</span><span class="lines">@@ -249,15 +262,20 @@
</span><span class="cx"> 
</span><span class="cx">         void checkLoadComplete();
</span><span class="cx"> 
</span><ins>+#if USE(CONTENT_FILTERING)
+        void setContentFilterForBlockedLoad(PassRefPtr&lt;ContentFilter&gt;);
+        bool handleContentFilterRequest(const ResourceRequest&amp;);
+#endif
+
+        // The URL of the document resulting from this DocumentLoader.
+        URL documentURL() const;
+
</ins><span class="cx">     protected:
</span><span class="cx">         DocumentLoader(const ResourceRequest&amp;, const SubstituteData&amp;);
</span><span class="cx"> 
</span><span class="cx">         bool m_deferMainResourceDataLoad;
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-
-        // The URL of the document resulting from this DocumentLoader.
-        URL documentURL() const;
</del><span class="cx">         Document* document() const;
</span><span class="cx"> 
</span><span class="cx">         void setRequest(const ResourceRequest&amp;);
</span><span class="lines">@@ -397,11 +415,14 @@
</span><span class="cx">         RefPtr&lt;IconLoadDecisionCallback&gt; m_iconLoadDecisionCallback;
</span><span class="cx">         RefPtr&lt;IconDataCallback&gt; m_iconDataCallback;
</span><span class="cx"> 
</span><ins>+        bool m_subresourceLoadersArePageCacheAcceptable;
+
</ins><span class="cx">         friend class ApplicationCacheHost;  // for substitute resource delivery
</span><span class="cx">         OwnPtr&lt;ApplicationCacheHost&gt; m_applicationCacheHost;
</span><span class="cx"> 
</span><span class="cx"> #if USE(CONTENT_FILTERING)
</span><span class="cx">         RefPtr&lt;ContentFilter&gt; m_contentFilter;
</span><ins>+        RefPtr&lt;ContentFilter&gt; m_contentFilterForBlockedLoad;
</ins><span class="cx"> #endif
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentWritercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentWriter.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentWriter.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/DocumentWriter.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -48,6 +48,10 @@
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;PDFDocument.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame* parentFrame) 
</span><span class="lines">@@ -107,6 +111,10 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame-&gt;loader().stateMachine()-&gt;isDisplayingInitialEmptyDocument() &amp;&amp; m_frame-&gt;loader().client().shouldAlwaysUsePluginDocument(m_mimeType))
</span><span class="cx">         return PluginDocument::create(m_frame, url);
</span><ins>+#if PLATFORM(IOS)
+    if (equalIgnoringCase(m_mimeType, &quot;application/pdf&quot;))
+        return PDFDocument::create(m_frame, url);
+#endif
</ins><span class="cx">     if (!m_frame-&gt;loader().client().hasHTMLView())
</span><span class="cx">         return PlaceholderDocument::create(m_frame, url);
</span><span class="cx">     return DOMImplementation::createDocument(m_mimeType, m_frame, url, m_frame-&gt;inViewSourceMode());
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -104,10 +104,10 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
</del><ins>+#if ENABLE(DATE_AND_TIME_INPUT_TYPES) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx"> PassRefPtr&lt;DateTimeChooser&gt; EmptyChromeClient::openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&amp;)
</span><span class="cx"> {
</span><del>-    return PassRefPtr&lt;DateTimeChooser&gt;();
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx">     virtual PassOwnPtr&lt;ColorChooser&gt; createColorChooser(ColorChooserClient*, const Color&amp;) OVERRIDE;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
</del><ins>+#if ENABLE(DATE_AND_TIME_INPUT_TYPES) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx">     virtual PassRefPtr&lt;DateTimeChooser&gt; openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&amp;) OVERRIDE;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -174,8 +174,10 @@
</span><span class="cx">     virtual void elementDidFocus(const Node*) OVERRIDE { }
</span><span class="cx">     virtual void elementDidBlur(const Node*) OVERRIDE { }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     virtual void setCursor(const Cursor&amp;) OVERRIDE { }
</span><span class="cx">     virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE { }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     virtual void scrollRectIntoView(const IntRect&amp;) const OVERRIDE { }
</span><span class="cx"> 
</span><span class="lines">@@ -192,6 +194,28 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+#if ENABLE(TOUCH_EVENTS)
+    virtual void didPreventDefaultForEvent() OVERRIDE { }
+#endif
+    virtual void didReceiveMobileDocType() OVERRIDE { }
+    virtual void setNeedsScrollNotifications(Frame*, bool) OVERRIDE { }
+    virtual void observedContentChange(Frame*) OVERRIDE { }
+    virtual void clearContentChangeObservers(Frame*) OVERRIDE { }
+    virtual void notifyRevealedSelectionByScrollingFrame(Frame*) OVERRIDE { }
+    virtual void didLayout(LayoutType) OVERRIDE { }
+    virtual void didStartOverflowScroll() OVERRIDE { }
+    virtual void didEndOverflowScroll() OVERRIDE { }
+
+    virtual void suppressFormNotifications() OVERRIDE { }
+    virtual void restoreFormNotifications() OVERRIDE { }
+
+    virtual void addOrUpdateScrollingLayer(Node*, PlatformLayer*, PlatformLayer*, const IntSize&amp;, bool, bool) OVERRIDE { }
+    virtual void removeScrollingLayer(Node*, PlatformLayer*, PlatformLayer*) OVERRIDE { }
+
+    virtual void webAppOrientationsUpdated() OVERRIDE { };
+#endif // PLATFORM(IOS)
+
+#if PLATFORM(IOS)
</ins><span class="cx">     virtual bool isStopping() OVERRIDE { return false; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -220,6 +244,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void makeRepresentation(DocumentLoader*) OVERRIDE { }
</span><span class="cx">     virtual void forceLayout() OVERRIDE { }
</span><ins>+#if PLATFORM(IOS)
+    virtual void forceLayoutWithoutRecalculatingStyles() OVERRIDE { }
+#endif
</ins><span class="cx">     virtual void forceLayoutForNonHTML() OVERRIDE { }
</span><span class="cx"> 
</span><span class="cx">     virtual void setCopiesOnScroll() OVERRIDE { }
</span><span class="lines">@@ -237,6 +264,11 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">     virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&amp;) OVERRIDE { return false; }
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+    virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(DocumentLoader*, unsigned long) OVERRIDE { return nullptr; }
+#endif
+
</ins><span class="cx">     virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&amp;) OVERRIDE { }
</span><span class="cx">     virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) OVERRIDE { }
</span><span class="cx">     virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long) OVERRIDE { }
</span><span class="lines">@@ -325,6 +357,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void savePlatformDataToCachedFrame(CachedFrame*) OVERRIDE { }
</span><span class="cx">     virtual void transitionToCommittedFromCachedFrame(CachedFrame*) OVERRIDE { }
</span><ins>+#if PLATFORM(IOS)
+    virtual void didRestoreFrameHierarchyForCachedFrame() OVERRIDE { }
+#endif
</ins><span class="cx">     virtual void transitionToCommittedForNewPage() OVERRIDE { }
</span><span class="cx"> 
</span><span class="cx">     virtual void didSaveToPageCache() OVERRIDE { }
</span><span class="lines">@@ -449,6 +484,21 @@
</span><span class="cx">     virtual void textWillBeDeletedInTextField(Element*) OVERRIDE { }
</span><span class="cx">     virtual void textDidChangeInTextArea(Element*) OVERRIDE { }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    virtual void suppressSelectionNotifications() OVERRIDE { }
+    virtual void restoreSelectionNotifications() OVERRIDE { }
+    virtual void startDelayingAndCoalescingContentChangeNotifications() OVERRIDE { }
+    virtual void stopDelayingAndCoalescingContentChangeNotifications() OVERRIDE { }
+    virtual void writeDataToPasteboard(NSDictionary*) OVERRIDE { }
+    virtual NSArray* supportedPasteboardTypesForCurrentSelection() OVERRIDE { return nullptr; }
+    virtual NSArray* readDataFromPasteboard(NSString*, int) OVERRIDE { return nullptr; }
+    virtual bool hasRichlyEditableSelection() OVERRIDE { return false; }
+    virtual int getPasteboardItemsCount() OVERRIDE { return 0; }
+    virtual DocumentFragment* documentFragmentFromDelegate(int) OVERRIDE { return nullptr; }
+    virtual bool performsTwoStepPaste(DocumentFragment*) OVERRIDE { return false; }
+    virtual int pasteboardChangeCount() OVERRIDE { return 0; }
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     virtual NSString* userVisibleString(NSURL*) OVERRIDE { return 0; }
</span><span class="cx">     virtual DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt;&amp;) OVERRIDE { return 0; };
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -132,6 +132,14 @@
</span><span class="cx"> #include &quot;Archive.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;DocumentType.h&quot;
+#include &quot;MemoryPressureHandler.h&quot;
+#include &quot;ResourceLoader.h&quot;
+#include &quot;RuntimeApplicationChecksIOS.h&quot;
+#include &quot;SystemMemory.h&quot;
+#include &quot;WKContentObservation.h&quot;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -144,6 +152,10 @@
</span><span class="cx"> static const char defaultAcceptHeader[] = &quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&quot;;
</span><span class="cx"> static double storedTimeOfLastCompletedLoad;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+const int memoryLevelThresholdToPrunePageCache = 20;
+#endif
+
</ins><span class="cx"> bool isBackForwardLoadType(FrameLoadType type)
</span><span class="cx"> {
</span><span class="cx">     switch (type) {
</span><span class="lines">@@ -239,6 +251,7 @@
</span><span class="cx">     , m_loadingFromCachedPage(false)
</span><span class="cx">     , m_suppressOpenerInNewFrame(false)
</span><span class="cx">     , m_currentNavigationHasShownBeforeUnloadConfirmPanel(false)
</span><ins>+    , m_loadsSynchronously(false)
</ins><span class="cx">     , m_forcedSandboxFlags(SandboxNone)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -270,6 +283,32 @@
</span><span class="cx">     m_progressTracker = std::make_unique&lt;FrameProgressTracker&gt;(m_frame);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+void FrameLoader::initForSynthesizedDocument(const URL&amp;)
+{
+    // FIXME: We need to initialize the document URL to the specified URL. Currently the URL is empty and hence
+    // FrameLoader::checkCompleted() will overwrite the URL of the document to be activeDocumentLoader()-&gt;documentURL().
+
+    RefPtr&lt;DocumentLoader&gt; loader = m_client.createDocumentLoader(ResourceRequest(URL(ParsedURLString, emptyString())), SubstituteData());
+    loader-&gt;setFrame(&amp;m_frame);
+    loader-&gt;setResponse(ResourceResponse(URL(), ASCIILiteral(&quot;text/html&quot;), 0, String(), String()));
+    loader-&gt;setCommitted(true);
+    setDocumentLoader(loader.get());
+
+    m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocument);
+    m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
+    m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
+    m_client.transitionToCommittedForNewPage();
+
+    m_didCallImplicitClose = true;
+    m_isComplete = true;
+    m_state = FrameStateComplete;
+    m_needsClear = true;
+
+    m_networkingContext = m_client.createNetworkingContext();
+}
+#endif
+
</ins><span class="cx"> void FrameLoader::setDefersLoading(bool defers)
</span><span class="cx"> {
</span><span class="cx">     if (m_documentLoader)
</span><span class="lines">@@ -789,6 +828,18 @@
</span><span class="cx">     m_requestedHistoryItem = 0;
</span><span class="cx">     m_frame.document()-&gt;setReadyState(Document::Complete);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    if (m_frame.document()-&gt;url().isEmpty()) {
+        // We need to update the document URL of a PDF document to be non-empty so that both back/forward history navigation
+        // between PDF pages and fragment navigation works. See &lt;rdar://problem/9544769&gt; for more details.
+        // FIXME: Is there a better place for this code, say DocumentLoader? Also, we should explicitly only update the URL
+        // of the document when it's a PDFDocument object instead of assuming that a Document object with an empty URL is a PDFDocument.
+        // FIXME: This code is incorrect for a synthesized document (which also has an empty URL). The URL for a synthesized
+        // document should be the URL specified to FrameLoader::initForSynthesizedDocument().
+        m_frame.document()-&gt;setURL(activeDocumentLoader()-&gt;documentURL());
+    }
+#endif
+
</ins><span class="cx">     checkCallImplicitClose(); // if we didn't do it before
</span><span class="cx"> 
</span><span class="cx">     m_frame.navigationScheduler().startTimer();
</span><span class="lines">@@ -1451,6 +1502,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool FrameLoader::willLoadMediaElementURL(URL&amp; url)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // MobileStore depends on the iOS 4.0 era client delegate method because webView:resource:willSendRequest:redirectResponse:fromDataSource
+    // doesn't let them tell when a load request is coming from a media element. See &lt;rdar://problem/8266916&gt; for more details.
+    if (applicationIsMobileStore())
+        return m_client.shouldLoadMediaElementURL(url);
+#endif
+
</ins><span class="cx">     ResourceRequest request(url);
</span><span class="cx"> 
</span><span class="cx">     unsigned long identifier;
</span><span class="lines">@@ -1603,7 +1661,15 @@
</span><span class="cx"> void FrameLoader::stopForUserCancel(bool deferCheckLoadComplete)
</span><span class="cx"> {
</span><span class="cx">     stopAllLoaders();
</span><del>-    
</del><ins>+
+#if PLATFORM(IOS)
+    // Lay out immediately when stopping to immediately clear the old page if we just committed this one
+    // but haven't laid out/painted yet.
+    // FIXME: Is this behavior specific to iOS? Or should we expose a setting to toggle this behavior?
+    if (m_frame.view() &amp;&amp; !m_frame.view()-&gt;didFirstLayout())
+        m_frame.view()-&gt;layout();
+#endif
+
</ins><span class="cx">     if (deferCheckLoadComplete)
</span><span class="cx">         scheduleCheckLoadComplete();
</span><span class="cx">     else if (m_frame.page())
</span><span class="lines">@@ -1722,6 +1788,26 @@
</span><span class="cx">         m_frame.document() ? m_frame.document()-&gt;url().stringCenterEllipsizedToLength().utf8().data() : &quot;&quot;,
</span><span class="cx">         pdl ? pdl-&gt;url().stringCenterEllipsizedToLength().utf8().data() : &quot;&lt;no provisional DocumentLoader&gt;&quot;);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    // In the case where we are not navigating to a cached page, and the system is under (speculative) memory pressure,
+    // we can try to preemptively release some of the pages in the cache.
+    // FIXME: Right now the capacity is 1 on iOS devices with 256 MB of RAM, so this will always blow away the whole
+    // page cache. We could still preemptively prune the page cache while navigating to a cached page if capacity &gt; 1.
+    // See &lt;rdar://problem/11779846&gt; for more details.
+    if (!cachedPage) {
+        if (memoryPressureHandler().hasReceivedMemoryPressure()) {
+            LOG(MemoryPressure, &quot;Pruning page cache because under memory pressure at: %s&quot;, __PRETTY_FUNCTION__);
+            LOG(PageCache, &quot;Pruning page cache to 0 due to memory pressure&quot;);
+            // Don't cache any page if we are under memory pressure.
+            pageCache()-&gt;pruneToCapacityNow(0);
+        } else if (systemMemoryLevel() &lt;= memoryLevelThresholdToPrunePageCache) {
+            LOG(MemoryPressure, &quot;Pruning page cache because system memory level is %d at: %s&quot;, systemMemoryLevel(), __PRETTY_FUNCTION__);
+            LOG(PageCache, &quot;Pruning page cache to %d due to low memory (level %d less or equal to %d threshold)&quot;, pageCache()-&gt;capacity() / 2, systemMemoryLevel(), memoryLevelThresholdToPrunePageCache);
+            pageCache()-&gt;pruneToCapacityNow(pageCache()-&gt;capacity() / 2);
+        }
+    }
+#endif
+
</ins><span class="cx">     willTransitionToCommitted();
</span><span class="cx"> 
</span><span class="cx">     // Check to see if we need to cache the page we are navigating away from into the back/forward cache.
</span><span class="lines">@@ -1752,13 +1838,21 @@
</span><span class="cx">         clientRedirectCancelledOrFinished(false);
</span><span class="cx">     
</span><span class="cx">     if (cachedPage &amp;&amp; cachedPage-&gt;document()) {
</span><ins>+#if PLATFORM(IOS)
+        // FIXME: CachedPage::restore() would dispatch viewport change notification. However UIKit expects load
+        // commit to happen before any changes to viewport arguments and dealing with this there is difficult.
+        m_frame.page()-&gt;chrome().setDispatchViewportDataDidChangeSuppressed(true);
+#endif
</ins><span class="cx">         prepareForCachedPageRestore();
</span><span class="cx"> 
</span><span class="cx">         // FIXME: This API should be turned around so that we ground CachedPage into the Page.
</span><span class="cx">         cachedPage-&gt;restore(*m_frame.page());
</span><span class="cx"> 
</span><span class="cx">         dispatchDidCommitLoad();
</span><del>-
</del><ins>+#if PLATFORM(IOS)
+        m_frame.page()-&gt;chrome().setDispatchViewportDataDidChangeSuppressed(false);
+        m_frame.page()-&gt;chrome().dispatchViewportPropertiesDidChange(m_frame.page()-&gt;viewportArguments());
+#endif
</ins><span class="cx">         // If we have a title let the WebView know about it. 
</span><span class="cx">         StringWithDirection title = m_documentLoader-&gt;title();
</span><span class="cx">         if (!title.isNull())
</span><span class="lines">@@ -1775,10 +1869,19 @@
</span><span class="cx">         history().updateForClientRedirect();
</span><span class="cx"> 
</span><span class="cx">     if (m_loadingFromCachedPage) {
</span><ins>+#if PLATFORM(IOS)
+        // Note, didReceiveDocType is expected to be called for cached pages. See &lt;rdar://problem/5906758&gt; for more details.
+        if (m_frame.document()-&gt;doctype() &amp;&amp; m_frame.page())
+            m_frame.page()-&gt;chrome().didReceiveDocType(&amp;m_frame);
+#endif
</ins><span class="cx">         m_frame.document()-&gt;documentDidResumeFromPageCache();
</span><del>-        
</del><ins>+
</ins><span class="cx">         // Force a layout to update view size and thereby update scrollbars.
</span><ins>+#if PLATFORM(IOS)
+        m_client.forceLayoutWithoutRecalculatingStyles();
+#else
</ins><span class="cx">         m_frame.view()-&gt;forceLayout();
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">         const ResponseVector&amp; responses = m_documentLoader-&gt;responses();
</span><span class="cx">         size_t count = responses.size();
</span><span class="lines">@@ -1841,7 +1944,7 @@
</span><span class="cx"> 
</span><span class="cx">     setState(FrameStateCommittedPage);
</span><span class="cx"> 
</span><del>-#if ENABLE(TOUCH_EVENTS)
</del><ins>+#if ENABLE(TOUCH_EVENTS) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx">     if (m_frame.isMainFrame())
</span><span class="cx">         m_frame.page()-&gt;chrome().client().needTouchEvents(false);
</span><span class="cx"> #endif
</span><span class="lines">@@ -2299,6 +2402,13 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::didFirstLayout()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // Only send layout-related delegate callbacks synchronously for the main frame to
+    // avoid reentering layout for the main frame while delivering a layout-related delegate
+    // callback for a subframe.
+    if (&amp;m_frame != &amp;m_frame.page()-&gt;mainFrame())
+        return;
+#endif
</ins><span class="cx">     if (m_frame.page() &amp;&amp; isBackForwardLoadType(m_loadType))
</span><span class="cx">         history().restoreScrollPositionAndViewState();
</span><span class="cx"> 
</span><span class="lines">@@ -3252,6 +3362,13 @@
</span><span class="cx">     return error;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+RetainPtr&lt;CFDictionaryRef&gt; FrameLoader::connectionProperties(ResourceLoader* loader)
+{
+    return m_client.connectionProperties(loader-&gt;documentLoader(), loader-&gt;identifier());
+}
+#endif
+
</ins><span class="cx"> String FrameLoader::referrer() const
</span><span class="cx"> {
</span><span class="cx">     return m_documentLoader ? m_documentLoader-&gt;request().httpReferrer() : &quot;&quot;;
</span><span class="lines">@@ -3463,9 +3580,10 @@
</span><span class="cx">     // specify the size of the viewport. We can only resize the window, so adjust
</span><span class="cx">     // for the difference between the window size and the viewport size.
</span><span class="cx"> 
</span><ins>+// FIXME: We should reconcile the initialization of viewport arguments between iOS and OpenSource.
+#if !PLATFORM(IOS)
+    FloatSize viewportSize = page-&gt;chrome().pageRect().size();
</ins><span class="cx">     FloatRect windowRect = page-&gt;chrome().windowRect();
</span><del>-    FloatSize viewportSize = page-&gt;chrome().pageRect().size();
-
</del><span class="cx">     if (features.xSet)
</span><span class="cx">         windowRect.setX(features.x);
</span><span class="cx">     if (features.ySet)
</span><span class="lines">@@ -3480,6 +3598,17 @@
</span><span class="cx">     FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
</span><span class="cx"> 
</span><span class="cx">     page-&gt;chrome().setWindowRect(newWindowRect);
</span><ins>+#else
+    // On iOS, width and height refer to the viewport dimensions.
+    ViewportArguments arguments;
+    // Zero width and height mean using default size, not minimum one.
+    if (features.widthSet &amp;&amp; features.width)
+        arguments.width = features.width;
+    if (features.heightSet &amp;&amp; features.height)
+        arguments.height = features.height;
+    page-&gt;mainFrame().setViewportArguments(arguments);
+#endif
+
</ins><span class="cx">     page-&gt;chrome().show();
</span><span class="cx"> 
</span><span class="cx">     created = true;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/FrameLoader.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -89,6 +89,9 @@
</span><span class="cx">     ~FrameLoader();
</span><span class="cx"> 
</span><span class="cx">     void init();
</span><ins>+#if PLATFORM(IOS)
+    void initForSynthesizedDocument(const URL&amp;);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     Frame&amp; frame() const { return m_frame; }
</span><span class="cx"> 
</span><span class="lines">@@ -155,6 +158,9 @@
</span><span class="cx">     FrameState state() const { return m_state; }
</span><span class="cx">     static double timeOfLastCompletedLoad();
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(ResourceLoader*);
+#endif
</ins><span class="cx">     const ResourceRequest&amp; originalRequest() const;
</span><span class="cx">     const ResourceRequest&amp; initialRequest() const;
</span><span class="cx">     void receivedMainResourceError(const ResourceError&amp;);
</span><span class="lines">@@ -241,6 +247,9 @@
</span><span class="cx"> 
</span><span class="cx">     void commitProvisionalLoad();
</span><span class="cx"> 
</span><ins>+    void setLoadsSynchronously(bool loadsSynchronously) { m_loadsSynchronously = loadsSynchronously; }
+    bool loadsSynchronously() const { return m_loadsSynchronously; }
+
</ins><span class="cx">     FrameLoaderStateMachine* stateMachine() const { return &amp;m_stateMachine; }
</span><span class="cx"> 
</span><span class="cx">     Frame* findFrameForNavigation(const AtomicString&amp; name, Document* activeDocument = 0);
</span><span class="lines">@@ -435,9 +444,11 @@
</span><span class="cx">     bool m_didPerformFirstNavigation;
</span><span class="cx">     bool m_loadingFromCachedPage;
</span><span class="cx">     bool m_suppressOpenerInNewFrame;
</span><del>-    
</del><ins>+
</ins><span class="cx">     bool m_currentNavigationHasShownBeforeUnloadConfirmPanel;
</span><span class="cx"> 
</span><ins>+    bool m_loadsSynchronously;
+
</ins><span class="cx">     SandboxFlags m_forcedSandboxFlags;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;FrameNetworkingContext&gt; m_networkingContext;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoaderClient.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -116,6 +116,9 @@
</span><span class="cx"> 
</span><span class="cx">         virtual void makeRepresentation(DocumentLoader*) = 0;
</span><span class="cx">         virtual void forceLayout() = 0;
</span><ins>+#if PLATFORM(IOS)
+        virtual void forceLayoutWithoutRecalculatingStyles() = 0;
+#endif
</ins><span class="cx">         virtual void forceLayoutForNonHTML() = 0;
</span><span class="cx"> 
</span><span class="cx">         virtual void setCopiesOnScroll() = 0;
</span><span class="lines">@@ -132,6 +135,11 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">         virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long identifier, const ProtectionSpace&amp;) = 0;
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+        virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(DocumentLoader*, unsigned long identifier) = 0;
+#endif
+
</ins><span class="cx">         virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&amp;) = 0;
</span><span class="cx">         virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength) = 0;
</span><span class="cx">         virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) = 0;
</span><span class="lines">@@ -249,6 +257,9 @@
</span><span class="cx">         
</span><span class="cx">         virtual void savePlatformDataToCachedFrame(CachedFrame*) = 0;
</span><span class="cx">         virtual void transitionToCommittedFromCachedFrame(CachedFrame*) = 0;
</span><ins>+#if PLATFORM(IOS)
+        virtual void didRestoreFrameHierarchyForCachedFrame() = 0;
+#endif
</ins><span class="cx">         virtual void transitionToCommittedForNewPage() = 0;
</span><span class="cx"> 
</span><span class="cx">         virtual void didSaveToPageCache() = 0;
</span><span class="lines">@@ -281,7 +292,7 @@
</span><span class="cx">         virtual void didPerformFirstNavigation() const = 0; // &quot;Navigation&quot; here means a transition from one page to another that ends up in the back/forward list.
</span><span class="cx"> 
</span><span class="cx">         virtual void registerForIconNotification(bool listen = true) = 0;
</span><del>-        
</del><ins>+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">         // Allow an accessibility object to retrieve a Frame parent if there's no PlatformWidget.
</span><span class="cx">         virtual RemoteAXObjectRef accessibilityRemoteObject() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderHistoryControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/HistoryController.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/HistoryController.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/HistoryController.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -127,6 +127,8 @@
</span><span class="cx">     // through to the client. It's currently used only for the PDF view on Mac.
</span><span class="cx">     m_frame.loader().client().restoreViewState();
</span><span class="cx"> 
</span><ins>+    // Don't restore scroll point on iOS as FrameLoaderClient::restoreViewState() does that.
+#if !PLATFORM(IOS)
</ins><span class="cx">     // FIXME: There is some scrolling related work that needs to happen whenever a page goes into the
</span><span class="cx">     // page cache and similar work that needs to occur when it comes out. This is where we do the work
</span><span class="cx">     // that needs to happen when we exit, and the work that needs to happen when we enter is in
</span><span class="lines">@@ -146,6 +148,7 @@
</span><span class="cx">                 view-&gt;setScrollPosition(m_currentItem-&gt;scrollPoint());
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HistoryController::updateBackForwardListForFragmentScroll()
</span><span class="lines">@@ -875,4 +878,16 @@
</span><span class="cx">     m_frame.loader().client().updateGlobalHistory();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void HistoryController::replaceCurrentItem(HistoryItem* item)
+{
+    if (!item)
+        return;
+
+    m_previousItem = nullptr;
+    if (m_provisionalItem)
+        m_provisionalItem = item;
+    else
+        m_currentItem = item;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderHistoryControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/HistoryController.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/HistoryController.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/HistoryController.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">     void setCurrentItem(HistoryItem*);
</span><span class="cx">     void setCurrentItemTitle(const StringWithDirection&amp;);
</span><span class="cx">     bool currentItemShouldBeReplaced() const;
</span><ins>+    void replaceCurrentItem(HistoryItem*);
</ins><span class="cx"> 
</span><span class="cx">     HistoryItem* previousItem() const { return m_previousItem.get(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderPlaceholderDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/PlaceholderDocument.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/PlaceholderDocument.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/PlaceholderDocument.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -30,20 +30,21 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class PlaceholderDocument FINAL : public Document {
</del><ins>+class PlaceholderDocument : public Document {
</ins><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;PlaceholderDocument&gt; create(Frame* frame, const URL&amp; url)
</span><span class="cx">     {
</span><span class="cx">         return adoptRef(new PlaceholderDocument(frame, url));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-private:
-    virtual void createRenderTree() OVERRIDE;
-
</del><ins>+protected:
</ins><span class="cx">     PlaceholderDocument(Frame* frame, const URL&amp; url)
</span><span class="cx">         : Document(frame, url)
</span><span class="cx">     {
</span><span class="cx">     }
</span><ins>+
+private:
+    virtual void createRenderTree() OVERRIDE;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderPolicyCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/PolicyChecker.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -42,6 +42,14 @@
</span><span class="cx"> #include &quot;HTMLFrameOwnerElement.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> 
</span><ins>+#if USE(QUICK_LOOK)
+#include &quot;QuickLook.h&quot;
+#endif
+
+#if USE(CONTENT_FILTERING)
+#include &quot;ContentFilter.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> PolicyChecker::PolicyChecker(Frame&amp; frame)
</span><span class="lines">@@ -93,6 +101,23 @@
</span><span class="cx"> 
</span><span class="cx">     m_callback.set(request, formState.get(), std::move(function));
</span><span class="cx"> 
</span><ins>+#if USE(QUICK_LOOK)
+    // Always allow QuickLook-generated URLs based on the protocol scheme.
+    if (!request.isNull() &amp;&amp; request.url().protocolIs(QLPreviewProtocol())) {
+        continueAfterNavigationPolicy(PolicyUse);
+        return;
+    }
+#endif
+
+#if USE(CONTENT_FILTERING)
+    if (DocumentLoader* documentLoader = m_frame.loader().documentLoader()) {
+        if (documentLoader-&gt;handleContentFilterRequest(request)) {
+            continueAfterNavigationPolicy(PolicyIgnore);
+            return;
+        }
+    }
+#endif
+
</ins><span class="cx">     m_delegateIsDecidingNavigationPolicy = true;
</span><span class="cx">     m_frame.loader().client().dispatchDecidePolicyForNavigationAction(action, request, formState, [this](PolicyAction action) {
</span><span class="cx">         continueAfterNavigationPolicy(action);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceBuffer.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceBuffer.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/ResourceBuffer.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -112,6 +112,14 @@
</span><span class="cx">     return m_sharedBuffer-&gt;hasPurgeableBuffer();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+void ResourceBuffer::setShouldUsePurgeableMemory(bool shouldUsePurgeableMemory)
+{
+    ASSERT(m_sharedBuffer);
+    sharedBuffer()-&gt;shouldUsePurgeableMemory(shouldUsePurgeableMemory);
+}
+#endif
+
</ins><span class="cx"> void ResourceBuffer::createPurgeableBuffer() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_sharedBuffer);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceBuffer.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceBuffer.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/ResourceBuffer.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -71,7 +71,12 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasPurgeableBuffer() const;
</span><span class="cx">     void createPurgeableBuffer() const;
</span><del>-    
</del><ins>+
+#if PLATFORM(IOS)
+    // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to SharedBuffer.{cpp, h} and SharedBufferCF.cpp.
+    void setShouldUsePurgeableMemory(bool);
+#endif
+
</ins><span class="cx">     // Ensure this buffer has no other clients before calling this.
</span><span class="cx">     PassOwnPtr&lt;PurgeableBuffer&gt; releasePurgeableBuffer();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadNotifiercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -40,6 +40,10 @@
</span><span class="cx"> #include &quot;ProgressTracker.h&quot;
</span><span class="cx"> #include &quot;ResourceLoader.h&quot;
</span><span class="cx"> 
</span><ins>+#if USE(QUICK_LOOK)
+#include &quot;QuickLook.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> ResourceLoadNotifier::ResourceLoadNotifier(Frame&amp; frame)
</span><span class="lines">@@ -107,6 +111,12 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoadNotifier::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest&amp; request, const ResourceResponse&amp; redirectResponse)
</span><span class="cx"> {
</span><ins>+#if USE(QUICK_LOOK)
+    // Always allow QuickLook-generated URLs based on the protocol scheme.
+    if (!request.isNull() &amp;&amp; request.url().protocolIs(QLPreviewProtocol()))
+        return;
+#endif
+
</ins><span class="cx">     String oldRequestURL = request.url().string();
</span><span class="cx">     m_frame.loader().documentLoader()-&gt;didTellClientAboutLoad(request.url());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadSchedulercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -42,11 +42,20 @@
</span><span class="cx"> #include &lt;wtf/TemporaryChange.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &lt;RuntimeApplicationChecksIOS.h&gt;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static const unsigned maxRequestsInFlightForNonHTTPProtocols = 20;
</del><span class="cx"> // Match the parallel connection count used by the networking layer.
</span><span class="cx"> static unsigned maxRequestsInFlightPerHost;
</span><ins>+#if !PLATFORM(IOS)
+static const unsigned maxRequestsInFlightForNonHTTPProtocols = 20;
+#else
+// Limiting this seems to regress performance in some local cases so let's just make it large.
+static const unsigned maxRequestsInFlightForNonHTTPProtocols = 10000;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> ResourceLoadScheduler::HostInformation* ResourceLoadScheduler::hostForURL(const URL&amp; url, CreateHostPolicy createHostPolicy)
</span><span class="cx"> {
</span><span class="lines">@@ -104,6 +113,15 @@
</span><span class="cx">     RefPtr&lt;SubresourceLoader&gt; loader = SubresourceLoader::create(frame, resource, request, options);
</span><span class="cx">     if (loader)
</span><span class="cx">         scheduleLoad(loader.get(), priority);
</span><ins>+#if PLATFORM(IOS)
+    // Since we defer loader initialization until scheduling on iOS, the frame
+    // load delegate that would be called in SubresourceLoader::create() on
+    // other ports might be called in scheduleLoad() instead. Our contract to
+    // callers of this method is that a null loader is returned if the load was
+    // cancelled by a frame load delegate.
+    if (!loader || loader-&gt;reachedTerminalState())
+        return nullptr;
+#endif
</ins><span class="cx">     return loader.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -122,21 +140,49 @@
</span><span class="cx"> 
</span><span class="cx">     LOG(ResourceLoading, &quot;ResourceLoadScheduler::load resource %p '%s'&quot;, resourceLoader, resourceLoader-&gt;url().string().latin1().data());
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
</ins><span class="cx">     // If there's a web archive resource for this URL, we don't need to schedule the load since it will never touch the network.
</span><ins>+    if (!isSuspendingPendingRequests() &amp;&amp; resourceLoader-&gt;documentLoader()-&gt;archiveResourceForURL(resourceLoader-&gt;iOSOriginalRequest().url())) {
+        resourceLoader-&gt;startLoading();
+        return;
+    }
+#else
</ins><span class="cx">     if (resourceLoader-&gt;documentLoader()-&gt;archiveResourceForURL(resourceLoader-&gt;request().url())) {
</span><span class="cx">         resourceLoader-&gt;start();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+#endif
</ins><span class="cx"> 
</span><del>-    HostInformation* host = hostForURL(resourceLoader-&gt;url(), CreateIfNotFound);    
</del><ins>+#if PLATFORM(IOS)
+    HostInformation* host = hostForURL(resourceLoader-&gt;iOSOriginalRequest().url(), CreateIfNotFound);
+#else
+    HostInformation* host = hostForURL(resourceLoader-&gt;url(), CreateIfNotFound);
+#endif
+
</ins><span class="cx">     bool hadRequests = host-&gt;hasRequests();
</span><span class="cx">     host-&gt;schedule(resourceLoader, priority);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    if (ResourceRequest::httpPipeliningEnabled() &amp;&amp; !isSuspendingPendingRequests()) {
+        // Serve all requests at once to keep the pipeline full at the network layer.
+        servePendingRequests(host, ResourceLoadPriorityVeryLow);
+        return;
+    }
+#endif
+
+#if PLATFORM(IOS)
+    if ((priority &gt; ResourceLoadPriorityLow || !resourceLoader-&gt;iOSOriginalRequest().url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriorityLow &amp;&amp; !hadRequests)) &amp;&amp; !isSuspendingPendingRequests()) {
+        // Try to request important resources immediately.
+        servePendingRequests(host, priority);
+        return;
+    }
+#else
</ins><span class="cx">     if (priority &gt; ResourceLoadPriorityLow || !resourceLoader-&gt;url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriorityLow &amp;&amp; !hadRequests)) {
</span><span class="cx">         // Try to request important resources immediately.
</span><span class="cx">         servePendingRequests(host, priority);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     notifyDidScheduleResourceRequest(resourceLoader);
</span><span class="cx"> 
</span><span class="lines">@@ -157,6 +203,15 @@
</span><span class="cx">     HostInformation* host = hostForURL(resourceLoader-&gt;url());
</span><span class="cx">     if (host)
</span><span class="cx">         host-&gt;remove(resourceLoader);
</span><ins>+#if PLATFORM(IOS)
+    // ResourceLoader::url() doesn't start returning the correct value until the load starts. If we get canceled before that, we need to look for originalRequest url instead.
+    // FIXME: ResourceLoader::url() should be made to return a sensible value at all times.
+    if (!resourceLoader-&gt;iOSOriginalRequest().isNull()) {
+        HostInformation* originalHost = hostForURL(resourceLoader-&gt;iOSOriginalRequest().url());
+        if (originalHost &amp;&amp; originalHost != host)
+            originalHost-&gt;remove(resourceLoader);
+    }
+#endif
</ins><span class="cx">     scheduleServePendingRequests();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -164,11 +219,14 @@
</span><span class="cx"> {
</span><span class="cx">     HostInformation* oldHost = hostForURL(resourceLoader-&gt;url());
</span><span class="cx">     ASSERT(oldHost);
</span><ins>+    if (!oldHost)
+        return;
+
</ins><span class="cx">     HostInformation* newHost = hostForURL(redirectURL, CreateIfNotFound);
</span><span class="cx"> 
</span><span class="cx">     if (oldHost-&gt;name() == newHost-&gt;name())
</span><span class="cx">         return;
</span><del>-    
</del><ins>+
</ins><span class="cx">     newHost-&gt;addLoadInProgress(resourceLoader);
</span><span class="cx">     oldHost-&gt;remove(resourceLoader);
</span><span class="cx"> }
</span><span class="lines">@@ -219,6 +277,12 @@
</span><span class="cx"> 
</span><span class="cx">             requestsPending.removeFirst();
</span><span class="cx">             host-&gt;addLoadInProgress(resourceLoader.get());
</span><ins>+#if PLATFORM(IOS)
+            if (!applicationIsWebProcess()) {
+                resourceLoader-&gt;startLoading();
+                return;
+            }
+#endif
</ins><span class="cx">             resourceLoader-&gt;start();
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -110,6 +110,15 @@
</span><span class="cx">     ASSERT(!m_documentLoader-&gt;isSubstituteLoadPending(this));
</span><span class="cx">     
</span><span class="cx">     ResourceRequest clientRequest(r);
</span><ins>+
+#if PLATFORM(IOS)
+    // If the documentLoader was detached while this ResourceLoader was waiting its turn
+    // in ResourceLoadScheduler queue, don't continue.
+    if (!m_documentLoader-&gt;frame()) {
+        cancel();
+        return false;
+    }
+#endif
</ins><span class="cx">     
</span><span class="cx">     m_defersLoading = m_frame-&gt;page()-&gt;defersLoading();
</span><span class="cx">     if (m_options.securityCheck == DoSecurityCheck &amp;&amp; !m_frame-&gt;document()-&gt;securityOrigin()-&gt;canDisplay(clientRequest.url())) {
</span><span class="lines">@@ -129,6 +138,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     willSendRequest(clientRequest, ResourceResponse());
</span><ins>+
+#if PLATFORM(IOS)
+    // If this ResourceLoader was stopped as a result of willSendRequest, bail out.
+    if (m_reachedTerminalState)
+        return false;
+#endif
+
</ins><span class="cx">     if (clientRequest.isNull()) {
</span><span class="cx">         cancel();
</span><span class="cx">         return false;
</span><span class="lines">@@ -228,7 +244,21 @@
</span><span class="cx">     Ref&lt;ResourceLoader&gt; protect(*this);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!m_reachedTerminalState);
</span><ins>+    
+#if PLATFORM(IOS)
+    // Ensure an identifier is always set. This ensures that this assetion is not hit:
+    // &lt;rdar://problem/11059794&gt; ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key) in WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace loading the attached web archive
+    // This is not needed in WebKit2, as it doesn't use m_identifier in WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace
+    if (!m_identifier) {
+        m_identifier = m_frame-&gt;page()-&gt;progress().createUniqueIdentifier();
+        frameLoader()-&gt;notifier().assignIdentifierToInitialRequest(m_identifier, documentLoader(), request);
</ins><span class="cx"> 
</span><ins>+        // If this ResourceLoader was stopped as a result of assignIdentifierToInitialRequest, bail out
+        if (m_reachedTerminalState)
+            return;
+    }
+#endif
+
</ins><span class="cx">     // We need a resource identifier for all requests, even if FrameLoader is never going to see it (such as with CORS preflight requests).
</span><span class="cx">     bool createdResourceIdentifier = false;
</span><span class="cx">     if (!m_identifier) {
</span><span class="lines">@@ -552,6 +582,13 @@
</span><span class="cx">     return frameLoader()-&gt;client().canAuthenticateAgainstProtectionSpace(documentLoader(), identifier(), protectionSpace);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><ins>+    
+#if PLATFORM(IOS)
+RetainPtr&lt;CFDictionaryRef&gt; ResourceLoader::connectionProperties(ResourceHandle*)
+{
+    return frameLoader()-&gt;connectionProperties(this);
+}
+#endif
</ins><span class="cx"> 
</span><span class="cx"> void ResourceLoader::receivedCancellation(const AuthenticationChallenge&amp;)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/ResourceLoader.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -56,6 +56,17 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool init(const ResourceRequest&amp;);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    virtual bool startLoading()
+    {
+        start();
+        return true;
+    }
+
+    virtual const ResourceRequest&amp; iOSOriginalRequest() const { return request(); }
+    virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(ResourceHandle*) OVERRIDE;
+#endif
+
</ins><span class="cx">     FrameLoader* frameLoader() const;
</span><span class="cx">     DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
</span><span class="cx">     const ResourceRequest&amp; originalRequest() const { return m_originalRequest; }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubframeLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubframeLoader.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -432,6 +432,13 @@
</span><span class="cx"> 
</span><span class="cx">     IntSize contentSize = roundedIntSize(LayoutSize(renderer-&gt;contentWidth(), renderer-&gt;contentHeight()));
</span><span class="cx">     bool loadManually = document()-&gt;isPluginDocument() &amp;&amp; !m_containsPlugins &amp;&amp; toPluginDocument(document())-&gt;shouldLoadPluginManually();
</span><ins>+
+#if PLATFORM(IOS)
+    // On iOS, we only tell the plugin to be in full page mode if the containing plugin document is the top level document.
+    if (document()-&gt;ownerElement())
+        loadManually = false;
+#endif
+
</ins><span class="cx">     RefPtr&lt;Widget&gt; widget = m_frame.loader().client().createPlugin(contentSize, &amp;pluginElement, url, paramNames, paramValues, mimeType, loadManually);
</span><span class="cx"> 
</span><span class="cx">     if (!widget) {
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -44,6 +44,10 @@
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &lt;RuntimeApplicationChecksIOS.h&gt;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, subresourceLoaderCounter, (&quot;SubresourceLoader&quot;));
</span><span class="lines">@@ -84,10 +88,31 @@
</span><span class="cx"> PassRefPtr&lt;SubresourceLoader&gt; SubresourceLoader::create(Frame* frame, CachedResource* resource, const ResourceRequest&amp; request, const ResourceLoaderOptions&amp; options)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;SubresourceLoader&gt; subloader(adoptRef(new SubresourceLoader(frame, resource, options)));
</span><ins>+#if PLATFORM(IOS)
+    if (!applicationIsWebProcess()) {
+        // On iOS, do not invoke synchronous resource load delegates while resource load scheduling
+        // is disabled to avoid re-entering style selection from a different thread (see &lt;rdar://problem/9121719&gt;).
+        // FIXME: This should be fixed for all ports in &lt;https://bugs.webkit.org/show_bug.cgi?id=56647&gt;.
+        subloader-&gt;m_iOSOriginalRequest = request;
+        return subloader.release();
+    }
+#endif
</ins><span class="cx">     if (!subloader-&gt;init(request))
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     return subloader.release();
</span><span class="cx"> }
</span><ins>+    
+#if PLATFORM(IOS)
+bool SubresourceLoader::startLoading()
+{
+    ASSERT(!applicationIsWebProcess());
+    if (!init(m_iOSOriginalRequest))
+        return false;
+    m_iOSOriginalRequest = ResourceRequest();
+    start();
+    return true;
+}
+#endif
</ins><span class="cx"> 
</span><span class="cx"> CachedResource* SubresourceLoader::cachedResource()
</span><span class="cx"> {
</span><span class="lines">@@ -273,6 +298,11 @@
</span><span class="cx">     LOG(ResourceLoading, &quot;Received '%s'.&quot;, m_resource-&gt;url().string().latin1().data());
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;SubresourceLoader&gt; protect(*this);
</span><ins>+
+#if PLATFORM(IOS)
+    if (resourceData())
+        resourceData()-&gt;setShouldUsePurgeableMemory(true);
+#endif
</ins><span class="cx">     CachedResourceHandle&lt;CachedResource&gt; protectResource(m_resource);
</span><span class="cx">     m_state = Finishing;
</span><span class="cx">     m_resource-&gt;setLoadFinishTime(finishTime);
</span><span class="lines">@@ -314,13 +344,24 @@
</span><span class="cx"> 
</span><span class="cx"> void SubresourceLoader::willCancel(const ResourceError&amp; error)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // Since we defer initialization to scheduling time on iOS but
+    // CachedResourceLoader stores resources in the memory cache immediately,
+    // m_resource might be cached despite its loader not being initialized.
+    if (m_state != Initialized &amp;&amp; m_state != Uninitialized)
+#else
</ins><span class="cx">     if (m_state != Initialized)
</span><ins>+#endif
</ins><span class="cx">         return;
</span><span class="cx">     ASSERT(!reachedTerminalState());
</span><span class="cx">     LOG(ResourceLoading, &quot;Cancelled load of '%s'.\n&quot;, m_resource-&gt;url().string().latin1().data());
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;SubresourceLoader&gt; protect(*this);
</span><ins>+#if PLATFORM(IOS)
+    m_state = m_state == Uninitialized ? CancelledWhileInitializing : Finishing;
+#else
</ins><span class="cx">     m_state = Finishing;
</span><ins>+#endif
</ins><span class="cx">     if (m_resource-&gt;resourceToRevalidate())
</span><span class="cx">         memoryCache()-&gt;revalidationFailed(m_resource);
</span><span class="cx">     m_resource-&gt;setResourceError(error);
</span><span class="lines">@@ -342,7 +383,11 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_requestCountTracker.clear();
</span><ins>+#if PLATFORM(IOS)
+    m_documentLoader-&gt;cachedResourceLoader().loadDone(m_resource, m_state != CancelledWhileInitializing);
+#else
</ins><span class="cx">     m_documentLoader-&gt;cachedResourceLoader().loadDone(m_resource);
</span><ins>+#endif
</ins><span class="cx">     if (reachedTerminalState())
</span><span class="cx">         return;
</span><span class="cx">     m_documentLoader-&gt;removeSubresourceLoader(this);
</span><span class="lines">@@ -351,7 +396,11 @@
</span><span class="cx"> void SubresourceLoader::releaseResources()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!reachedTerminalState());
</span><ins>+#if PLATFORM(IOS)
+    if (m_state != Uninitialized &amp;&amp; m_state != CancelledWhileInitializing)
+#else
</ins><span class="cx">     if (m_state != Uninitialized)
</span><ins>+#endif
</ins><span class="cx">         m_resource-&gt;clearLoader();
</span><span class="cx">     m_resource = 0;
</span><span class="cx">     ResourceLoader::releaseResources();
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/SubresourceLoader.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -52,6 +52,13 @@
</span><span class="cx">     virtual bool isSubresourceLoader() OVERRIDE;
</span><span class="cx">     CachedResource* cachedResource();
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    virtual bool startLoading() OVERRIDE;
+
+    // FIXME: What is an &quot;iOS&quot; original request? Why is it necessary?
+    virtual const ResourceRequest&amp; iOSOriginalRequest() const OVERRIDE { return m_iOSOriginalRequest; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     SubresourceLoader(Frame*, CachedResource*, const ResourceLoaderOptions&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -86,7 +93,10 @@
</span><span class="cx">     enum SubresourceLoaderState {
</span><span class="cx">         Uninitialized,
</span><span class="cx">         Initialized,
</span><del>-        Finishing
</del><ins>+        Finishing,
+#if PLATFORM(IOS)
+        CancelledWhileInitializing
+#endif
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     class RequestCountTracker {
</span><span class="lines">@@ -98,6 +108,9 @@
</span><span class="cx">         CachedResource* m_resource;
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    ResourceRequest m_iOSOriginalRequest;
+#endif
</ins><span class="cx">     CachedResource* m_resource;
</span><span class="cx">     bool m_loadingMultipartContent;
</span><span class="cx">     SubresourceLoaderState m_state;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -42,6 +42,10 @@
</span><span class="cx"> #include &lt;wtf/StringExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;SQLiteDatabaseTracker.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static const char flatFileSubdirectory[] = &quot;ApplicationCache&quot;;
</span><span class="lines">@@ -100,6 +104,10 @@
</span><span class="cx"> 
</span><span class="cx"> ApplicationCacheGroup* ApplicationCacheStorage::loadCacheGroup(const URL&amp; manifestURL)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     openDatabase(false);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="cx">         return 0;
</span><span class="lines">@@ -174,6 +182,10 @@
</span><span class="cx">     // to avoid trying to open the database over and over if it doesn't exist.
</span><span class="cx">     hasLoadedHashes = true;
</span><span class="cx">     
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     openDatabase(false);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="cx">         return;
</span><span class="lines">@@ -220,6 +232,11 @@
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="cx">         return 0;
</span><span class="cx">         
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
+
</ins><span class="cx">     // Check the database. Look for all cache groups with a newest cache.
</span><span class="cx">     SQLiteStatement statement(m_database, &quot;SELECT id, manifestURL, newestCache FROM CacheGroups WHERE newestCache IS NOT NULL&quot;);
</span><span class="cx">     if (statement.prepare() != SQLResultOk)
</span><span class="lines">@@ -266,6 +283,10 @@
</span><span class="cx"> 
</span><span class="cx"> ApplicationCacheGroup* ApplicationCacheStorage::fallbackCacheGroupForURL(const URL&amp; url)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     ASSERT(!url.hasFragmentIdentifier());
</span><span class="cx"> 
</span><span class="cx">     // Check if an appropriate cache already exists in memory.
</span><span class="lines">@@ -437,6 +458,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* origin, int64_t&amp; quota)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     // If an Origin record doesn't exist, then the COUNT will be 0 and quota will be 0.
</span><span class="cx">     // Using the count to determine if a record existed or not is a safe way to determine
</span><span class="cx">     // if a quota of 0 is real, from the record, or from null.
</span><span class="lines">@@ -460,6 +485,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::calculateUsageForOrigin(const SecurityOrigin* origin, int64_t&amp; usage)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     // If an Origins record doesn't exist, then the SUM will be null,
</span><span class="cx">     // which will become 0, as expected, when converting to a number.
</span><span class="cx">     SQLiteStatement statement(m_database, &quot;SELECT SUM(Caches.size)&quot;
</span><span class="lines">@@ -484,6 +513,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t&amp; remainingSize)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     openDatabase(false);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="cx">         return false;
</span><span class="lines">@@ -533,6 +566,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::storeUpdatedQuotaForOrigin(const SecurityOrigin* origin, int64_t quota)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     openDatabase(true);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="cx">         return false;
</span><span class="lines">@@ -552,6 +589,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::executeSQLCommand(const String&amp; sql)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     ASSERT(m_database.isOpen());
</span><span class="cx">     
</span><span class="cx">     bool result = m_database.executeCommand(sql);
</span><span class="lines">@@ -569,6 +609,9 @@
</span><span class="cx">     
</span><span class="cx"> void ApplicationCacheStorage::verifySchemaVersion()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     int version = SQLiteStatement(m_database, &quot;PRAGMA user_version&quot;).getColumnInt(0);
</span><span class="cx">     if (version == schemaVersion)
</span><span class="cx">         return;
</span><span class="lines">@@ -593,6 +636,10 @@
</span><span class="cx">     
</span><span class="cx"> void ApplicationCacheStorage::openDatabase(bool createIfDoesNotExist)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     if (m_database.isOpen())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -660,6 +707,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::executeStatement(SQLiteStatement&amp; statement)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     bool result = statement.executeCommand();
</span><span class="cx">     if (!result)
</span><span class="cx">         LOG_ERROR(&quot;Application Cache Storage: failed to execute statement \&quot;%s\&quot; error \&quot;%s\&quot;&quot;, 
</span><span class="lines">@@ -670,6 +720,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::store(ApplicationCacheGroup* group, GroupStorageIDJournal* journal)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     ASSERT(group-&gt;storageID() == 0);
</span><span class="cx">     ASSERT(journal);
</span><span class="cx"> 
</span><span class="lines">@@ -696,6 +749,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::store(ApplicationCache* cache, ResourceStorageIDJournal* storageIDJournal)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     ASSERT(cache-&gt;storageID() == 0);
</span><span class="cx">     ASSERT(cache-&gt;group()-&gt;storageID() != 0);
</span><span class="cx">     ASSERT(storageIDJournal);
</span><span class="lines">@@ -777,6 +833,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, unsigned cacheStorageID)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     ASSERT(cacheStorageID);
</span><span class="cx">     ASSERT(!resource-&gt;storageID());
</span><span class="cx">     
</span><span class="lines">@@ -894,6 +953,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::storeUpdatedType(ApplicationCacheResource* resource, ApplicationCache* cache)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     ASSERT_UNUSED(cache, cache-&gt;storageID());
</span><span class="cx">     ASSERT(resource-&gt;storageID());
</span><span class="cx"> 
</span><span class="lines">@@ -910,6 +973,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, ApplicationCache* cache)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     ASSERT(cache-&gt;storageID());
</span><span class="cx">     
</span><span class="cx">     openDatabase(true);
</span><span class="lines">@@ -945,6 +1012,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::ensureOriginRecord(const SecurityOrigin* origin)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     SQLiteStatement insertOriginStatement(m_database, &quot;INSERT INTO Origins (origin, quota) VALUES (?, ?)&quot;);
</span><span class="cx">     if (insertOriginStatement.prepare() != SQLResultOk)
</span><span class="cx">         return false;
</span><span class="lines">@@ -1092,6 +1162,9 @@
</span><span class="cx">     
</span><span class="cx"> PassRefPtr&lt;ApplicationCache&gt; ApplicationCacheStorage::loadCache(unsigned storageID)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(SQLiteDatabaseTracker::hasTransactionInProgress());
+#endif
</ins><span class="cx">     SQLiteStatement cacheStatement(m_database, 
</span><span class="cx">                                    &quot;SELECT url, statusCode, type, mimeType, textEncodingName, headers, CacheResourceData.data, CacheResourceData.path FROM CacheEntries INNER JOIN CacheResources ON CacheEntries.resource=CacheResources.id &quot;
</span><span class="cx">                                    &quot;INNER JOIN CacheResourceData ON CacheResourceData.id=CacheResources.data WHERE CacheEntries.cache=?&quot;);
</span><span class="lines">@@ -1200,6 +1273,10 @@
</span><span class="cx">     
</span><span class="cx"> void ApplicationCacheStorage::remove(ApplicationCache* cache)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     if (!cache-&gt;storageID())
</span><span class="cx">         return;
</span><span class="cx">     
</span><span class="lines">@@ -1237,6 +1314,10 @@
</span><span class="cx"> 
</span><span class="cx"> void ApplicationCacheStorage::empty()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     openDatabase(false);
</span><span class="cx">     
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="lines">@@ -1301,6 +1382,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::storeCopyOfCache(const String&amp; cacheDirectory, ApplicationCacheHost* cacheHost)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     ApplicationCache* cache = cacheHost-&gt;applicationCache();
</span><span class="cx">     if (!cache)
</span><span class="cx">         return true;
</span><span class="lines">@@ -1337,6 +1422,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::manifestURLs(Vector&lt;URL&gt;* urls)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     ASSERT(urls);
</span><span class="cx">     openDatabase(false);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="lines">@@ -1355,6 +1444,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::cacheGroupSize(const String&amp; manifestURL, int64_t* size)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     ASSERT(size);
</span><span class="cx">     openDatabase(false);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="lines">@@ -1381,6 +1474,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheStorage::deleteCacheGroup(const String&amp; manifestURL)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     SQLiteTransaction deleteTransaction(m_database);
</span><span class="cx">     // Check to see if the group is in memory.
</span><span class="cx">     ApplicationCacheGroup* group = m_cachesInMemory.get(manifestURL);
</span><span class="lines">@@ -1432,6 +1529,10 @@
</span><span class="cx"> 
</span><span class="cx"> void ApplicationCacheStorage::vacuumDatabaseFile()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter.
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
</ins><span class="cx">     openDatabase(false);
</span><span class="cx">     if (!m_database.isOpen())
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedImage.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -45,6 +45,10 @@
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;SystemMemory.h&quot;
+#endif
+
</ins><span class="cx"> #if USE(CG)
</span><span class="cx"> #include &quot;PDFDocumentImage.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -76,6 +80,15 @@
</span><span class="cx">     setLoading(false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CachedImage::CachedImage(const URL&amp; url, Image* image)
+    : CachedResource(ResourceRequest(url), ImageResource)
+    , m_image(image)
+    , m_shouldPaintBrokenImage(true)
+{
+    setStatus(Cached);
+    setLoading(false);
+}
+
</ins><span class="cx"> CachedImage::~CachedImage()
</span><span class="cx"> {
</span><span class="cx">     clearImage();
</span><span class="lines">@@ -267,8 +280,17 @@
</span><span class="cx">     }
</span><span class="cx"> #else
</span><span class="cx">     if (m_image-&gt;isBitmapImage() &amp;&amp; (renderer &amp;&amp; renderer-&gt;shouldRespectImageOrientation() == RespectImageOrientation))
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         imageSize = toBitmapImage(m_image.get())-&gt;sizeRespectingOrientation();
</span><del>-#endif
</del><ins>+#else
+    {
+        // On iOS, the image may have been subsampled to accommodate our size restrictions. However
+        // we should tell the renderer what the original size was.
+        imageSize = toBitmapImage(m_image.get())-&gt;originalSizeRespectingOrientation();
+    } else if (m_image-&gt;isBitmapImage())
+        imageSize = toBitmapImage(m_image.get())-&gt;originalSize();
+#endif // !PLATFORM(IOS)
+#endif // ENABLE(CSS_IMAGE_ORIENTATION)
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(SVG)
</span><span class="cx">     else if (m_image-&gt;isSVGImage() &amp;&amp; sizeType == UsedSize) {
</span><span class="lines">@@ -590,4 +612,29 @@
</span><span class="cx">     return !securityOrigin-&gt;taintsCanvas(response().url());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CF)
+// FIXME: We should look to incorporate the functionality of CachedImageManual
+// into CachedImage or find a better place for this class.
+// FIXME: Remove the USE(CF) once we make MemoryCache::addImageToCache() platform-independent.
+CachedImageManual::CachedImageManual(const URL&amp; url, Image* image)
+    : CachedImage(url, image)
+    , m_fakeClient(std::make_unique&lt;CachedImageClient&gt;())
+{
+    // Use the incoming URL in the response field. This ensures that code
+    // using the response directly, such as origin checks for security,
+    // actually see something.
+    m_response.setURL(url);
+}
+
+bool CachedImageManual::mustRevalidateDueToCacheHeaders(CachePolicy) const
+{
+    // Do not revalidate manually cached images. This mechanism is used as a
+    // way to efficiently share an image from the client to content and
+    // the URL for that image may not represent a resource that can be
+    // retrieved by standard means. If the manual caching SPI is used, it is
+    // incumbent on the client to only use valid resources.
+    return false;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedImage.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedImage.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/CachedImage.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -45,12 +45,13 @@
</span><span class="cx"> 
</span><span class="cx"> struct Length;
</span><span class="cx"> 
</span><del>-class CachedImage FINAL : public CachedResource, public ImageObserver {
</del><ins>+class CachedImage : public CachedResource, public ImageObserver {
</ins><span class="cx">     friend class MemoryCache;
</span><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     CachedImage(const ResourceRequest&amp;);
</span><span class="cx">     CachedImage(Image*);
</span><ins>+    CachedImage(const URL&amp;, Image*);
</ins><span class="cx">     virtual ~CachedImage();
</span><span class="cx"> 
</span><span class="cx">     Image* image(); // Returns the nullImage() if the image is not available yet.
</span><span class="lines">@@ -79,6 +80,11 @@
</span><span class="cx">     LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeType = UsedSize); // returns the size of the complete image.
</span><span class="cx">     void computeIntrinsicDimensions(Length&amp; intrinsicWidth, Length&amp; intrinsicHeight, FloatSize&amp; intrinsicRatio);
</span><span class="cx"> 
</span><ins>+#if USE(CF)
+    // FIXME: Remove the USE(CF) once we make MemoryCache::addImageToCache() platform-independent.
+    virtual bool isManual() const { return false; }
+#endif
+
</ins><span class="cx">     static void resumeAnimatingImagesForLoader(CachedResourceLoader*);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DISK_IMAGE_CACHE)
</span><span class="lines">@@ -143,6 +149,22 @@
</span><span class="cx">     bool m_shouldPaintBrokenImage;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+#if USE(CF)
+// FIXME: We should look to incorporate the functionality of CachedImageManual
+// into CachedImage or find a better place for this class.
+// FIXME: Remove the USE(CF) once we make MemoryCache::addImageToCache() platform-independent.
+class CachedImageManual : public CachedImage {
+public:
+    CachedImageManual(const URL&amp;, Image*);
+    void addFakeClient() { addClient(m_fakeClient.get()); }
+    void removeFakeClient() { removeClient(m_fakeClient.get()); }
+    virtual bool isManual() const OVERRIDE { return true; }
+    virtual bool mustRevalidateDueToCacheHeaders(CachePolicy) const;
+private:
+    std::unique_ptr&lt;CachedResourceClient&gt; m_fakeClient;
+};
+#endif
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -54,6 +54,10 @@
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><ins>+#if USE(QUICK_LOOK)
+#include &quot;QuickLook.h&quot;
+#endif
+
</ins><span class="cx"> using namespace WTF;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -306,6 +310,16 @@
</span><span class="cx">     m_options = options;
</span><span class="cx">     m_loading = true;
</span><span class="cx"> 
</span><ins>+#if USE(QUICK_LOOK)
+    if (!m_resourceRequest.isNull() &amp;&amp; m_resourceRequest.url().protocolIs(QLPreviewProtocol())) {
+        // When QuickLook is invoked to convert a document, it returns a unique URL in the
+        // NSURLReponse for the main document. To make safeQLURLForDocumentURLAndResourceURL()
+        // work, we need to use the QL URL not the original URL.
+        const URL&amp; documentURL = cachedResourceLoader-&gt;frame() ? cachedResourceLoader-&gt;frame()-&gt;loader().documentLoader()-&gt;response().url() : cachedResourceLoader-&gt;document()-&gt;url();
+        m_resourceRequest.setURL(safeQLURLForDocumentURLAndResourceURL(documentURL, url()));
+    }
+#endif
+
</ins><span class="cx"> #if PLATFORM(BLACKBERRY)
</span><span class="cx">     if (m_resourceRequest.targetType() == ResourceRequest::TargetIsUnspecified)
</span><span class="cx">         m_resourceRequest.setTargetType(cachedResourceTypeToTargetType(type()));
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -228,7 +228,9 @@
</span><span class="cx">     void unregisterHandle(CachedResourceHandleBase* h);
</span><span class="cx">     
</span><span class="cx">     bool canUseCacheValidator() const;
</span><del>-    bool mustRevalidateDueToCacheHeaders(CachePolicy) const;
</del><ins>+
+    virtual bool mustRevalidateDueToCacheHeaders(CachePolicy) const;
+
</ins><span class="cx">     bool isCacheValidator() const { return m_resourceToRevalidate; }
</span><span class="cx">     CachedResource* resourceToRevalidate() const { return m_resourceToRevalidate; }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -741,7 +741,7 @@
</span><span class="cx">     m_documentResources.remove(resource-&gt;url());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResourceLoader::loadDone(CachedResource* resource)
</del><ins>+void CachedResourceLoader::loadDone(CachedResource* resource, bool shouldPerformPostLoadActions)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;DocumentLoader&gt; protectDocumentLoader(m_documentLoader);
</span><span class="cx">     RefPtr&lt;Document&gt; protectDocument(m_document);
</span><span class="lines">@@ -766,8 +766,10 @@
</span><span class="cx"> 
</span><span class="cx">     if (frame())
</span><span class="cx">         frame()-&gt;loader().loadDone();
</span><del>-    performPostLoadActions();
</del><span class="cx"> 
</span><ins>+    if (shouldPerformPostLoadActions)
+        performPostLoadActions();
+
</ins><span class="cx">     if (!m_garbageCollectDocumentResourcesTimer.isActive())
</span><span class="cx">         m_garbageCollectDocumentResourcesTimer.startOneShot(0);
</span><span class="cx"> }
</span><span class="lines">@@ -826,21 +828,20 @@
</span><span class="cx"> 
</span><span class="cx"> void CachedResourceLoader::preload(CachedResource::Type type, CachedResourceRequest&amp; request, const String&amp; charset)
</span><span class="cx"> {
</span><del>-    bool delaySubresourceLoad = true;
-#if PLATFORM(IOS)
-    delaySubresourceLoad = false;
</del><ins>+    // We always preload resources on iOS. See &lt;https://bugs.webkit.org/show_bug.cgi?id=91276&gt;.
+    // FIXME: We should consider adding a setting to toggle aggressive preloading behavior as opposed
+    // to making this behavior specific to iOS.
+#if !PLATFORM(IOS)
+    bool hasRendering = m_document-&gt;body() &amp;&amp; m_document-&gt;body()-&gt;renderer();
+    bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet;
+    if (!hasRendering &amp;&amp; !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, request, charset };
+        m_pendingPreloads.append(pendingPreload);
+        return;
+    }
</ins><span class="cx"> #endif
</span><del>-    if (delaySubresourceLoad) {
-        bool hasRendering = m_document-&gt;body() &amp;&amp; m_document-&gt;body()-&gt;renderer();
-        bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet;
-        if (!hasRendering &amp;&amp; !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, request, charset };
-            m_pendingPreloads.append(pendingPreload);
-            return;
-        }
-    }
</del><span class="cx">     requestPreload(type, request, charset);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -848,6 +849,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_pendingPreloads.isEmpty() || !m_document-&gt;body() || !m_document-&gt;body()-&gt;renderer())
</span><span class="cx">         return;
</span><ins>+#if PLATFORM(IOS)
+    // We always preload resources on iOS. See &lt;https://bugs.webkit.org/show_bug.cgi?id=91276&gt;.
+    // So, we should never have any pending preloads.
+    // FIXME: We should look to avoid compiling this code entirely when building for iOS.
+    ASSERT_NOT_REACHED();
+#endif
</ins><span class="cx">     while (!m_pendingPreloads.isEmpty()) {
</span><span class="cx">         PendingPreload preload = m_pendingPreloads.takeFirst();
</span><span class="cx">         // Don't request preload if the resource already loaded normally (this will result in double load if the page is being reloaded with cached results ignored).
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -120,7 +120,9 @@
</span><span class="cx">     void clearDocumentLoader() { m_documentLoader = 0; }
</span><span class="cx"> 
</span><span class="cx">     void removeCachedResource(CachedResource*) const;
</span><del>-    void loadDone(CachedResource*);
</del><ins>+
+    void loadDone(CachedResource*, bool shouldPerformPostLoadActions = true);
+
</ins><span class="cx">     void garbageCollectDocumentResources();
</span><span class="cx">     
</span><span class="cx">     void incrementRequestCount(const CachedResource*);
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheMemoryCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;BitmapImage.h&quot;
+#include &quot;CachedImage.h&quot;
</ins><span class="cx"> #include &quot;CachedResource.h&quot;
</span><span class="cx"> #include &quot;CachedResourceHandle.h&quot;
</span><span class="cx"> #include &quot;CrossThreadTask.h&quot;
</span><span class="lines">@@ -210,18 +212,73 @@
</span><span class="cx">     return m_capacity - deadCapacity();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MemoryCache::pruneLiveResources()
</del><ins>+#if USE(CF)
+// FIXME: Remove the USE(CF) once we either make NativeImagePtr a smart pointer on all platforms or
+// remove the usage of CFRetain() in MemoryCache::addImageToCache() so as to make the code platform-independent.
+bool MemoryCache::addImageToCache(NativeImagePtr image, const URL&amp; url, const String&amp; cachePartition)
</ins><span class="cx"> {
</span><ins>+    ASSERT(image);
+    removeImageFromCache(url, cachePartition); // Remove cache entry if it already exists.
+
+    RefPtr&lt;BitmapImage&gt; bitmapImage = BitmapImage::create(image, nullptr);
+    if (!bitmapImage)
+        return false;
+
+    CachedImageManual* cachedImage = new CachedImageManual(url, bitmapImage.get());
+    if (!cachedImage)
+        return false;
+
+    // Actual release of the CGImageRef is done in BitmapImage.
+    CFRetain(image);
+    cachedImage-&gt;addFakeClient();
+    cachedImage-&gt;setDecodedSize(bitmapImage-&gt;decodedSize());
+    cachedImage-&gt;resourceRequest().setCachePartition(cachePartition);
+    add(cachedImage);
+    return true;
+}
+
+void MemoryCache::removeImageFromCache(const URL&amp; url, const String&amp; cachePartition)
+{
+#if ENABLE(CACHE_PARTITIONING)
+    CachedResource* resource;
+    if (CachedResourceItem* item = m_resources.get(url))
+        resource = item-&gt;get(ResourceRequest::partitionName(cachePartition));
+    else
+        resource = nullptr;
+#else
+    UNUSED_PARAM(cachePartition);
+    CachedResource* resource = m_resources.get(url);
+#endif
+    if (!resource)
+        return;
+
+    // A resource exists and is not a manually cached image, so just remove it.
+    if (!resource-&gt;isImage() || !static_cast&lt;CachedImage*&gt;(resource)-&gt;isManual()) {
+        evict(resource);
+        return;
+    }
+
+    // Removing the last client of a CachedImage turns the resource
+    // into a dead resource which will eventually be evicted when
+    // dead resources are pruned. That might be immediately since
+    // removing the last client triggers a MemoryCache::prune, so the
+    // resource may be deleted after this call.
+    static_cast&lt;CachedImageManual*&gt;(resource)-&gt;removeFakeClient();
+}
+#endif
+
+void MemoryCache::pruneLiveResources(bool shouldDestroyDecodedDataForAllLiveResources)
+{
</ins><span class="cx">     if (!m_pruneEnabled)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned capacity = liveCapacity();
</del><ins>+    unsigned capacity = shouldDestroyDecodedDataForAllLiveResources ? 0 : liveCapacity();
</ins><span class="cx">     if (capacity &amp;&amp; m_liveSize &lt;= capacity)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     unsigned targetSize = static_cast&lt;unsigned&gt;(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again.
</span><span class="cx"> 
</span><del>-    pruneLiveResourcesToSize(targetSize);
</del><ins>+    pruneLiveResourcesToSize(targetSize, shouldDestroyDecodedDataForAllLiveResources);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MemoryCache::pruneLiveResourcesToPercentage(float prunePercentage)
</span><span class="lines">@@ -238,7 +295,7 @@
</span><span class="cx">     pruneLiveResourcesToSize(targetSize);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MemoryCache::pruneLiveResourcesToSize(unsigned targetSize)
</del><ins>+void MemoryCache::pruneLiveResourcesToSize(unsigned targetSize, bool shouldDestroyDecodedDataForAllLiveResources)
</ins><span class="cx"> {
</span><span class="cx">     if (m_inPruneResources)
</span><span class="cx">         return;
</span><span class="lines">@@ -263,7 +320,7 @@
</span><span class="cx">         if (current-&gt;isLoaded() &amp;&amp; current-&gt;decodedSize()) {
</span><span class="cx">             // Check to see if the remaining resources are too new to prune.
</span><span class="cx">             double elapsedTime = currentTime - current-&gt;m_lastDecodedAccessTime;
</span><del>-            if (elapsedTime &lt; cMinDelayBeforeLiveDecodedPrune)
</del><ins>+            if (!shouldDestroyDecodedDataForAllLiveResources &amp;&amp; elapsedTime &lt; cMinDelayBeforeLiveDecodedPrune)
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><span class="cx">             if (current-&gt;decodedDataIsPurgeable()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheMemoryCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/MemoryCache.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/MemoryCache.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #ifndef Cache_h
</span><span class="cx"> #define Cache_h
</span><span class="cx"> 
</span><ins>+#include &quot;NativeImagePtr.h&quot;
</ins><span class="cx"> #include &quot;SecurityOriginHash.h&quot;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="lines">@@ -187,10 +188,27 @@
</span><span class="cx">     unsigned liveSize() const { return m_liveSize; }
</span><span class="cx">     unsigned deadSize() const { return m_deadSize; }
</span><span class="cx"> 
</span><ins>+#if USE(CF)
+    // FIXME: Remove the USE(CF) once we either make NativeImagePtr a smart pointer on all platforms or
+    // remove the usage of CFRetain() in MemoryCache::addImageToCache() so as to make the code platform-independent.
+    bool addImageToCache(NativeImagePtr, const URL&amp;, const String&amp; cachePartition);
+    void removeImageFromCache(const URL&amp;, const String&amp; cachePartition);
+#endif
+
+    // pruneDead*() - Flush decoded and encoded data from resources not referenced by Web pages.
+    // pruneLive*() - Flush decoded data from resources still referenced by Web pages.
+    void pruneDeadResources(); // Automatically decide how much to prune.
+    void pruneLiveResources(bool shouldDestroyDecodedDataForAllLiveResources = false);
+
</ins><span class="cx"> private:
</span><ins>+    void pruneDeadResourcesToPercentage(float prunePercentage); // Prune to % current size
+    void pruneLiveResourcesToPercentage(float prunePercentage);
+    void pruneDeadResourcesToSize(unsigned targetSize);
+    void pruneLiveResourcesToSize(unsigned targetSize, bool shouldDestroyDecodedDataForAllLiveResources = false);
+
</ins><span class="cx">     MemoryCache();
</span><span class="cx">     ~MemoryCache(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons.
</span><del>-       
</del><ins>+
</ins><span class="cx">     LRUList* lruListFor(CachedResource*);
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     void dumpStats();
</span><span class="lines">@@ -200,15 +218,6 @@
</span><span class="cx">     unsigned liveCapacity() const;
</span><span class="cx">     unsigned deadCapacity() const;
</span><span class="cx"> 
</span><del>-    // pruneDead*() - Flush decoded and encoded data from resources not referenced by Web pages.
-    // pruneLive*() - Flush decoded data from resources still referenced by Web pages.
-    void pruneDeadResources(); // Automatically decide how much to prune.
-    void pruneLiveResources();
-    void pruneDeadResourcesToPercentage(float prunePercentage); // Prune to % current size
-    void pruneLiveResourcesToPercentage(float prunePercentage);
-    void pruneDeadResourcesToSize(unsigned targetSize);
-    void pruneLiveResourcesToSize(unsigned targetSize);
-
</del><span class="cx">     bool makeResourcePurgeable(CachedResource*);
</span><span class="cx">     void evict(CachedResource*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercfSubresourceLoaderCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;SubresourceLoader.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CachedResource.h&quot;
</ins><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -32,8 +33,8 @@
</span><span class="cx"> #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx"> void SubresourceLoader::didReceiveDataArray(CFArrayRef dataArray)
</span><span class="cx"> {
</span><del>-    // 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.
</del><ins>+    // 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 &lt;rdar://problem/3266216&gt;.
</ins><span class="cx">     Ref&lt;SubresourceLoader&gt; protect(*this);
</span><span class="cx"> 
</span><span class="cx">     ResourceLoader::didReceiveDataArray(dataArray);
</span><span class="lines">@@ -46,8 +47,19 @@
</span><span class="cx">     if (!m_loadingMultipartContent) {
</span><span class="cx">         CFIndex arrayCount = CFArrayGetCount(dataArray);
</span><span class="cx">         for (CFIndex i = 0; i &lt; arrayCount; ++i)  {
</span><del>-            CFDataRef data = reinterpret_cast&lt;CFDataRef&gt;(CFArrayGetValueAtIndex(dataArray, i));
-            sendDataToResource(reinterpret_cast&lt;const char *&gt;(CFDataGetBytePtr(data)), static_cast&lt;int&gt;(CFDataGetLength(data)));
</del><ins>+            // A previous iteration of this loop might have resulted in the load
+            // being cancelled. Bail out if we no longer have a cached resource.
+            if (!m_resource)
+                return;
+            if (ResourceBuffer* resourceData = this-&gt;resourceData())
+                m_resource-&gt;addDataBuffer(resourceData);
+            else {
+                CFDataRef cfData = reinterpret_cast&lt;CFDataRef&gt;(CFArrayGetValueAtIndex(dataArray, i));
+                const char* data = reinterpret_cast&lt;const char *&gt;(CFDataGetBytePtr(cfData));
+                CFIndex length = CFDataGetLength(cfData);
+                ASSERT(length &lt;= std::numeric_limits&lt;CFIndex&gt;::max());
+                m_resource-&gt;addData(data, static_cast&lt;unsigned&gt;(length));
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadermacDocumentLoaderMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -30,9 +30,11 @@
</span><span class="cx"> #include &quot;DocumentLoader.h&quot;
</span><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><span class="cx"> #include &quot;ResourceLoader.h&quot;
</span><ins>+#include &lt;wtf/SchedulePair.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static void scheduleAll(const ResourceLoaderSet&amp; loaders, SchedulePair* pair)
</span><span class="cx"> {
</span><span class="cx">     const ResourceLoaderSet copy = loaders;
</span><span class="lines">@@ -50,23 +52,32 @@
</span><span class="cx">         if (ResourceHandle* handle = (*it)-&gt;handle())
</span><span class="cx">             handle-&gt;unschedule(pair);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> void DocumentLoader::schedule(SchedulePair* pair)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     if (mainResourceLoader() &amp;&amp; mainResourceLoader()-&gt;handle())
</span><span class="cx">         mainResourceLoader()-&gt;handle()-&gt;schedule(pair);
</span><span class="cx">     scheduleAll(m_subresourceLoaders, pair);
</span><span class="cx">     scheduleAll(m_plugInStreamLoaders, pair);
</span><span class="cx">     scheduleAll(m_multipartSubresourceLoaders, pair);
</span><ins>+#else
+    UNUSED_PARAM(pair);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DocumentLoader::unschedule(SchedulePair* pair)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     if (mainResourceLoader() &amp;&amp; mainResourceLoader()-&gt;handle())
</span><span class="cx">         mainResourceLoader()-&gt;handle()-&gt;unschedule(pair);
</span><span class="cx">     unscheduleAll(m_subresourceLoaders, pair);
</span><span class="cx">     unscheduleAll(m_plugInStreamLoaders, pair);
</span><span class="cx">     unscheduleAll(m_multipartSubresourceLoaders, pair);
</span><ins>+#else
+    UNUSED_PARAM(pair);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsBitmapImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (160840 => 160841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/BitmapImage.h        2013-12-19 18:03:29 UTC (rev 160840)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h        2013-12-19 18:10:07 UTC (rev 160841)
</span><span class="lines">@@ -125,6 +125,8 @@
</span><span class="cx">     IntSize currentFrameSize() const;
</span><span class="cx">     virtual bool getHotSpot(IntPoint&amp;) const OVERRIDE;
</span><span class="cx"> 
</span><ins>+    unsigned decodedSize() const { return m_decodedSize; }
+
</ins><span class="cx">     virtual bool dataChanged(bool allDataReceived) OVERRIDE;
</span><span class="cx">     virtual String filenameExtension() const OVERRIDE;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>