Diff
Modified: trunk/Source/WebCore/ChangeLog (189431 => 189432)
--- trunk/Source/WebCore/ChangeLog 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/ChangeLog 2015-09-05 08:47:22 UTC (rev 189432)
@@ -1,3 +1,46 @@
+2015-09-05 Joseph Pecoraro <[email protected]>
+
+ Add a new ResourceLoaderOption to avoid page defers loading mechanisms for inspector
+ https://bugs.webkit.org/show_bug.cgi?id=148727
+
+ Reviewed by Antti Koivisto.
+
+ This will be tested shortly by inspector tests.
+
+ * loader/ResourceLoaderOptions.h:
+ (WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
+ (WebCore::ResourceLoaderOptions::defersLoadingPolicy):
+ (WebCore::ResourceLoaderOptions::setDefersLoadingPolicy):
+ Add a new policy for defers loading. The default is to allow defers loading.
+
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::ResourceLoader):
+ (WebCore::ResourceLoader::init):
+ (WebCore::ResourceLoader::setDefersLoading):
+ Respect the defers loading policy whenever we would set defers loading status.
+
+ * inspector/InspectorResourceAgent.cpp:
+ (WebCore::InspectorResourceAgent::loadResource):
+ Switch from incorrectly changing the defersLoading state of the loader
+ to setting an option to disallow defers loading entirely for the loader.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::startLoadingMainResource):
+ * loader/MediaResourceLoader.cpp:
+ (WebCore::MediaResourceLoader::start):
+ * loader/NetscapePlugInStreamLoader.cpp:
+ (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
+ (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
+ * loader/icon/IconLoader.cpp:
+ (WebCore::IconLoader::startLoading):
+ * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
+ (WebCore::WebCoreAVCFResourceLoader::startLoading):
+ * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
+ (WebCore::WebCoreAVFResourceLoader::startLoading):
+ Add the new value to instance of the longhand ResourceLoaderOptions constructor.
+
2015-09-04 Myles C. Maxfield <[email protected]>
Rename members of CanvasRenderingContext2D::State
Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (189431 => 189432)
--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -704,6 +704,7 @@
ThreadableLoaderOptions options;
options.setSendLoadCallbacks(SendCallbacks); // So we remove this from m_hiddenRequestIdentifiers on completion.
options.setAllowCredentials(AllowStoredCredentials);
+ options.setDefersLoadingPolicy(DefersLoadingPolicy::DisallowDefersLoading); // So the request is never deferred.
options.crossOriginRequestPolicy = AllowCrossOriginRequests;
// InspectorThreadableLoaderClient deletes itself when the load completes.
@@ -715,8 +716,6 @@
return;
}
- loader->setDefersLoading(false);
-
// If the load already completed, inspectorThreadableLoaderClient will have been deleted and we will have already called the callback.
if (!callback->isActive())
return;
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -1433,7 +1433,7 @@
// If this is a reload the cache layer might have made the previous request conditional. DocumentLoader can't handle 304 responses itself.
request.makeUnconditional();
- static NeverDestroyed<ResourceLoaderOptions> mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, IncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck);
+ static NeverDestroyed<ResourceLoaderOptions> mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, IncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading);
CachedResourceRequest cachedResourceRequest(request, mainResourceLoadOptions);
cachedResourceRequest.setInitiator(*this);
m_mainResource = m_cachedResourceLoader->requestMainResource(cachedResourceRequest);
Modified: trunk/Source/WebCore/loader/MediaResourceLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/loader/MediaResourceLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -61,7 +61,7 @@
StoredCredentials allowCredentials = m_crossOriginMode.isNull() || equalIgnoringCase(m_crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
// ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
- CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, allowCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, corsPolicy, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck));
+ CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, allowCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, corsPolicy, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
if (!m_crossOriginMode.isNull())
updateRequestForAccessControl(cacheRequest.mutableResourceRequest(), m_document.securityOrigin(), allowCredentials);
Modified: trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -43,7 +43,7 @@
// FIXME: Skip Content Security Policy check when associated plugin element is in a user agent shadow tree.
// See <https://bugs.webkit.org/show_bug.cgi?id=146663>.
NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
- : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck))
+ : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading))
, m_client(client)
{
#if ENABLE(CONTENT_EXTENSIONS)
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -67,7 +67,7 @@
, m_reachedTerminalState(false)
, m_notifiedLoadComplete(false)
, m_cancellationStatus(NotCancelled)
- , m_defersLoading(frame->page()->defersLoading())
+ , m_defersLoading(options.defersLoadingPolicy() == DefersLoadingPolicy::AllowDefersLoading && frame->page()->defersLoading())
, m_options(options)
, m_isQuickLookResource(false)
#if ENABLE(CONTENT_EXTENSIONS)
@@ -135,7 +135,8 @@
}
#endif
- m_defersLoading = m_frame->page()->defersLoading();
+ m_defersLoading = m_options.defersLoadingPolicy() == DefersLoadingPolicy::AllowDefersLoading && m_frame->page()->defersLoading();
+
if (m_options.securityCheck() == DoSecurityCheck && !m_frame->document()->securityOrigin()->canDisplay(clientRequest.url())) {
FrameLoader::reportLocalLoadFailed(m_frame.get(), clientRequest.url().string());
releaseResources();
@@ -220,6 +221,9 @@
void ResourceLoader::setDefersLoading(bool defers)
{
+ if (m_options.defersLoadingPolicy() == DefersLoadingPolicy::DisallowDefersLoading)
+ return;
+
m_defersLoading = defers;
if (m_handle)
m_handle->setDefersLoading(defers);
Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (189431 => 189432)
--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2015-09-05 08:47:22 UTC (rev 189432)
@@ -71,6 +71,11 @@
DoPolicyCheck
};
+enum class DefersLoadingPolicy : uint8_t {
+ AllowDefersLoading,
+ DisallowDefersLoading
+};
+
struct ResourceLoaderOptions {
ResourceLoaderOptions()
: m_sendLoadCallbacks(DoNotSendCallbacks)
@@ -84,7 +89,7 @@
{
}
- ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacks, ContentSniffingPolicy sniffContent, DataBufferingPolicy dataBufferingPolicy, StoredCredentials allowCredentials, ClientCredentialPolicy credentialPolicy, SecurityCheckPolicy securityCheck, RequestOriginPolicy requestOriginPolicy, CertificateInfoPolicy certificateInfoPolicy, ContentSecurityPolicyImposition contentSecurityPolicyImposition)
+ ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacks, ContentSniffingPolicy sniffContent, DataBufferingPolicy dataBufferingPolicy, StoredCredentials allowCredentials, ClientCredentialPolicy credentialPolicy, SecurityCheckPolicy securityCheck, RequestOriginPolicy requestOriginPolicy, CertificateInfoPolicy certificateInfoPolicy, ContentSecurityPolicyImposition contentSecurityPolicyImposition, DefersLoadingPolicy defersLoadingPolicy)
: m_sendLoadCallbacks(sendLoadCallbacks)
, m_sniffContent(sniffContent)
, m_dataBufferingPolicy(dataBufferingPolicy)
@@ -94,6 +99,7 @@
, m_requestOriginPolicy(requestOriginPolicy)
, m_certificateInfoPolicy(certificateInfoPolicy)
, m_contentSecurityPolicyImposition(contentSecurityPolicyImposition)
+ , m_defersLoadingPolicy(defersLoadingPolicy)
{
}
@@ -115,6 +121,8 @@
void setCertificateInfoPolicy(CertificateInfoPolicy policy) { m_certificateInfoPolicy = policy; }
ContentSecurityPolicyImposition contentSecurityPolicyImposition() const { return m_contentSecurityPolicyImposition; }
void setContentSecurityPolicyImposition(ContentSecurityPolicyImposition imposition) { m_contentSecurityPolicyImposition = imposition; }
+ DefersLoadingPolicy defersLoadingPolicy() const { return m_defersLoadingPolicy; }
+ void setDefersLoadingPolicy(DefersLoadingPolicy defersLoadingPolicy) { m_defersLoadingPolicy = defersLoadingPolicy; }
unsigned m_sendLoadCallbacks : 1;
unsigned m_sniffContent : 1;
@@ -125,6 +133,7 @@
unsigned m_requestOriginPolicy : 2;
unsigned m_certificateInfoPolicy : 1; // Whether the response should include certificate info.
ContentSecurityPolicyImposition m_contentSecurityPolicyImposition { ContentSecurityPolicyImposition::DoPolicyCheck };
+ DefersLoadingPolicy m_defersLoadingPolicy { DefersLoadingPolicy::AllowDefersLoading };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -233,7 +233,7 @@
memoryCache.add(*userSheet);
// FIXME: loadResource calls setOwningCachedResourceLoader() if the resource couldn't be added to cache. Does this function need to call it, too?
- userSheet->load(*this, ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck));
+ userSheet->load(*this, ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
return userSheet;
}
@@ -1139,7 +1139,7 @@
const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
{
- static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck);
+ static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading);
return options;
}
Modified: trunk/Source/WebCore/loader/icon/IconLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/loader/icon/IconLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/loader/icon/IconLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -59,7 +59,7 @@
return;
// ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
- CachedResourceRequest request(ResourceRequest(m_frame.loader().icon().url()), ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForAnyCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck));
+ CachedResourceRequest request(ResourceRequest(m_frame.loader().icon().url()), ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForAnyCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
request.mutableResourceRequest().setPriority(ResourceLoadPriority::Low);
request.setInitiator(cachedResourceRequestInitiators().icon);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp (189431 => 189432)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp 2015-09-05 08:47:22 UTC (rev 189432)
@@ -72,7 +72,7 @@
URL requestURL = CFURLRequestGetURL(urlRequest.get());
// ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
- CachedResourceRequest request(ResourceRequest(requestURL), ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck));
+ CachedResourceRequest request(ResourceRequest(requestURL), ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
request.mutableResourceRequest().setPriority(ResourceLoadPriority::Low);
CachedResourceLoader* loader = m_parent->player()->cachedResourceLoader();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (189431 => 189432)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm 2015-09-05 07:44:35 UTC (rev 189431)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm 2015-09-05 08:47:22 UTC (rev 189432)
@@ -68,7 +68,7 @@
URL requestURL = [[m_avRequest.get() request] URL];
// ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
- CachedResourceRequest request(ResourceRequest(requestURL), ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck));
+ CachedResourceRequest request(ResourceRequest(requestURL), ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
request.mutableResourceRequest().setPriority(ResourceLoadPriority::Low);
CachedResourceLoader* loader = m_parent->player()->cachedResourceLoader();