[Content Extensions] Convert content extension compiling to return error codes and...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2015 22:38:58 +0000 (22:38 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2015 22:38:58 +0000 (22:38 +0000)
commitff2222c5b9b6610b653c6aa6d853cec3a79442ec
treea6f5aa40886f2e9e6500c3ac19b40c85dd139d82
parent7d3d290490bebfa73eed306729649f40abb5bbc3
[Content Extensions] Convert content extension compiling to return error codes and write its output using a client
https://bugs.webkit.org/show_bug.cgi?id=143059

Reviewed by Alex Christensen.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
Add ContentExtensionError.h/cpp.

* contentextensions/ContentExtensionError.cpp: Added.
(WebCore::ContentExtensions::contentExtensionErrorCategory):
* contentextensions/ContentExtensionError.h: Added.
(WebCore::ContentExtensions::make_error_code):
Add ContentExtensionError enum and std::error_code adaptor.

* contentextensions/ContentExtensionCompiler.h:
Instead of returning CompiledContentExtensionData, use a client interface
to pass data. Eventually, this should be turned into a direct streaming
interface so we can write directly to a file.

* contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::compileRuleList):
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::getTypeFlags):
(WebCore::ContentExtensions::loadTrigger):
(WebCore::ContentExtensions::loadAction):
(WebCore::ContentExtensions::loadRule):
(WebCore::ContentExtensions::loadEncodedRules):
(WebCore::ContentExtensions::parseRuleList):
* contentextensions/ContentExtensionParser.h:
Convert to return an error.

Source/WebKit2:

* Shared/WebCompiledContentExtension.cpp:
* Shared/WebCompiledContentExtension.h:
(WebKit::LegacyContentExtensionCompilationClient::LegacyContentExtensionCompilationClient):
(WebKit::LegacyContentExtensionCompilationClient::writeBytecode):
(WebKit::LegacyContentExtensionCompilationClient::writeActions):
Add subclass of ContentExtensionCompilationClient for use with the non-file backed content
extensions.

* UIProcess/API/C/WKUserContentFilterRef.cpp:
(WKUserContentFilterCreate):
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter initWithName:serializedRules:]):
Update to use the new interface of compileRuleList().

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::InMemoryCompiledContentExtension::createFromFilter):
Update for new interface of compileRuleList().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181974 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/contentextensions/ContentExtensionCompiler.cpp
Source/WebCore/contentextensions/ContentExtensionCompiler.h
Source/WebCore/contentextensions/ContentExtensionError.cpp [new file with mode: 0644]
Source/WebCore/contentextensions/ContentExtensionError.h [new file with mode: 0644]
Source/WebCore/contentextensions/ContentExtensionParser.cpp
Source/WebCore/contentextensions/ContentExtensionParser.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebCompiledContentExtension.cpp
Source/WebKit2/Shared/WebCompiledContentExtension.h
Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.cpp
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp