[Content Extensions] Properly handle regexes that match everything.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Apr 2015 17:48:57 +0000 (17:48 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Apr 2015 17:48:57 +0000 (17:48 +0000)
commit001bf9830c07535af4a0018aa23f5658e7c269be
tree7dbc98671d626f19e8d388e75eb075cc2c9c37bf
parentae03e9a088b9548632b9e0d9de28a8b027c98947
[Content Extensions] Properly handle regexes that match everything.
https://bugs.webkit.org/show_bug.cgi?id=143281

Reviewed by Benjamin Poulain.

Source/WebCore:

* contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::compileRuleList):
Make sure we always have at least one NFA for rule lists with triggers that all match everything.
* contentextensions/DFABytecodeInterpreter.cpp:
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
Add helper functions to reduce duplicate code.
(WebCore::ContentExtensions::DFABytecodeInterpreter::actionsFromDFARoot):
Get all actions without flags from the DFA root.
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
Remove branches when interpreting.
* contentextensions/DFABytecodeInterpreter.h:
Add helper functions to reduce duplicate code.

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::testRequest):
(TestWebKitAPI::makeBackend):
(TestWebKitAPI::TEST_F):
Removed duplicate code and added test.

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