RESOLVED FIXED 143059
[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
Summary [Content Extensions] Convert content extension compiling to return error code...
Sam Weinig
Reported 2015-03-25 14:36:15 PDT
[Content Extensions] Convert content extension compiling to return error codes and write its output using a client
Attachments
Patch (50.13 KB, patch)
2015-03-25 14:41 PDT, Sam Weinig
achristensen: review+
Sam Weinig
Comment 1 2015-03-25 14:41:01 PDT
WebKit Commit Bot
Comment 2 2015-03-25 14:43:06 PDT
Attachment 249428 [details] did not pass style-queue: ERROR: Source/WebKit2/Shared/WebCompiledContentExtension.h:32: Alphabetical sorting problem. [build/include_order] [4] ERROR: Source/WebCore/contentextensions/ContentExtensionError.h:60: make_error_code is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/contentextensions/ContentExtensionError.h:69: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/WebCore/contentextensions/ContentExtensionError.cpp:41: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 4 in 16 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 3 2015-03-25 15:39:40 PDT
Anders Carlsson
Comment 4 2015-03-25 15:43:33 PDT
Comment on attachment 249428 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=249428&action=review > Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:103 > +std::error_code compileRuleList(const String& ruleList, ContentExtensionCompilationClient& client) I like always putting the client object first in a list of parameters. > Source/WebCore/contentextensions/ContentExtensionParser.cpp:50 > +static std::error_code getTypeFlags(ExecState& exec, const JSValue& typeValue, ResourceFlags& flags, uint16_t(*stringToType)(const String&)) missing space after the return type. > Source/WebKit2/Shared/WebCompiledContentExtension.cpp:59 > + data.actionsOffset = compilerData. bytecode.size(); Please don't land this. > Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm:47 > + auto compilerError = WebCore::ContentExtensions::compileRuleList(String(serializedRules), client); > + if (compilerError) Can fold these into one line. > Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm:48 > + [NSException raise:NSGenericException format:@"Failed to compile rules with error: %s", compilerError.message().c_str()]; Not sure if we should raise an exception here. Maybe we should return nil on failure and have an NSError parameter instead. > Tools/MiniBrowser/mac/MainMenu.xib:8 > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7504.2" systemVersion="14D89" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> > +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8052.4" systemVersion="15A131a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> > <dependencies> > - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7504.2"/> > + <deployment identifier="macosx"/> > + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8052.4"/> > </dependencies> > <objects> > <customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> Please don't land this.
Sam Weinig
Comment 5 2015-03-25 15:49:49 PDT
(In reply to comment #4) > Comment on attachment 249428 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=249428&action=review > > > Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:103 > > +std::error_code compileRuleList(const String& ruleList, ContentExtensionCompilationClient& client) > > I like always putting the client object first in a list of parameters. Ok. Will change. > > > Source/WebCore/contentextensions/ContentExtensionParser.cpp:50 > > +static std::error_code getTypeFlags(ExecState& exec, const JSValue& typeValue, ResourceFlags& flags, uint16_t(*stringToType)(const String&)) > > missing space after the return type. Will fix. > > > Source/WebKit2/Shared/WebCompiledContentExtension.cpp:59 > > + data.actionsOffset = compilerData. bytecode.size(); > > Please don't land this. Oops. Will fix. > > > Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm:47 > > + auto compilerError = WebCore::ContentExtensions::compileRuleList(String(serializedRules), client); > > + if (compilerError) > > Can fold these into one line. Ok. > > > Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm:48 > > + [NSException raise:NSGenericException format:@"Failed to compile rules with error: %s", compilerError.message().c_str()]; > > Not sure if we should raise an exception here. Maybe we should return nil on > failure and have an NSError parameter instead. This init method will be going away real soon. I was using this for testing only. > > > Tools/MiniBrowser/mac/MainMenu.xib:8 > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > > -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7504.2" systemVersion="14D89" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> > > +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8052.4" systemVersion="15A131a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> > > <dependencies> > > - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7504.2"/> > > + <deployment identifier="macosx"/> > > + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8052.4"/> > > </dependencies> > > <objects> > > <customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> > > Please don't land this. I removed it before landing.
Note You need to log in before you can comment on or make changes to this bug.