WebKit1's WebPreferences exposes a method to control this and there's already plumbing in WebKit2's WebKit::WebPreferences. We just need to expose this on WKPreferences.
Created attachment 237020 [details] Patch
I don't think this needs to be iOS specific. It would also be good to add an API test for this.
Comment on attachment 237020 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=237020&action=review > Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h:57 > +#if TARGET_OS_IPHONE Why the #if? I see no harm in doing this on Mac too.
Comment on attachment 237020 [details] Patch Given both Darin and my comments, putting to r- for now.
(In reply to comment #4) > (From update of attachment 237020 [details]) > Given both Darin and my comments, putting to r- for now. I was just matching WK1 which has this only on iOS, but I'll gladly change that. Any pointers to how to write an API test?
Take a look at TestWebKitAPI's WebKit2 Cocoa group.
Created attachment 237180 [details] Patch v2 Not iOS-specific and with an API test.
Comment on attachment 237180 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=237180&action=review r=me > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Preferences.mm:31 > +#import "Test.h" This should come before the <>-style imports. > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Preferences.mm:33 > +#if WK_API_ENABLED This should come after #import "config.h" but before the other imports. > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Preferences.mm:40 > +TEST(WebKit2, DefaultWKPreferences) > +{ > + RetainPtr<WKPreferences> preferences = adoptNS([[WKPreferences alloc] init]); > + > + EXPECT_FALSE([preferences _isStandalone]); > +} You should also test setting the property (e.g. [preferences _setStandalone:YES]; EXPECT_TRUE([preferences _isStandalone];).
https://trac.webkit.org/changeset/172994