Bug 210344

Summary: http/tests/in-app-browser-privacy/app-bound-domain.html is a constant failure on iOS
Product: WebKit Reporter: Kate Cheney <katherine_cheney>
Component: WebKit Misc.Assignee: Kate Cheney <katherine_cheney>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, thorton
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Kate Cheney 2020-04-10 10:25:28 PDT
The in-app-browser-privacy tests try to enable in-app browser privacy as an internal debug flag, but it is not an internal debug feature.
Comment 1 Kate Cheney 2020-04-10 10:26:10 PDT
<rdar://problem/61583925>
Comment 2 Kate Cheney 2020-04-10 10:40:44 PDT
Created attachment 396101 [details]
Patch
Comment 3 Alex Christensen 2020-04-13 10:26:01 PDT
Comment on attachment 396101 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=396101&action=review

> Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:127
> +#if PLATFORM(IOS_FAMILY)

Why is this not needed on Mac?
Comment 4 Kate Cheney 2020-04-13 10:28:31 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 396101 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=396101&action=review
> 
> > Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:127
> > +#if PLATFORM(IOS_FAMILY)
> 
> Why is this not needed on Mac?

This is an iOS feature only, so this option should only be set if the tests are running iOS (they are skipped on other platforms).
Comment 5 Alex Christensen 2020-04-13 10:37:09 PDT
Comment on attachment 396101 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=396101&action=review

> Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:131
> +        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];

Two thoughts:
1. TestController::platformAddTestOptions is a place where we are supposed to be writing to options, and this reads from options.  I think TestController::platformResetPreferencesToConsistentValues or TestController::platformResetStateToConsistentValues  and maybe TestController::updatePlatformSpecificTestOptionsForTest would be a better place to reset and set these values in NSUserDefaults.
2. Instead of setting the bool to NO, let's remove object for key.
Comment 6 Kate Cheney 2020-04-13 11:37:25 PDT
(In reply to Alex Christensen from comment #5)
> Comment on attachment 396101 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=396101&action=review
> 
> > Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:131
> > +        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
> 
> Two thoughts:
> 1. TestController::platformAddTestOptions is a place where we are supposed
> to be writing to options, and this reads from options.  I think
> TestController::platformResetPreferencesToConsistentValues or
> TestController::platformResetStateToConsistentValues  and maybe
> TestController::updatePlatformSpecificTestOptionsForTest would be a better
> place to reset and set these values in NSUserDefaults.
> 2. Instead of setting the bool to NO, let's remove object for key.

I don't think this will work because updatePlatformSpecificTestOptionsForTest() is called before updateTestOptionsFromTestHeader() in TestController::testOptionsForTest(), so it doesn't have the updated value. Then I think platformResetStateToConsistentValues is called at the end of the test, so I can remove the key there but not set it prior to the test.
Comment 7 Kate Cheney 2020-04-13 11:50:56 PDT
Created attachment 396313 [details]
Patch
Comment 8 Kate Cheney 2020-04-13 11:51:55 PDT
(In reply to katherine_cheney from comment #6)
> (In reply to Alex Christensen from comment #5)
> > Comment on attachment 396101 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=396101&action=review
> > 
> > > Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:131
> > > +        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
> > 
> > Two thoughts:
> > 1. TestController::platformAddTestOptions is a place where we are supposed
> > to be writing to options, and this reads from options.  I think
> > TestController::platformResetPreferencesToConsistentValues or
> > TestController::platformResetStateToConsistentValues  and maybe
> > TestController::updatePlatformSpecificTestOptionsForTest would be a better
> > place to reset and set these values in NSUserDefaults.
> > 2. Instead of setting the bool to NO, let's remove object for key.
> 
> I don't think this will work because
> updatePlatformSpecificTestOptionsForTest() is called before
> updateTestOptionsFromTestHeader() in TestController::testOptionsForTest(),
> so it doesn't have the updated value. Then I think
> platformResetStateToConsistentValues is called at the end of the test, so I
> can remove the key there but not set it prior to the test.

Maybe I'm missing something? Because it seems like all internal/experimental features are set before the header comments are read, and those seem to work fine. But this test still fails if I call it before updateTestOptionsFromTestHeader().
Comment 9 Brent Fulgham 2020-04-13 14:18:36 PDT
r=me
Comment 10 EWS 2020-04-13 14:37:46 PDT
Committed r260040: <https://trac.webkit.org/changeset/260040>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 396313 [details].