Diff
Modified: trunk/LayoutTests/ChangeLog (182015 => 182016)
--- trunk/LayoutTests/ChangeLog 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/LayoutTests/ChangeLog 2015-03-26 17:45:12 UTC (rev 182016)
@@ -1,3 +1,19 @@
+2015-03-26 Brady Eidson <beid...@apple.com>
+
+ Apply ContentExtension actions after redirects.
+ <rdar://problem/20062613> and https://bugs.webkit.org/show_bug.cgi?id=143055
+
+ Reviewed by Alex Christensen.
+
+ * http/tests/contentextensions/loading/main-resource-redirect-blocked-expected.txt: Added.
+ * http/tests/contentextensions/loading/main-resource-redirect-blocked.php: Added.
+ * http/tests/contentextensions/loading/main-resource-redirect-blocked.php.json: Added.
+ * http/tests/contentextensions/loading/resources/main-resource-redirect-blocked-target.html: Added.
+ * http/tests/contentextensions/resources/subresource-redirect.php: Added.
+ * http/tests/contentextensions/subresource-redirect-blocked-expected.txt: Added.
+ * http/tests/contentextensions/subresource-redirect-blocked.html: Added.
+ * http/tests/contentextensions/subresource-redirect-blocked.html.json: Added.
+
2015-03-26 Michael Saboff <msab...@apple.com>
js/promises-tests/promises-tests-2-3-3.html sometimes crashes under DFG::SpeculativeJIT::compile
Added: trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked-expected.txt (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked-expected.txt 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,3 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didFailProvisionalLoadWithError
+main frame - (kWKErrorCodeCannotShowURL)
Added: trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,4 @@
+<?php
+ header('Location: resources/main-resource-redirect-blocked-target.html');
+ header('HTTP/1.0 302 Found');
+?>
Added: trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php.json (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php.json (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php.json 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,10 @@
+[
+ {
+ "action": {
+ "type": "block"
+ },
+ "trigger": {
+ "url-filter": ".*main-resource-redirect-blocked-target.html"
+ }
+ }
+]
Added: trunk/LayoutTests/http/tests/contentextensions/loading/resources/main-resource-redirect-blocked-target.html (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/loading/resources/main-resource-redirect-blocked-target.html (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/loading/resources/main-resource-redirect-blocked-target.html 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1 @@
+This page should never actually load.
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/contentextensions/resources/subresource-redirect.php (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/resources/subresource-redirect.php (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/resources/subresource-redirect.php 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,4 @@
+<?php
+ header('Location: http://127.0.0.1:8000/resources/square128.png');
+ header('HTTP/1.0 302 Found');
+?>
Added: trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked-expected.txt (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked-expected.txt 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (0,0) size 155x18
+ text run at (0,0) width 155: "This page has an image."
+ RenderBR {BR} at (154,14) size 1x0
+ RenderText {#text} at (0,18) size 415x18
+ text run at (0,18) width 415: "The image load should be blocked by the content extension filter"
+ RenderBR {BR} at (414,32) size 1x0
+ RenderImage {IMG} at (0,36) size 20x20
+ RenderText {#text} at (0,0) size 0x0
Added: trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,3 @@
+This page has an image.<br>
+The image load should be blocked by the content extension filter<br>
+<img src=""
Added: trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html.json (0 => 182016)
--- trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html.json (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html.json 2015-03-26 17:45:12 UTC (rev 182016)
@@ -0,0 +1,10 @@
+[
+ {
+ "action": {
+ "type": "block"
+ },
+ "trigger": {
+ "url-filter": ".*square"
+ }
+ }
+]
Modified: trunk/Source/WebCore/ChangeLog (182015 => 182016)
--- trunk/Source/WebCore/ChangeLog 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/ChangeLog 2015-03-26 17:45:12 UTC (rev 182016)
@@ -1,3 +1,50 @@
+2015-03-26 Brady Eidson <beid...@apple.com>
+
+ Apply ContentExtension actions after redirects.
+ <rdar://problem/20062613> and https://bugs.webkit.org/show_bug.cgi?id=143055
+
+ Reviewed by Alex Christensen.
+
+ Tests: http/tests/contentextensions/loading/main-resource-redirect-blocked.php
+ http/tests/contentextensions/subresource-redirect-blocked.html
+
+ This patch moves the "run a URL against the content extension" code from CachedResourceLoader to
+ the ContentExtensionsBackend.
+
+ That allows it to be shared between the CachedResourceLoader where loads are initiated and
+ ResourceLoader where redirects are handled.
+
+ * contentextensions/ContentExtension.cpp:
+ (WebCore::ContentExtensions::ContentExtension::globalDisplayNoneStyleSheet):
+
+ * contentextensions/ContentExtensionsBackend.cpp:
+ (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
+ (WebCore::ContentExtensions::ContentExtensionsBackend::displayNoneCSSRule):
+ * contentextensions/ContentExtensionsBackend.h:
+
+ * loader/NetscapePlugInStreamLoader.cpp:
+ (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
+
+ * loader/ResourceLoadInfo.h:
+
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::ResourceLoader):
+ (WebCore::ResourceLoader::willSendRequest):
+ * loader/ResourceLoader.h:
+
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::SubresourceLoader):
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+
+ * page/UserContentController.cpp:
+ (WebCore::UserContentController::processContentExtensionRulesForLoad):
+ (WebCore::UserContentController::actionsForResourceLoad): Deleted.
+ (WebCore::UserContentController::globalDisplayNoneStyleSheet): Deleted.
+ (WebCore::UserContentController::displayNoneCSSRule): Deleted.
+ * page/UserContentController.h:
+
2015-03-26 Myles C. Maxfield <mmaxfi...@apple.com>
Crash when laying out (char)0
Modified: trunk/Source/WebCore/contentextensions/ContentExtension.cpp (182015 => 182016)
--- trunk/Source/WebCore/contentextensions/ContentExtension.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/contentextensions/ContentExtension.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -27,8 +27,8 @@
#include "ContentExtension.h"
#include "CompiledContentExtension.h"
+#include "ContentExtensionsBackend.h"
#include "StyleSheetContents.h"
-#include "UserContentController.h"
#include <wtf/text/StringBuilder.h>
#if ENABLE(CONTENT_EXTENSIONS)
@@ -62,7 +62,7 @@
StringBuilder css;
for (auto& selector : selectors) {
css.append(selector);
- css.append(UserContentController::displayNoneCSSRule());
+ css.append(ContentExtensionsBackend::displayNoneCSSRule());
}
m_globalDisplayNoneStyleSheet = StyleSheetContents::create();
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (182015 => 182016)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -31,8 +31,14 @@
#include "CompiledContentExtension.h"
#include "ContentExtension.h"
#include "DFABytecodeInterpreter.h"
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "Frame.h"
+#include "MainFrame.h"
#include "ResourceLoadInfo.h"
#include "URL.h"
+#include "UserContentController.h"
+#include <wtf/NeverDestroyed.h>
#include <wtf/text/CString.h>
namespace WebCore {
@@ -110,6 +116,73 @@
return contentExtension ? contentExtension->globalDisplayNoneStyleSheet() : nullptr;
}
+void ContentExtensionsBackend::processContentExtensionRulesForLoad(ResourceRequest& request, ResourceType resourceType, DocumentLoader& initiatingDocumentLoader)
+{
+ Document* currentDocument = nullptr;
+ URL mainDocumentURL;
+
+ if (initiatingDocumentLoader.frame()) {
+ currentDocument = initiatingDocumentLoader.frame()->document();
+
+ if (Document* mainDocument = initiatingDocumentLoader.frame()->mainFrame().document())
+ mainDocumentURL = mainDocument->url();
+ }
+
+ ResourceLoadInfo resourceLoadInfo = { request.url(), mainDocumentURL, resourceType };
+ Vector<ContentExtensions::Action> actions = actionsForResourceLoad(resourceLoadInfo);
+
+ StringBuilder css;
+ bool willBlockLoad = false;
+ for (const auto& action : actions) {
+ switch (action.type()) {
+ case ContentExtensions::ActionType::BlockLoad:
+ willBlockLoad = true;
+ break;
+ case ContentExtensions::ActionType::BlockCookies:
+ request.setAllowCookies(false);
+ break;
+ case ContentExtensions::ActionType::CSSDisplayNoneSelector:
+ css.append(action.stringArgument());
+ css.append(displayNoneCSSRule());
+ break;
+ case ContentExtensions::ActionType::CSSDisplayNoneStyleSheet: {
+ StyleSheetContents* styleSheetContents = globalDisplayNoneStyleSheet(action.stringArgument());
+ if (styleSheetContents) {
+ if (resourceType == ResourceType::Document)
+ initiatingDocumentLoader.addPendingContentExtensionSheet(action.stringArgument(), *styleSheetContents);
+ else if (currentDocument)
+ currentDocument->styleSheetCollection().maybeAddContentExtensionSheet(action.stringArgument(), *styleSheetContents);
+ }
+ break;
+ }
+ case ContentExtensions::ActionType::IgnorePreviousRules:
+ case ContentExtensions::ActionType::InvalidAction:
+ RELEASE_ASSERT_NOT_REACHED();
+ }
+ }
+
+ if (css.length()) {
+ Ref<StyleSheetContents> styleSheet = StyleSheetContents::create();
+ styleSheet->setIsUserStyleSheet(true);
+
+ if (styleSheet->parseString(css.toString())) {
+ if (resourceType == ResourceType::Document)
+ initiatingDocumentLoader.addPendingContentExtensionSheet(styleSheet);
+ else if (currentDocument)
+ currentDocument->styleSheetCollection().addUserSheet(WTF::move(styleSheet));
+ }
+ }
+
+ if (willBlockLoad)
+ request = ResourceRequest();
+}
+
+const String& ContentExtensionsBackend::displayNoneCSSRule()
+{
+ static NeverDestroyed<const String> rule(ASCIILiteral("{display:none !important;}\n"));
+ return rule;
+}
+
} // namespace ContentExtensions
} // namespace WebCore
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h (182015 => 182016)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h 2015-03-26 17:45:12 UTC (rev 182016)
@@ -36,6 +36,8 @@
namespace WebCore {
+class DocumentLoader;
+class ResourceRequest;
class URL;
struct ResourceLoadInfo;
@@ -63,6 +65,10 @@
WEBCORE_EXPORT Vector<Action> actionsForResourceLoad(const ResourceLoadInfo&) const;
StyleSheetContents* globalDisplayNoneStyleSheet(const String& identifier) const;
+ void processContentExtensionRulesForLoad(ResourceRequest&, ResourceType, DocumentLoader& initiatingDocumentLoader);
+
+ static const String& displayNoneCSSRule();
+
private:
HashMap<String, RefPtr<ContentExtension>> m_contentExtensions;
};
Modified: trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp (182015 => 182016)
--- trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -34,12 +34,19 @@
#include "FrameLoaderClient.h"
#include <wtf/Ref.h>
+#if ENABLE(CONTENT_EXTENSIONS)
+#include "ResourceLoadInfo.h"
+#endif
+
namespace WebCore {
NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
: ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo))
, m_client(client)
{
+#if ENABLE(CONTENT_EXTENSIONS)
+ m_resourceType = ResourceType::PlugInStream;
+#endif
}
NetscapePlugInStreamLoader::~NetscapePlugInStreamLoader()
Modified: trunk/Source/WebCore/loader/ResourceLoadInfo.h (182015 => 182016)
--- trunk/Source/WebCore/loader/ResourceLoadInfo.h 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/loader/ResourceLoadInfo.h 2015-03-26 17:45:12 UTC (rev 182016)
@@ -41,12 +41,13 @@
Raw = 0x0020,
SVGDocument = 0x0040,
Media = 0x0080,
+ PlugInStream = 0x0100,
};
enum class LoadType : uint16_t {
Invalid = 0x0000,
- FirstParty = 0x0100,
- ThirdParty = 0x0200,
+ FirstParty = 0x0200,
+ ThirdParty = 0x0400,
};
typedef uint16_t ResourceFlags;
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (182015 => 182016)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -52,6 +52,11 @@
#include "SharedBuffer.h"
#include <wtf/Ref.h>
+#if ENABLE(CONTENT_EXTENSIONS)
+#include "ResourceLoadInfo.h"
+#include "UserContentController.h"
+#endif
+
namespace WebCore {
ResourceLoader::ResourceLoader(Frame* frame, ResourceLoaderOptions options)
@@ -64,6 +69,9 @@
, m_defersLoading(frame->page()->defersLoading())
, m_options(options)
, m_isQuickLookResource(false)
+#if ENABLE(CONTENT_EXTENSIONS)
+ , m_resourceType(ResourceType::Invalid)
+#endif
{
}
@@ -267,7 +275,19 @@
Ref<ResourceLoader> protect(*this);
ASSERT(!m_reachedTerminalState);
-
+
+#if ENABLE(CONTENT_EXTENSIONS)
+ ASSERT(m_resourceType != ResourceType::Invalid);
+
+ if (frameLoader() && frameLoader()->frame().page() && frameLoader()->frame().page()->userContentController() && m_documentLoader)
+ frameLoader()->frame().page()->userContentController()->processContentExtensionRulesForLoad(request, m_resourceType, *m_documentLoader);
+
+ if (request.isNull()) {
+ didFail(cannotShowURLError());
+ return;
+ }
+#endif
+
// We need a resource identifier for all requests, even if FrameLoader is never going to see it (such as with CORS preflight requests).
bool createdResourceIdentifier = false;
if (!m_identifier) {
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (182015 => 182016)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2015-03-26 17:45:12 UTC (rev 182016)
@@ -52,6 +52,10 @@
class QuickLookHandle;
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+enum class ResourceType : uint16_t;
+#endif
+
class ResourceLoader : public RefCounted<ResourceLoader>, protected ResourceHandleClient {
public:
virtual ~ResourceLoader() = 0;
@@ -224,6 +228,11 @@
ResourceRequest m_deferredRequest;
ResourceLoaderOptions m_options;
bool m_isQuickLookResource;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+protected:
+ ResourceType m_resourceType;
+#endif
};
inline const ResourceResponse& ResourceLoader::response() const
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (182015 => 182016)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -50,6 +50,10 @@
#include <RuntimeApplicationChecksIOS.h>
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+#include "ResourceLoadInfo.h"
+#endif
+
namespace WebCore {
DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, subresourceLoaderCounter, ("SubresourceLoader"));
@@ -76,6 +80,9 @@
#ifndef NDEBUG
subresourceLoaderCounter.increment();
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+ m_resourceType = toResourceType(resource->type());
+#endif
}
SubresourceLoader::~SubresourceLoader()
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (182015 => 182016)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -508,63 +508,10 @@
return nullptr;
#if ENABLE(CONTENT_EXTENSIONS)
- URL mainDocumentURL;
- if (frame() && frame()->mainFrame().document())
- mainDocumentURL = frame()->mainFrame().document()->url();
+ if (frame() && frame()->mainFrame().page() && frame()->mainFrame().page()->userContentController() && m_documentLoader)
+ frame()->mainFrame().page()->userContentController()->processContentExtensionRulesForLoad(request.mutableResourceRequest(), toResourceType(type), *m_documentLoader);
- ResourceLoadInfo resourceLoadInfo = { url, mainDocumentURL, toResourceType(type) };
-
- Vector<ContentExtensions::Action> actions;
- UserContentController* userContentController = nullptr;
- if (frame() && frame()->mainFrame().page())
- userContentController = frame()->mainFrame().page()->userContentController();
-
- if (userContentController)
- actions = userContentController->actionsForResourceLoad(resourceLoadInfo);
-
- StringBuilder css;
- bool willBlockLoad = false;
- for (const auto& action : actions) {
- switch (action.type()) {
- case ContentExtensions::ActionType::BlockLoad:
- willBlockLoad = true;
- break;
- case ContentExtensions::ActionType::BlockCookies:
- request.mutableResourceRequest().setAllowCookies(false);
- break;
- case ContentExtensions::ActionType::CSSDisplayNoneSelector:
- css.append(action.stringArgument());
- css.append(UserContentController::displayNoneCSSRule());
- break;
- case ContentExtensions::ActionType::CSSDisplayNoneStyleSheet: {
- StyleSheetContents* styleSheetContents = userContentController->globalDisplayNoneStyleSheet(action.stringArgument());
- if (styleSheetContents) {
- if (type == CachedResource::MainResource && request.initiatingDocumentLoader())
- request.initiatingDocumentLoader()->addPendingContentExtensionSheet(action.stringArgument(), *styleSheetContents);
- else if (m_document)
- m_document->styleSheetCollection().maybeAddContentExtensionSheet(action.stringArgument(), *styleSheetContents);
- }
- break;
- }
- case ContentExtensions::ActionType::IgnorePreviousRules:
- case ContentExtensions::ActionType::InvalidAction:
- RELEASE_ASSERT_NOT_REACHED();
- }
- }
-
- if (css.length()) {
- Ref<StyleSheetContents> styleSheet = StyleSheetContents::create();
- styleSheet->setIsUserStyleSheet(true);
-
- if (styleSheet->parseString(css.toString())) {
- if (type == CachedResource::MainResource && request.initiatingDocumentLoader())
- request.initiatingDocumentLoader()->addPendingContentExtensionSheet(styleSheet);
- else if (m_document)
- m_document->styleSheetCollection().addUserSheet(WTF::move(styleSheet));
- }
- }
-
- if (willBlockLoad)
+ if (request.mutableResourceRequest().isNull())
return nullptr;
#endif
Modified: trunk/Source/WebCore/page/UserContentController.cpp (182015 => 182016)
--- trunk/Source/WebCore/page/UserContentController.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/page/UserContentController.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -33,7 +33,6 @@
#include "ResourceLoadInfo.h"
#include "UserScript.h"
#include "UserStyleSheet.h"
-#include <wtf/NeverDestroyed.h>
#if ENABLE(USER_MESSAGE_HANDLERS)
#include "UserMessageHandlerDescriptor.h"
@@ -205,28 +204,14 @@
m_contentExtensionBackend->removeAllContentExtensions();
}
-Vector<ContentExtensions::Action> UserContentController::actionsForResourceLoad(const ResourceLoadInfo& resourceLoadInfo)
+void UserContentController::processContentExtensionRulesForLoad(ResourceRequest& request, ResourceType resourceType, DocumentLoader& initiatingDocumentLoader)
{
if (!m_contentExtensionBackend)
- return Vector<ContentExtensions::Action>();
+ return;
- return m_contentExtensionBackend->actionsForResourceLoad(resourceLoadInfo);
+ m_contentExtensionBackend->processContentExtensionRulesForLoad(request, resourceType, initiatingDocumentLoader);
}
-StyleSheetContents* UserContentController::globalDisplayNoneStyleSheet(const String& identifier) const
-{
- if (!m_contentExtensionBackend)
- return nullptr;
-
- return m_contentExtensionBackend->globalDisplayNoneStyleSheet(identifier);
-}
-
-const String& UserContentController::displayNoneCSSRule()
-{
- static NeverDestroyed<const String> rule(ASCIILiteral("{display:none !important;}\n"));
- return rule;
-}
-
#endif
void UserContentController::removeAllUserContent()
Modified: trunk/Source/WebCore/page/UserContentController.h (182015 => 182016)
--- trunk/Source/WebCore/page/UserContentController.h 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Source/WebCore/page/UserContentController.h 2015-03-26 17:45:12 UTC (rev 182016)
@@ -39,12 +39,17 @@
namespace WebCore {
class DOMWrapperWorld;
+class DocumentLoader;
class Page;
+class ResourceRequest;
class StyleSheetContents;
class URL;
class UserScript;
class UserStyleSheet;
class UserMessageHandlerDescriptor;
+
+enum class ResourceType : uint16_t;
+
struct ResourceLoadInfo;
namespace ContentExtensions {
@@ -86,10 +91,8 @@
WEBCORE_EXPORT void addUserContentExtension(const String& name, RefPtr<ContentExtensions::CompiledContentExtension>);
WEBCORE_EXPORT void removeUserContentExtension(const String& name);
WEBCORE_EXPORT void removeAllUserContentExtensions();
-
- Vector<ContentExtensions::Action> actionsForResourceLoad(const ResourceLoadInfo&);
- StyleSheetContents* globalDisplayNoneStyleSheet(const String& identifier) const;
- static const String& displayNoneCSSRule();
+
+ void processContentExtensionRulesForLoad(ResourceRequest&, ResourceType, DocumentLoader& initiatingDocumentLoader);
#endif
private:
Modified: trunk/Tools/ChangeLog (182015 => 182016)
--- trunk/Tools/ChangeLog 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Tools/ChangeLog 2015-03-26 17:45:12 UTC (rev 182016)
@@ -1,3 +1,14 @@
+2015-03-26 Brady Eidson <beid...@apple.com>
+
+ Apply ContentExtension actions after redirects.
+ <rdar://problem/20062613> and https://bugs.webkit.org/show_bug.cgi?id=143055
+
+ Reviewed by Alex Christensen.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame): Dump the fact that the load error is kWKErrorCodeCannotShowURL
+ which is specifically interesting to a new test.
+
2015-03-26 Csaba Osztrogonác <o...@webkit.org>
[EFL] Disable building libseccomp on AArch64
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (182015 => 182016)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2015-03-26 17:29:53 UTC (rev 182015)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2015-03-26 17:45:12 UTC (rev 182016)
@@ -685,14 +685,17 @@
dumpLoadEvent(frame, "didReceiveServerRedirectForProvisionalLoadForFrame");
}
-void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
+void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error)
{
auto& injectedBundle = InjectedBundle::singleton();
if (!injectedBundle.isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks()) {
dumpLoadEvent(frame, "didFailProvisionalLoadWithError");
+ if (WKErrorGetErrorCode(error) == kWKErrorCodeCannotShowURL)
+ dumpLoadEvent(frame, "(kWKErrorCodeCannotShowURL)");
+ }
frameDidChangeLocation(frame);
}