[Content Extensions] resource-type and load-type should be independent.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jun 2015 22:40:47 +0000 (22:40 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jun 2015 22:40:47 +0000 (22:40 +0000)
commit34d3f2b174acac8c894f52dceceef67f63d4dcca
treeaf262a04444b17388eb8474fdeaeb652f1daa4a9
parentb4ba1fceb296eda667cff0043e593a2029c745f8
[Content Extensions] resource-type and load-type should be independent.
https://bugs.webkit.org/show_bug.cgi?id=145528
rdar://problem/21190765

Reviewed by Benjamin Poulain.

Source/WebCore:

Covered by existing tests and a new API test.

Right now we use the same uint16_t to store all the load-type and resource-type flags,
then we just do a bitwise and to check both at the same time. This results in a trigger
with load-type and resource-type firing if either condition is met, not both conditions.
A trigger with both resource-type and load-type conditions should only fire if both conditions are met.

* contentextensions/DFABytecodeInterpreter.cpp:
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
Check and correctly handle rules with both resource-type and load-type flags.
* loader/ResourceLoadInfo.h:
Add masks to separate flags from resource-type and load-type.

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp
Source/WebCore/loader/ResourceLoadInfo.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp