WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
158095
Expose content extension failure error codes in SPI
https://bugs.webkit.org/show_bug.cgi?id=158095
Summary
Expose content extension failure error codes in SPI
Alex Christensen
Reported
2016-05-25 14:49:24 PDT
Expose content extension failure error codes in SPI
Attachments
Patch
(1.91 KB, patch)
2016-05-25 14:49 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(13.17 KB, patch)
2016-05-25 16:36 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(13.20 KB, patch)
2016-05-25 17:05 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(12.38 KB, patch)
2016-05-26 16:04 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(12.71 KB, patch)
2016-05-27 11:29 PDT
,
Alex Christensen
andersca
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2016-05-25 14:49:51 PDT
Created
attachment 279820
[details]
Patch
Alex Christensen
Comment 2
2016-05-25 16:36:35 PDT
Created
attachment 279836
[details]
Patch
Alex Christensen
Comment 3
2016-05-25 17:05:42 PDT
Created
attachment 279841
[details]
Patch
Sam Weinig
Comment 4
2016-05-26 15:51:06 PDT
Comment on
attachment 279841
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=279841&action=review
> Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:45 > +// These correspond with the error codes in UserContentExtensionStore::Error. > +typedef NS_ENUM(NSInteger, _WKUserContentExtensionStoreErrorCode) {
Instead of requiring these to stay in sync, we should explicitly convert from one to the other with a switch statement like we do for other errors. Also, SPI headers should not refer to internals. I also think this should be an extension to WKErrorCode and we should switch to using the WKError domain. I believe you do that by using constants of type WKErrorCode, but am not sure. I'll let Anders say.
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm:68 > + EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorCode::CompileFailed);
This should test the domain as well.
Alex Christensen
Comment 5
2016-05-26 16:04:52 PDT
Created
attachment 279920
[details]
Patch
Alex Christensen
Comment 6
2016-05-26 16:09:58 PDT
(In reply to
comment #4
)
> I also think this should be an extension to WKErrorCode and we should switch > to using the WKError domain. I believe you do that by using constants of > type WKErrorCode, but am not sure. I'll let Anders say.
I disagree and have implemented it as a separate domain. If Anders tells me otherwise, I'll change it.
Anders Carlsson
Comment 7
2016-05-27 11:25:00 PDT
Comment on
attachment 279920
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=279920&action=review
> Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:50 > + LookupFailed = 1, > + VersionMismatch, > + CompileFailed, > + RemoveFailed,
These should be prefixed correctly, _WKUserContentExtensionStoreErrorLookupFailed, _WKUserContentExtensionStoreErrorVersionMismatch etc.
Alex Christensen
Comment 8
2016-05-27 11:29:54 PDT
Created
attachment 279976
[details]
Patch
Anders Carlsson
Comment 9
2016-05-27 11:33:17 PDT
Comment on
attachment 279976
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=279976&action=review
> Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:44 > +WK_EXTERN NSString * const _ContentExtensionsDomain WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
Should be _WKUserContentExtensionsDomain.
> Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:87 > + auto code = toWKUserContentExtensionStoreErrorCode(API::UserContentExtensionStore::Error::CompileFailed); > + rawHandler(nil, [NSError errorWithDomain:_ContentExtensionsDomain code:code userInfo:userInfo]);
No need to use toWKUserContentExtensionStoreErrorCode here - just pass the WebKit code directly.
> Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:126 > + auto code = toWKUserContentExtensionStoreErrorCode(API::UserContentExtensionStore::Error::RemoveFailed); > + rawHandler([NSError errorWithDomain:_ContentExtensionsDomain code:code userInfo:userInfo]);
No need to use toWKUserContentExtensionStoreErrorCode here - just pass the WebKit code directly.
Alex Christensen
Comment 10
2016-05-27 11:50:01 PDT
Passing the WebKit code doesn't like converting an enum to an NSInteger, so I just used the new API codes.
http://trac.webkit.org/changeset/201457
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug