Bug 136189 - Add WebKit SPI to control the navigator.standalone property
Summary: Add WebKit SPI to control the navigator.standalone property
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Matt Lilek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-22 18:53 PDT by Matt Lilek
Modified: 2014-08-26 20:18 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.62 KB, patch)
2014-08-22 18:57 PDT, Matt Lilek
sam: review-
dev+webkit: commit-queue-
Details | Formatted Diff | Diff
Patch v2 (8.93 KB, patch)
2014-08-26 16:10 PDT, Matt Lilek
aestes: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Lilek 2014-08-22 18:53:05 PDT
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.
Comment 1 Matt Lilek 2014-08-22 18:57:09 PDT
Created attachment 237020 [details]
Patch
Comment 2 Sam Weinig 2014-08-22 21:41:26 PDT
I don't think this needs to be iOS specific. It would also be good to add an API test for this.
Comment 3 Darin Adler 2014-08-24 12:00:04 PDT
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 4 Sam Weinig 2014-08-24 16:32:51 PDT
Comment on attachment 237020 [details]
Patch

Given both Darin and my comments, putting to r- for now.
Comment 5 Matt Lilek 2014-08-24 21:59:02 PDT
(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?
Comment 6 Sam Weinig 2014-08-26 13:24:06 PDT
Take a look at TestWebKitAPI's WebKit2 Cocoa group.
Comment 7 Matt Lilek 2014-08-26 16:10:41 PDT
Created attachment 237180 [details]
Patch v2

Not iOS-specific and with an API test.
Comment 8 Andy Estes 2014-08-26 16:27:51 PDT
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];).
Comment 9 Matt Lilek 2014-08-26 20:18:32 PDT
https://trac.webkit.org/changeset/172994