Diff
Modified: trunk/Source/WebCore/ChangeLog (205406 => 205407)
--- trunk/Source/WebCore/ChangeLog 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebCore/ChangeLog 2016-09-03 19:58:28 UTC (rev 205407)
@@ -1,3 +1,17 @@
+2016-09-03 Brian Weinstein <[email protected]>
+
+ Consult with the FrameLoaderClient about whether or not content extensions should be enabled when loading this URL.
+ https://bugs.webkit.org/show_bug.cgi?id=161441
+
+ Reviewed by Darin Adler.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::startLoadingMainResource): If content extensions aren't already disabled, consult with the
+ FrameLoaderClient about whether or not we should use content extensions for this URL.
+ * loader/FrameLoaderClient.h: Add the FrameLoaderClient call to determine if we should use content extensions for a given
+ URL...
+ * loader/EmptyClients.h: ... And add a stub implementation.
+
2016-09-03 Michael Catanzaro <[email protected]>
Silence -Wparentheses warning triggered by r205266
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (205406 => 205407)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-09-03 19:58:28 UTC (rev 205407)
@@ -1478,6 +1478,11 @@
m_contentFilter = !m_substituteData.isValid() ? ContentFilter::create(*this) : nullptr;
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+ if (m_userContentExtensionsEnabled)
+ m_userContentExtensionsEnabled = frameLoader()->client().shouldUseContentExtensionsForURL(m_request.url());
+#endif
+
// FIXME: Is there any way the extra fields could have not been added by now?
// If not, it would be great to remove this line of code.
// Note that currently, some requests may have incorrect extra fields even if this function has been called,
Modified: trunk/Source/WebCore/loader/EmptyClients.h (205406 => 205407)
--- trunk/Source/WebCore/loader/EmptyClients.h 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2016-09-03 19:58:28 UTC (rev 205407)
@@ -303,6 +303,10 @@
void dispatchDidFinishLoad() override { }
void dispatchDidReachLayoutMilestone(LayoutMilestones) override { }
+#if ENABLE(CONTENT_EXTENSIONS)
+ bool shouldUseContentExtensionsForURL(const URL&) override { return true; }
+#endif
+
Frame* dispatchCreatePage(const NavigationAction&) override { return nullptr; }
void dispatchShow() override { }
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (205406 => 205407)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2016-09-03 19:58:28 UTC (rev 205407)
@@ -173,6 +173,10 @@
virtual void dispatchDidFinishDataDetection(NSArray *detectionResults) = 0;
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+ virtual bool shouldUseContentExtensionsForURL(const URL&) = 0;
+#endif
+
virtual void dispatchDidLayout() { }
virtual void dispatchDidReachLayoutMilestone(LayoutMilestones) { }
Modified: trunk/Source/WebKit/mac/ChangeLog (205406 => 205407)
--- trunk/Source/WebKit/mac/ChangeLog 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-09-03 19:58:28 UTC (rev 205407)
@@ -1,3 +1,12 @@
+2016-09-03 Brian Weinstein <[email protected]>
+
+ Implement a stub version of FrameLoaderClient::shouldUseContentExtensionsForURL.
+ https://bugs.webkit.org/show_bug.cgi?id=16144
+
+ Reviewed by Darin Adler.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+
2016-09-02 Beth Dakin <[email protected]>
Need to updateEditorState if an element change edit-ability without changing
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h (205406 => 205407)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h 2016-09-03 19:58:28 UTC (rev 205407)
@@ -118,6 +118,10 @@
void dispatchDidFinishLoad() override;
void dispatchDidReachLayoutMilestone(WebCore::LayoutMilestones) override;
+#if ENABLE(CONTENT_EXTENSIONS)
+ bool shouldUseContentExtensionsForURL(const WebCore::URL&) override { return true; }
+#endif
+
WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) override;
void dispatchShow() override;
Modified: trunk/Source/WebKit2/ChangeLog (205406 => 205407)
--- trunk/Source/WebKit2/ChangeLog 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit2/ChangeLog 2016-09-03 19:58:28 UTC (rev 205407)
@@ -1,3 +1,25 @@
+2016-09-03 Brian Weinstein <[email protected]>
+
+ Implement WebFrameLoaderClient::shouldUseContentExtensionsForURL and consult the InjectedBundlePageLoaderClient.
+ https://bugs.webkit.org/show_bug.cgi?id=161441
+
+ Reviewed by Darin Adler.
+
+ WebFrameLoaderClient::shouldUseContentExtensionsForURL only consults the injected bundle, because we don't want to
+ defer the loading of every main resource to consult with the UI Process about whether or not we should use content
+ extensions for the load.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h: Bump the latest version to WKBundlePageLoaderClientV9 and
+ add WKBundlePageShouldUseContentExtensionsForURLCallback.
+ * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+ (WebKit::InjectedBundlePageLoaderClient::shouldUseContentExtensionsForURL): Ask the client if we should use content
+ extensions for this URL.
+ * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::shouldUseContentExtensionsForURL): Only consult with the injected bundle about whether
+ or not we should use content extensions for this URL.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
2016-09-03 Joseph Pecoraro <[email protected]>
Web Inspector: Move WebKit2 WebInspector files to #pragma once
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h (205406 => 205407)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h 2016-09-03 19:58:28 UTC (rev 205407)
@@ -62,6 +62,7 @@
typedef void (*WKBundlePageWillLoadURLRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo);
typedef void (*WKBundlePageWillLoadDataRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo);
typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo);
+typedef bool (*WKBundlePageShouldUseContentExtensionsForURLCallback)(WKBundlePageRef page, WKURLRef url, const void *clientInfo);
typedef struct WKBundlePageLoaderClientBase {
int version;
@@ -464,4 +465,66 @@
WKBundlePageUserAgentForURLCallback userAgentForURL;
} WKBundlePageLoaderClientV8;
+typedef struct WKBundlePageLoaderClientV9 {
+ WKBundlePageLoaderClientBase base;
+
+ // Version 0.
+ WKBundlePageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame;
+ WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame;
+ WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame;
+ WKBundlePageDidCommitLoadForFrameCallback didCommitLoadForFrame;
+ WKBundlePageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame;
+ WKBundlePageDidFinishLoadForFrameCallback didFinishLoadForFrame;
+ WKBundlePageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame;
+ WKBundlePageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame;
+ WKBundlePageDidReceiveTitleForFrameCallback didReceiveTitleForFrame;
+ WKBundlePageDidFirstLayoutForFrameCallback didFirstLayoutForFrame;
+ WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame;
+ WKBundlePageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy;
+ WKBundlePageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame;
+ WKBundlePageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame;
+ WKBundlePageDidClearWindowObjectForFrameCallback didClearWindowObjectForFrame;
+ WKBundlePageDidCancelClientRedirectForFrameCallback didCancelClientRedirectForFrame;
+ WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame;
+ WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame;
+
+ // Version 1.
+ WKBundlePageDidLayoutForFrameCallback didLayoutForFrame;
+ void * didNewFirstVisuallyNonEmptyLayout_unavailable;
+ WKBundlePageDidDetectXSSForFrameCallback didDetectXSSForFrame;
+ WKBundlePageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem;
+ WKBundlePageGlobalObjectIsAvailableForFrameCallback globalObjectIsAvailableForFrame;
+ WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback willDisconnectDOMWindowExtensionFromGlobalObject;
+ WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback didReconnectDOMWindowExtensionToGlobalObject;
+ WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback willDestroyGlobalObjectForDOMWindowExtension;
+
+ // Version 2
+ WKBundlePageDidFinishProgressCallback didFinishProgress;
+ WKBundlePageShouldForceUniversalAccessFromLocalURLCallback shouldForceUniversalAccessFromLocalURL;
+
+ // Version 3
+ void * didReceiveIntentForFrame_unavailable;
+ void * registerIntentServiceForFrame_unavailable;
+
+ // Version 4
+ WKBundlePageDidLayoutCallback didLayout;
+
+ // Version 5
+ WKBundlePageFeaturesUsedInPageCallback featuresUsedInPage;
+
+ // Version 6
+ WKBundlePageWillLoadURLRequestCallback willLoadURLRequest;
+ WKBundlePageWillLoadDataRequestCallback willLoadDataRequest;
+
+ // Version 7
+ void * willDestroyFrame_unavailable;
+
+ // Version 8
+ WKBundlePageUserAgentForURLCallback userAgentForURL;
+
+ // Version 9
+ WKBundlePageShouldUseContentExtensionsForURLCallback shouldUseContentExtensionsForURL;
+} WKBundlePageLoaderClientV9;
+
+
#endif // WKBundlePageLoaderClient_h
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp (205406 => 205407)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp 2016-09-03 19:58:28 UTC (rev 205407)
@@ -356,5 +356,15 @@
WKStringRef userAgent = m_client.userAgentForURL(toAPI(frame), toAPI(url), m_client.base.clientInfo);
return toImpl(userAgent);
}
-
+
+#if ENABLE(CONTENT_EXTENSIONS)
+bool InjectedBundlePageLoaderClient::shouldUseContentExtensionsForURL(WebPage* page, API::URL* url) const
+{
+ if (!m_client.shouldUseContentExtensionsForURL)
+ return true;
+
+ return m_client.shouldUseContentExtensionsForURL(toAPI(page), toAPI(url), m_client.base.clientInfo);
+}
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h (205406 => 205407)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h 2016-09-03 19:58:28 UTC (rev 205407)
@@ -40,7 +40,7 @@
class Object;
template<> struct ClientTraits<WKBundlePageLoaderClientBase> {
- typedef std::tuple<WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8> Versions;
+ typedef std::tuple<WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8, WKBundlePageLoaderClientV9> Versions;
};
}
@@ -102,6 +102,10 @@
void willDestroyFrame(WebPage*, WebFrame*);
API::String* userAgentForURL(WebFrame*, API::URL*) const;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+ bool shouldUseContentExtensionsForURL(WebPage*, API::URL*) const;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (205406 => 205407)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2016-09-03 19:58:28 UTC (rev 205407)
@@ -635,6 +635,18 @@
}
}
+#if ENABLE(CONTENT_EXTENSIONS)
+bool WebFrameLoaderClient::shouldUseContentExtensionsForURL(const URL& url)
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return true;
+
+ // Just send the request to the injected bundle client because we don't have time to wait for a response from the UI Process.
+ return webPage->injectedBundleLoaderClient().shouldUseContentExtensionsForURL(webPage, API::URL::create(url.string()).ptr());
+}
+#endif
+
Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigationAction)
{
WebPage* webPage = m_frame->page();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (205406 => 205407)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2016-09-03 15:21:54 UTC (rev 205406)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2016-09-03 19:58:28 UTC (rev 205407)
@@ -105,6 +105,10 @@
void dispatchDidReachLayoutMilestone(WebCore::LayoutMilestones) override;
void dispatchDidLayout() override;
+#if ENABLE(CONTENT_EXTENSIONS)
+ bool shouldUseContentExtensionsForURL(const WebCore::URL&) override;
+#endif
+
WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) override;
void dispatchShow() override;