Title: [181163] trunk/Source/WebCore
Revision
181163
Author
commit-qu...@webkit.org
Date
2015-03-06 10:13:10 -0800 (Fri, 06 Mar 2015)

Log Message

[Content Extensions] Process all actions when blocking a URL.
https://bugs.webkit.org/show_bug.cgi?id=142363

Patch by Alex Christensen <achristen...@webkit.org> on 2015-03-06
Reviewed by Darin Adler.

This can only be tested once we implement css selectors.

* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
Do not return early when adding a block action.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
Process all actions before returning.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181162 => 181163)


--- trunk/Source/WebCore/ChangeLog	2015-03-06 18:09:06 UTC (rev 181162)
+++ trunk/Source/WebCore/ChangeLog	2015-03-06 18:13:10 UTC (rev 181163)
@@ -1,3 +1,19 @@
+2015-03-06  Alex Christensen  <achristen...@webkit.org>
+
+        [Content Extensions] Process all actions when blocking a URL.
+        https://bugs.webkit.org/show_bug.cgi?id=142363
+
+        Reviewed by Darin Adler.
+
+        This can only be tested once we implement css selectors.
+
+        * contentextensions/ContentExtensionsBackend.cpp:
+        (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
+        Do not return early when adding a block action.
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource):
+        Process all actions before returning.
+
 2015-03-05  Darin Adler  <da...@apple.com>
 
         Make _javascript_ binding get and set legacy event listener attributes directly

Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (181162 => 181163)


--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp	2015-03-06 18:09:06 UTC (rev 181162)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp	2015-03-06 18:13:10 UTC (rev 181163)
@@ -85,8 +85,6 @@
                 if (action.type() == ActionType::IgnorePreviousRules)
                     break;
                 actions.append(action);
-                if (action.type() == ActionType::BlockLoad)
-                    return actions;
             }
         }
     }

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (181162 => 181163)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-03-06 18:09:06 UTC (rev 181162)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-03-06 18:13:10 UTC (rev 181163)
@@ -510,10 +510,11 @@
     if (frame() && frame()->page() && frame()->page()->userContentController())
         actions = frame()->page()->userContentController()->actionsForURL(url);
 
+    bool willBlockLoad = false;
     for (const auto& action : actions) {
         if (action.type() == ContentExtensions::ActionType::BlockLoad)
-            return nullptr;
-        if (action.type() == ContentExtensions::ActionType::BlockCookies)
+            willBlockLoad = true;
+        else if (action.type() == ContentExtensions::ActionType::BlockCookies)
             request.mutableResourceRequest().setAllowCookies(false);
         else if (action.type() == ContentExtensions::ActionType::CSSDisplayNone) {
             // action.cssSelector() is the css to use here.
@@ -521,6 +522,8 @@
         } else
             RELEASE_ASSERT_NOT_REACHED();
     }
+    if (willBlockLoad)
+        return nullptr;
 #endif
 
     auto& memoryCache = MemoryCache::singleton();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to