WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195989
[WebKit2] Introduce a public version of WKWebsitePolicies
https://bugs.webkit.org/show_bug.cgi?id=195989
Summary
[WebKit2] Introduce a public version of WKWebsitePolicies
Wenson Hsieh
Reported
2019-03-19 22:04:07 PDT
Work towards <
rdar://problem/47228232
>
Attachments
WIP
(62.01 KB, patch)
2019-03-19 22:20 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
WIP
(61.97 KB, patch)
2019-03-19 22:33 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Work in progress
(54.99 KB, patch)
2019-03-20 07:24 PDT
,
Wenson Hsieh
ews-watchlist
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews104 for mac-highsierra-wk2
(2.89 MB, application/zip)
2019-03-20 18:56 PDT
,
EWS Watchlist
no flags
Details
Patch
(44.00 KB, patch)
2019-03-26 14:15 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch
(43.79 KB, patch)
2019-03-28 20:32 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Take 2
(43.86 KB, patch)
2019-04-01 15:36 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Fix a * on the wrong side
(43.86 KB, patch)
2019-04-01 16:22 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2019-03-19 22:20:55 PDT
Comment hidden (obsolete)
Created
attachment 365312
[details]
WIP
Wenson Hsieh
Comment 2
2019-03-19 22:33:12 PDT
Comment hidden (obsolete)
Created
attachment 365314
[details]
WIP
Wenson Hsieh
Comment 3
2019-03-20 07:24:12 PDT
Comment hidden (obsolete)
Created
attachment 365343
[details]
Work in progress
EWS Watchlist
Comment 4
2019-03-20 18:56:18 PDT
Comment hidden (obsolete)
Comment on
attachment 365343
[details]
Work in progress
Attachment 365343
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/11589360
New failing tests: http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html
EWS Watchlist
Comment 5
2019-03-20 18:56:19 PDT
Comment hidden (obsolete)
Created
attachment 365461
[details]
Archive of layout-test-results from ews104 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
Wenson Hsieh
Comment 6
2019-03-20 20:44:37 PDT
Nope, changing course...
Wenson Hsieh
Comment 7
2019-03-21 17:59:38 PDT
(In reply to Wenson Hsieh from
comment #6
)
> Nope, changing course...
🔙
Wenson Hsieh
Comment 8
2019-03-26 14:15:22 PDT
Created
attachment 365998
[details]
Patch
Tim Horton
Comment 9
2019-03-27 11:30:04 PDT
Comment on
attachment 365998
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=365998&action=review
> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:191 > + NSMutableDictionary *dictionary = [[[NSMutableDictionary alloc] initWithCapacity:fields.size()] autorelease];
RetainPtr?
> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:193 > + [dictionary setObject:field.value() forKey:field.name()];
Or subscript operator?
> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:252 > + return [NSString stringWithFormat:@"<%@: %p; contentBlockersEnabled = %d>", NSStringFromClass(self.class), self, self.contentBlockersEnabled];
Don't do this. It should only print API properties, and either all or none.
Wenson Hsieh
Comment 10
2019-03-28 19:32:39 PDT
Comment on
attachment 365998
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=365998&action=review
>> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:191 >> + NSMutableDictionary *dictionary = [[[NSMutableDictionary alloc] initWithCapacity:fields.size()] autorelease]; > > RetainPtr?
👍🏻
>> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:193 >> + [dictionary setObject:field.value() forKey:field.name()]; > > Or subscript operator?
Subscript operator gets a tiny bit annoying if I go with RetainPtr above :/ In other places, I think we might prefer just using -setObject:forKey: since subscripting would look like: dictionary.get()[(NSString *)field.name()] = field.value();
>> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:252 >> + return [NSString stringWithFormat:@"<%@: %p; contentBlockersEnabled = %d>", NSStringFromClass(self.class), self, self.contentBlockersEnabled]; > > Don't do this. It should only print API properties, and either all or none.
Good call!
Tim Horton
Comment 11
2019-03-28 19:37:48 PDT
(In reply to Wenson Hsieh from
comment #10
)
> Comment on
attachment 365998
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=365998&action=review
> > >> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:191 > >> + NSMutableDictionary *dictionary = [[[NSMutableDictionary alloc] initWithCapacity:fields.size()] autorelease]; > > > > RetainPtr? > > 👍🏻 > > >> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:193 > >> + [dictionary setObject:field.value() forKey:field.name()]; > > > > Or subscript operator? > > Subscript operator gets a tiny bit annoying if I go with RetainPtr above :/ > In other places, I think we might prefer just using -setObject:forKey: since > subscripting would look like: > > dictionary.get()[(NSString *)field.name()] = field.value();
Ah, yes, these are definitely mutually exclusive suggestions :)
> >> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:252 > >> + return [NSString stringWithFormat:@"<%@: %p; contentBlockersEnabled = %d>", NSStringFromClass(self.class), self, self.contentBlockersEnabled]; > > > > Don't do this. It should only print API properties, and either all or none. > > Good call!
Wenson Hsieh
Comment 12
2019-03-28 20:32:47 PDT
Created
attachment 366238
[details]
Patch
Tim Horton
Comment 13
2019-04-01 14:52:19 PDT
Comment on
attachment 366238
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=366238&action=review
> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5133 > + auto data = [websitePolicies webPagePreferences]->_websitePolicies->data();
Dots?
> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h:30 > + @helps Contains properties used to determine web page preferences.
What's @helps for? I never know anything about this doc comment format.
> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:69 > +@property (nonatomic) BOOL contentBlockersEnabled; > +@property (nonatomic) _WKWebsiteAutoplayQuirk allowedAutoplayQuirks; > +@property (nonatomic) _WKWebsiteAutoplayPolicy autoplayPolicy; > +@property (nonatomic, copy) NSDictionary<NSString *, NSString *> *customHeaderFields; > +@property (nonatomic) _WKWebsitePopUpPolicy popUpPolicy; > +@property (nonatomic, strong) WKWebsiteDataStore *websiteDataStore; > +@property (nonatomic, copy) NSString *customUserAgent; > +@property (nonatomic, copy) NSString *customJavaScriptUserAgentAsSiteSpecificQuirks; > +@property (nonatomic, copy) NSString *customNavigatorPlatform; > +@property (nonatomic) _WKWebsiteDeviceOrientationAndMotionAccessPolicy deviceOrientationAndMotionAccessPolicy;
These all need to gain underscores now that they're on a public class, right?
> Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm:43 > +- (WKWebpagePreferences *)webPagePreferences
Capitalization consistency!
Wenson Hsieh
Comment 14
2019-04-01 15:13:44 PDT
Comment on
attachment 366238
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=366238&action=review
>> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5133 >> + auto data = [websitePolicies webPagePreferences]->_websitePolicies->data(); > > Dots?
More dots!
>> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h:30 >> + @helps Contains properties used to determine web page preferences. > > What's @helps for? I never know anything about this doc comment format.
Oh, interesting. I took this from WKWebViewConfiguration's public header. As far as I can tell though, WKWebViewConfiguration.h is the only place in the entire public Cocoa API surface (macOS and iOS) that uses @helps, so it might be a mistake. I changed this to @discussion instead, which is much more commonly used.
>> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:69 >> +@property (nonatomic) _WKWebsiteDeviceOrientationAndMotionAccessPolicy deviceOrientationAndMotionAccessPolicy; > > These all need to gain underscores now that they're on a public class, right?
They rather should, but I was hoping to do that later, to maintain bincompat with Safari. I could also just add the underscore-prefixed versions here in this patch, alongside these non-underscore-prefixed versions. I'll go ahead and do that, so we can get Safari on the underscore-prefixed versions sooner, and then finally remove these existing ones.
>> Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm:43 >> +- (WKWebpagePreferences *)webPagePreferences > > Capitalization consistency!
Fixed!
Wenson Hsieh
Comment 15
2019-04-01 15:15:58 PDT
Comment on
attachment 366238
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=366238&action=review
>>> Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:69 >>> +@property (nonatomic) _WKWebsiteDeviceOrientationAndMotionAccessPolicy deviceOrientationAndMotionAccessPolicy; >> >> These all need to gain underscores now that they're on a public class, right? > > They rather should, but I was hoping to do that later, to maintain bincompat with Safari. > > I could also just add the underscore-prefixed versions here in this patch, alongside these non-underscore-prefixed versions. I'll go ahead and do that, so we can get Safari on the underscore-prefixed versions sooner, and then finally remove these existing ones.
Nope, never mind, this is on the new WKWebpagePreferences so this should totally be _-prefixed from the get-go.
Wenson Hsieh
Comment 16
2019-04-01 15:36:39 PDT
Created
attachment 366431
[details]
Take 2
Wenson Hsieh
Comment 17
2019-04-01 16:22:08 PDT
Created
attachment 366439
[details]
Fix a * on the wrong side
WebKit Commit Bot
Comment 18
2019-04-01 17:01:10 PDT
Comment on
attachment 366439
[details]
Fix a * on the wrong side Clearing flags on attachment: 366439 Committed
r243726
: <
https://trac.webkit.org/changeset/243726
>
WebKit Commit Bot
Comment 19
2019-04-01 17:01:12 PDT
All reviewed patches have been landed. Closing bug.
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