Diff
Modified: trunk/LayoutTests/ChangeLog (194385 => 194386)
--- trunk/LayoutTests/ChangeLog 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/LayoutTests/ChangeLog 2015-12-23 10:04:44 UTC (rev 194386)
@@ -1,3 +1,14 @@
+2015-12-23 Chris Aljoudi <[email protected]> and Alex Christensen <[email protected]>
+
+ Content blockers should be able to promote http to https
+ https://bugs.webkit.org/show_bug.cgi?id=148966
+
+ Reviewed by Benjamin Poulain.
+
+ * http/tests/contentextensions/make-https-expected.txt: Added.
+ * http/tests/contentextensions/make-https.html: Added.
+ * http/tests/contentextensions/make-https.html.json: Added.
+
2015-12-22 Xabier Rodriguez Calvar <[email protected]>
[Streams API] Fix cosmetic things after importing spec tests
Added: trunk/LayoutTests/http/tests/contentextensions/make-https-expected.txt (0 => 194386)
--- trunk/LayoutTests/http/tests/contentextensions/make-https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/make-https-expected.txt 2015-12-23 10:04:44 UTC (rev 194386)
@@ -0,0 +1,28 @@
+http://127.0.0.1:8000/try_to_promote - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/try_to_promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+http://127.0.0.1:8000/contentextensions/make-https.html - didFinishLoading
+http://127.0.0.1:8000/try_to_promote - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/try_to_promote, http status code 404>
+http://127.0.0.1:8000/try_to_promote - didFinishLoading
+http://127.0.0.1/nope - willSendRequest <NSURLRequest URL http://127.0.0.1/nope, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+http://127.0.0.1/nope - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://127.0.0.1/nope">
+CONSOLE MESSAGE: line 30: Content blocker promoted URL from http://127.0.0.1/promote to https://127.0.0.1/promote
+https://127.0.0.1/promote - willSendRequest <NSURLRequest URL https://127.0.0.1/promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+https://127.0.0.1/promote - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "https://127.0.0.1/promote">
+CONSOLE MESSAGE: line 30: Content blocker promoted URL from http://127.0.0.1/promote to https://127.0.0.1/promote
+https://127.0.0.1/promote - willSendRequest <NSURLRequest URL https://127.0.0.1/promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+https://127.0.0.1/promote - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "https://127.0.0.1/promote">
+CONSOLE MESSAGE: line 30: Content blocker promoted URL from http://127.0.0.1/promote to https://127.0.0.1/promote
+https://127.0.0.1/promote - willSendRequest <NSURLRequest URL https://127.0.0.1/promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+https://127.0.0.1/promote - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "https://127.0.0.1/promote">
+http://127.0.0.1:443/try_to_promote - willSendRequest <NSURLRequest URL http://127.0.0.1:443/try_to_promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+http://127.0.0.1:443/try_to_promote - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://127.0.0.1:443/try_to_promote">
+http://127.0.0.1:1443/try_to_promote - willSendRequest <NSURLRequest URL http://127.0.0.1:1443/try_to_promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+http://127.0.0.1:1443/try_to_promote - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://127.0.0.1:1443/try_to_promote">
+CONSOLE MESSAGE: line 30: Content blocker promoted URL from http://promote/ to https://promote/
+https://promote/ - willSendRequest <NSURLRequest URL https://promote/, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+Blocked access to external URL https://promote/
+https://promote/ - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -999>
+protocol://try_to_promote - willSendRequest <NSURLRequest URL protocol://try_to_promote, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+protocol://try_to_promote - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1002, failing URL "protocol://try_to_promote">
+https://127.0.0.1/already_promoted - willSendRequest <NSURLRequest URL https://127.0.0.1/already_promoted, main document URL http://127.0.0.1:8000/contentextensions/make-https.html, http method GET> redirectResponse (null)
+https://127.0.0.1/already_promoted - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "https://127.0.0.1/already_promoted">
+URLs with http, port 80, and promote in the url should be promoted to https with port 443.
Added: trunk/LayoutTests/http/tests/contentextensions/make-https.html (0 => 194386)
--- trunk/LayoutTests/http/tests/contentextensions/make-https.html (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/make-https.html 2015-12-23 10:04:44 UTC (rev 194386)
@@ -0,0 +1,40 @@
+<head>
+<script>
+if(window.testRunner) {
+ testRunner.dumpResourceLoadCallbacks();
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+var testURLs = [
+ "http://127.0.0.1:8000/try_to_promote",
+ "http://127.0.0.1:80/nope",
+ "http://127.0.0.1:80/promote",
+ "http://127.0.0.1:/promote",
+ "http://127.0.0.1/promote",
+ "http://127.0.0.1:443/try_to_promote",
+ "http://127.0.0.1:1443/try_to_promote",
+ "http://promote",
+ "protocol://try_to_promote",
+ "https://127.0.0.1/already_promoted"
+];
+function bodyLoaded() {
+ var testImage = new Image();
+ var currentImageIndex = 0;
+ var runTest = function() {
+ if(currentImageIndex >= testURLs.length) {
+ if(window.testRunner) {
+ testRunner.notifyDone();
+ }
+ return;
+ }
+ testImage.src = ""
+ };
+ testImage.addEventListener("load", runTest);
+ testImage.addEventListener("error", runTest);
+ runTest();
+}
+</script>
+</head>
+<body _onload_="bodyLoaded();">
+URLs with http, port 80, and promote in the url should be promoted to https with port 443.
+</body>
Added: trunk/LayoutTests/http/tests/contentextensions/make-https.html.json (0 => 194386)
--- trunk/LayoutTests/http/tests/contentextensions/make-https.html.json (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/make-https.html.json 2015-12-23 10:04:44 UTC (rev 194386)
@@ -0,0 +1,10 @@
+[
+ {
+ "action": {
+ "type": "make-https"
+ },
+ "trigger": {
+ "url-filter": "promote"
+ }
+ }
+]
Modified: trunk/Source/WebCore/ChangeLog (194385 => 194386)
--- trunk/Source/WebCore/ChangeLog 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/ChangeLog 2015-12-23 10:04:44 UTC (rev 194386)
@@ -1,3 +1,33 @@
+2015-12-23 Chris Aljoudi <[email protected]> and Alex Christensen <[email protected]>
+
+ Content blockers should be able to promote http to https
+ https://bugs.webkit.org/show_bug.cgi?id=148966
+
+ Reviewed by Benjamin Poulain.
+
+ Test: http/tests/contentextensions/make-https.html
+
+ * contentextensions/ContentExtensionActions.h:
+ * contentextensions/ContentExtensionCompiler.cpp:
+ (WebCore::ContentExtensions::serializeActions):
+ * contentextensions/ContentExtensionParser.cpp:
+ (WebCore::ContentExtensions::loadAction):
+ * contentextensions/ContentExtensionRule.cpp:
+ (WebCore::ContentExtensions::Action::deserialize):
+ (WebCore::ContentExtensions::Action::deserializeType):
+ (WebCore::ContentExtensions::Action::serializedLength):
+ * contentextensions/ContentExtensionsBackend.cpp:
+ (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+ * platform/URL.cpp:
+ (WebCore::URL::isBlankURL):
+ (WebCore::defaultPortsMap):
+ (WebCore::defaultPortForProtocol):
+ (WebCore::isDefaultPortForProtocol):
+ (WebCore::portAllowed):
+ * platform/URL.h:
+
2015-12-22 Andy Estes <[email protected]>
Try to fix the iOS build after r194378
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionActions.h (194385 => 194386)
--- trunk/Source/WebCore/contentextensions/ContentExtensionActions.h 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionActions.h 2015-12-23 10:04:44 UTC (rev 194386)
@@ -40,6 +40,7 @@
CSSDisplayNoneSelector,
CSSDisplayNoneStyleSheet,
IgnorePreviousRules,
+ MakeHTTPS,
InvalidAction,
};
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (194385 => 194386)
--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -102,37 +102,26 @@
Vector<unsigned> actionLocations;
- // Block and BlockCookies do not need to be distinguishable. The order in which they are executed it irrelevant
- // since Block is a strict superset of BlockCookies.
- // Similarily, Block is a superset of CSSDisplayNone, and BlockCookies is independent from CSSDisplayNone.
- //
- // The only distinguisher is "IgnorePreviousRules".
- //
- // The trigger's Flags do not need to be distinguishable either. The way we use them is filtering the actions
- // based on the flag *after* matching.
- //
- // To reduce the number of unique actions, we keep track of the various action, indexed by their flag.
- // We only need to create new ones when encountering a IgnorePreviousRules.
- HashMap<uint32_t, uint32_t, DefaultHash<uint32_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> blockActionsMap;
- HashMap<uint32_t, uint32_t, DefaultHash<uint32_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> blockCookiesActionsMap;
+ // Order only matters because of IgnorePreviousRules. All other identical actions can be combined between each IgnorePreviousRules
+ // and CSSDisplayNone strings can be combined if their triggers are identical.
+ typedef HashMap<uint32_t, uint32_t, DefaultHash<uint32_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> ActionMap;
+ ActionMap blockLoadActionsMap;
+ ActionMap blockCookiesActionsMap;
PendingDisplayNoneActionsMap cssDisplayNoneActionsMap;
- HashMap<uint32_t, uint32_t, DefaultHash<uint32_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> ignorePreviousRuleActionsMap;
+ ActionMap ignorePreviousRuleActionsMap;
+ ActionMap makeHTTPSActionsMap;
for (unsigned ruleIndex = 0; ruleIndex < ruleList.size(); ++ruleIndex) {
const ContentExtensionRule& rule = ruleList[ruleIndex];
ActionType actionType = rule.action().type();
- RELEASE_ASSERT(actionType == ActionType::CSSDisplayNoneSelector
- || actionType == ActionType::BlockLoad
- || actionType == ActionType::BlockCookies
- || actionType == ActionType::IgnorePreviousRules);
-
if (actionType == ActionType::IgnorePreviousRules) {
resolvePendingDisplayNoneActions(actions, actionLocations, cssDisplayNoneActionsMap);
- blockActionsMap.clear();
+ blockLoadActionsMap.clear();
blockCookiesActionsMap.clear();
cssDisplayNoneActionsMap.clear();
+ makeHTTPSActionsMap.clear();
} else
ignorePreviousRuleActionsMap.clear();
@@ -150,22 +139,23 @@
ResourceFlags flags = rule.trigger().flags;
unsigned actionLocation = std::numeric_limits<unsigned>::max();
+
+ auto findOrMakeActionLocation = [&] (ActionMap& map)
+ {
+ const auto existingAction = map.find(flags);
+ if (existingAction == map.end()) {
+ actionLocation = actions.size();
+ actions.append(static_cast<SerializedActionByte>(actionType));
+ map.set(flags, actionLocation);
+ } else
+ actionLocation = existingAction->value;
+ };
switch (actionType) {
case ActionType::CSSDisplayNoneStyleSheet:
case ActionType::InvalidAction:
RELEASE_ASSERT_NOT_REACHED();
- case ActionType::IgnorePreviousRules: {
- const auto existingAction = ignorePreviousRuleActionsMap.find(flags);
- if (existingAction == ignorePreviousRuleActionsMap.end()) {
- actionLocation = actions.size();
- actions.append(static_cast<SerializedActionByte>(rule.action().type()));
- ignorePreviousRuleActionsMap.set(flags, actionLocation);
- } else
- actionLocation = existingAction->value;
- break;
- }
case ActionType::CSSDisplayNoneSelector: {
const auto addResult = cssDisplayNoneActionsMap.add(rule.trigger(), PendingDisplayNoneActions());
PendingDisplayNoneActions& pendingDisplayNoneActions = addResult.iterator->value;
@@ -175,27 +165,19 @@
actionLocation = std::numeric_limits<unsigned>::max();
break;
}
- case ActionType::BlockLoad: {
- const auto existingAction = blockActionsMap.find(flags);
- if (existingAction == blockActionsMap.end()) {
- actionLocation = actions.size();
- actions.append(static_cast<SerializedActionByte>(rule.action().type()));
- blockActionsMap.set(flags, actionLocation);
- } else
- actionLocation = existingAction->value;
+ case ActionType::IgnorePreviousRules:
+ findOrMakeActionLocation(ignorePreviousRuleActionsMap);
break;
- }
- case ActionType::BlockCookies: {
- const auto existingAction = blockCookiesActionsMap.find(flags);
- if (existingAction == blockCookiesActionsMap.end()) {
- actionLocation = actions.size();
- actions.append(static_cast<SerializedActionByte>(rule.action().type()));
- blockCookiesActionsMap.set(flags, actionLocation);
- } else
- actionLocation = existingAction->value;
+ case ActionType::BlockLoad:
+ findOrMakeActionLocation(blockLoadActionsMap);
break;
+ case ActionType::BlockCookies:
+ findOrMakeActionLocation(blockCookiesActionsMap);
+ break;
+ case ActionType::MakeHTTPS:
+ findOrMakeActionLocation(makeHTTPSActionsMap);
+ break;
}
- }
actionLocations.append(actionLocation);
}
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp (194385 => 194386)
--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -216,6 +216,8 @@
return { };
}
action = "" s);
+ } else if (actionType == "make-https") {
+ action = ""
} else
return ContentExtensionError::JSONInvalidActionType;
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp (194385 => 194386)
--- trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -49,6 +49,8 @@
return Action(ActionType::BlockLoad, location);
case ActionType::IgnorePreviousRules:
return Action(ActionType::IgnorePreviousRules, location);
+ case ActionType::MakeHTTPS:
+ return Action(ActionType::MakeHTTPS, location);
case ActionType::CSSDisplayNoneSelector: {
uint32_t headerLength = sizeof(ActionType) + sizeof(uint32_t) + sizeof(bool);
uint32_t stringStartIndex = location + headerLength;
@@ -79,6 +81,7 @@
case ActionType::BlockLoad:
case ActionType::IgnorePreviousRules:
case ActionType::CSSDisplayNoneSelector:
+ case ActionType::MakeHTTPS:
return type;
case ActionType::CSSDisplayNoneStyleSheet:
case ActionType::InvalidAction:
@@ -94,6 +97,7 @@
case ActionType::BlockCookies:
case ActionType::BlockLoad:
case ActionType::IgnorePreviousRules:
+ case ActionType::MakeHTTPS:
return sizeof(ActionType);
case ActionType::CSSDisplayNoneSelector: {
uint32_t headerLength = sizeof(ActionType) + sizeof(uint32_t) + sizeof(bool);
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (194385 => 194386)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -36,6 +36,7 @@
#include "DocumentLoader.h"
#include "ExtensionStyleSheets.h"
#include "Frame.h"
+#include "FrameLoaderClient.h"
#include "MainFrame.h"
#include "ResourceLoadInfo.h"
#include "URL.h"
@@ -189,6 +190,25 @@
}
break;
}
+ case ContentExtensions::ActionType::MakeHTTPS: {
+ const URL originalURL = request.url();
+ if (originalURL.protocolIs("http") && (!originalURL.hasPort() || isDefaultPortForProtocol(originalURL.port(), originalURL.protocol()))) {
+ URL newURL = originalURL;
+ newURL.setProtocol("https");
+ if (originalURL.hasPort())
+ newURL.setPort(defaultPortForProtocol("https"));
+ request.setURL(newURL);
+
+ if (resourceType == ResourceType::Document && initiatingDocumentLoader.isLoadingMainResource()) {
+ // This is to make sure the correct 'new' URL shows in the location bar.
+ initiatingDocumentLoader.request().setURL(newURL);
+ initiatingDocumentLoader.frameLoader()->client().dispatchDidChangeProvisionalURL();
+ }
+ if (currentDocument)
+ currentDocument->addConsoleMessage(MessageSource::ContentBlocker, MessageLevel::Info, makeString("Content blocker promoted URL from ", originalURL.string(), " to ", newURL.string()));
+ }
+ break;
+ }
case ContentExtensions::ActionType::IgnorePreviousRules:
case ContentExtensions::ActionType::InvalidAction:
RELEASE_ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (194385 => 194386)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -549,6 +549,8 @@
}
return nullptr;
}
+ url = "" // The content extension could have changed it from http to https.
+ url = "" // Might need to remove fragment identifier again.
}
#endif
Modified: trunk/Source/WebCore/platform/URL.cpp (194385 => 194386)
--- trunk/Source/WebCore/platform/URL.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/platform/URL.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -35,6 +35,7 @@
#include <unicode/uidna.h>
#include <wtf/HashMap.h>
#include <wtf/HexNumber.h>
+#include <wtf/NeverDestroyed.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
@@ -1989,20 +1990,28 @@
return protocolIs("about");
}
+typedef HashMap<String, unsigned short, CaseFoldingHash> DefaultPortsMap;
+static const DefaultPortsMap& defaultPortsMap()
+{
+ static NeverDestroyed<const DefaultPortsMap> defaultPortsMap(DefaultPortsMap({
+ { "http", 80 },
+ { "https", 443 },
+ { "ftp", 21 },
+ { "ftps", 990 }
+ }));
+ return defaultPortsMap.get();
+}
+unsigned short defaultPortForProtocol(const String& protocol)
+{
+ return defaultPortsMap().get(protocol);
+}
+
bool isDefaultPortForProtocol(unsigned short port, const String& protocol)
{
if (protocol.isEmpty())
return false;
- typedef HashMap<String, unsigned, CaseFoldingHash> DefaultPortsMap;
- DEPRECATED_DEFINE_STATIC_LOCAL(DefaultPortsMap, defaultPorts, ());
- if (defaultPorts.isEmpty()) {
- defaultPorts.set("http", 80);
- defaultPorts.set("https", 443);
- defaultPorts.set("ftp", 21);
- defaultPorts.set("ftps", 990);
- }
- return defaultPorts.get(protocol) == port;
+ return defaultPortForProtocol(protocol) == port;
}
bool portAllowed(const URL& url)
Modified: trunk/Source/WebCore/platform/URL.h (194385 => 194386)
--- trunk/Source/WebCore/platform/URL.h 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Source/WebCore/platform/URL.h 2015-12-23 10:04:44 UTC (rev 194386)
@@ -246,6 +246,7 @@
WEBCORE_EXPORT bool protocolIsJavaScript(const String& url);
WEBCORE_EXPORT bool protocolIsInHTTPFamily(const String& url);
+unsigned short defaultPortForProtocol(const String& protocol);
bool isDefaultPortForProtocol(unsigned short port, const String& protocol);
bool portAllowed(const URL&); // Blacklist ports that should never be used for Web resources.
Modified: trunk/Tools/ChangeLog (194385 => 194386)
--- trunk/Tools/ChangeLog 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Tools/ChangeLog 2015-12-23 10:04:44 UTC (rev 194386)
@@ -1,3 +1,14 @@
+2015-12-23 Chris Aljoudi <[email protected]> and Alex Christensen <[email protected]>
+
+ Content blockers should be able to promote http to https
+ https://bugs.webkit.org/show_bug.cgi?id=148966
+
+ Reviewed by Benjamin Poulain.
+
+ * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
+ (WebCore::ContentExtensions::operator<<):
+ (TestWebKitAPI::TEST_F):
+
2015-12-22 Hunseop Jeong <[email protected]>
[EFL] MiniBrowser should be able to choose the offline-web-application-cache option
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (194385 => 194386)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp 2015-12-23 03:22:47 UTC (rev 194385)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp 2015-12-23 10:04:44 UTC (rev 194386)
@@ -50,17 +50,19 @@
{
switch (action) {
case ActionType::BlockLoad:
- return os << "ContentFilterAction::BlockLoad";
+ return os << "ActionType::BlockLoad";
case ActionType::BlockCookies:
- return os << "ContentFilterAction::BlockCookies";
+ return os << "ActionType::BlockCookies";
case ActionType::CSSDisplayNoneSelector:
- return os << "ContentFilterAction::CSSDisplayNone";
+ return os << "ActionType::CSSDisplayNone";
case ActionType::CSSDisplayNoneStyleSheet:
- return os << "ContentFilterAction::CSSDisplayNoneStyleSheet";
+ return os << "ActionType::CSSDisplayNoneStyleSheet";
case ActionType::IgnorePreviousRules:
- return os << "ContentFilterAction::IgnorePreviousRules";
+ return os << "ActionType::IgnorePreviousRules";
+ case ActionType::MakeHTTPS:
+ return os << "ActionType::MakeHTTPS";
case ActionType::InvalidAction:
- return os << "ContentFilterAction::InvalidAction";
+ return os << "ActionType::InvalidAction";
}
}
}
@@ -1438,18 +1440,18 @@
{
auto backend = makeBackend("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"A*D\"}},"
"{\"action\":{\"type\":\"ignore-previous-rules\"},\"trigger\":{\"url-filter\":\"A*BA+\"}},"
- "{\"action\":{\"type\":\"block-cookies\"},\"trigger\":{\"url-filter\":\"A*BC\"}}]");
+ "{\"action\":{\"type\":\"make-https\"},\"trigger\":{\"url-filter\":\"A*BC\"}}]");
testRequest(backend, mainDocumentRequest("http://webkit.org/D"), { ContentExtensions::ActionType::BlockLoad });
testRequest(backend, mainDocumentRequest("http://webkit.org/AAD"), { ContentExtensions::ActionType::BlockLoad });
testRequest(backend, mainDocumentRequest("http://webkit.org/AB"), { });
testRequest(backend, mainDocumentRequest("http://webkit.org/ABA"), { }, true);
testRequest(backend, mainDocumentRequest("http://webkit.org/ABAD"), { }, true);
- testRequest(backend, mainDocumentRequest("http://webkit.org/BC"), { ContentExtensions::ActionType::BlockCookies });
- testRequest(backend, mainDocumentRequest("http://webkit.org/ABC"), { ContentExtensions::ActionType::BlockCookies });
- testRequest(backend, mainDocumentRequest("http://webkit.org/ABABC"), { ContentExtensions::ActionType::BlockCookies }, true);
- testRequest(backend, mainDocumentRequest("http://webkit.org/ABABCAD"), { ContentExtensions::ActionType::BlockCookies }, true);
- testRequest(backend, mainDocumentRequest("http://webkit.org/ABCAD"), { ContentExtensions::ActionType::BlockCookies, ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend, mainDocumentRequest("http://webkit.org/BC"), { ContentExtensions::ActionType::MakeHTTPS });
+ testRequest(backend, mainDocumentRequest("http://webkit.org/ABC"), { ContentExtensions::ActionType::MakeHTTPS });
+ testRequest(backend, mainDocumentRequest("http://webkit.org/ABABC"), { ContentExtensions::ActionType::MakeHTTPS }, true);
+ testRequest(backend, mainDocumentRequest("http://webkit.org/ABABCAD"), { ContentExtensions::ActionType::MakeHTTPS }, true);
+ testRequest(backend, mainDocumentRequest("http://webkit.org/ABCAD"), { ContentExtensions::ActionType::MakeHTTPS, ContentExtensions::ActionType::BlockLoad });
}
TEST_F(ContentExtensionTest, StrictPrefixSeparatedMachines3Partitioning)