Summary: | Add the feature flag plist file parser | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Peng Liu <peng.liu6> | ||||||
Component: | New Bugs | Assignee: | Peng Liu <peng.liu6> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | jer.noble, simon.fraser, thorton, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Peng Liu
2020-05-05 11:22:38 PDT
Created attachment 398531 [details]
Patch
Comment on attachment 398531 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398531&action=review > Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:41 > +bool featureFlagEnabled(const String& featureName) maybe a leading is-? I'm not sure > Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:43 > + BOOL isWebKitBundleFromStageFramework = [[[NSBundle mainBundle] bundlePath] hasPrefix:@"/Library/Apple/System/Library/StagedFrameworks/WebKit"]; "staged", not "stage" > Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:46 > + return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8()); I think you want `.utf8().data()`, no? > Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:50 > + if ([[dictionary objectForKey:featureName] objectForKey:@"Enabled"] == nil) normally we use if (!x) instead of if (x == nil) > Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:53 > + return [[[dictionary objectForKey:featureName] objectForKey:@"Enabled"] boolValue]; Do you want to make sure it's an NSNumber before calling -boolValue? Created attachment 399233 [details]
Revised patch based on Tim's comments
Comment on attachment 398531 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398531&action=review >> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:41 >> +bool featureFlagEnabled(const String& featureName) > > maybe a leading is-? I'm not sure Renamed to isFeatureFlagEnabled(). >> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:43 >> + BOOL isWebKitBundleFromStageFramework = [[[NSBundle mainBundle] bundlePath] hasPrefix:@"/Library/Apple/System/Library/StagedFrameworks/WebKit"]; > > "staged", not "stage" Fixed. >> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:46 >> + return _os_feature_enabled_impl("WebKit", (const char*)featureName.characters8()); > > I think you want `.utf8().data()`, no? Right, fixed. >> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:50 >> + if ([[dictionary objectForKey:featureName] objectForKey:@"Enabled"] == nil) > > normally we use if (!x) instead of if (x == nil) Fixed. >> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:53 >> + return [[[dictionary objectForKey:featureName] objectForKey:@"Enabled"] boolValue]; > > Do you want to make sure it's an NSNumber before calling -boolValue? Fixed. Committed r261599: <https://trac.webkit.org/changeset/261599> All reviewed patches have been landed. Closing bug and clearing flags on attachment 399233 [details]. |