Bug 222377 - [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload
Summary: [iOS] Get default value in the UI process for whether synchronous XMLHttpRequ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-24 12:46 PST by Per Arne Vollan
Modified: 2021-02-25 08:30 PST (History)
4 users (show)

See Also:


Attachments
Patch (9.49 KB, patch)
2021-02-24 12:50 PST, Per Arne Vollan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (9.69 KB, patch)
2021-02-24 12:56 PST, Per Arne Vollan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (9.69 KB, patch)
2021-02-24 13:02 PST, Per Arne Vollan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (9.69 KB, patch)
2021-02-24 13:13 PST, Per Arne Vollan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (9.65 KB, patch)
2021-02-24 13:22 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2021-02-24 12:46:14 PST
Getting this default value in the UI process instead of in every WebContent process should be a small speedup, since getting this default value is a bit costly on iOS.
Comment 1 Per Arne Vollan 2021-02-24 12:50:52 PST
Created attachment 421443 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2021-02-24 12:52:05 PST
<rdar://problem/74709239>
Comment 3 Per Arne Vollan 2021-02-24 12:56:12 PST
Created attachment 421444 [details]
Patch
Comment 4 Per Arne Vollan 2021-02-24 13:02:31 PST
Created attachment 421446 [details]
Patch
Comment 5 Per Arne Vollan 2021-02-24 13:13:28 PST
Created attachment 421450 [details]
Patch
Comment 6 Per Arne Vollan 2021-02-24 13:22:00 PST
Created attachment 421452 [details]
Patch
Comment 7 Brent Fulgham 2021-02-24 13:59:38 PST
Comment on attachment 421452 [details]
Patch

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

r=me

> Source/WebKit/UIProcess/WebPageProxy.cpp:7988
> +#if PLATFORM(IOS)

Should this check #if !PLATFORM(MACCATALYST) && !PLATFORM(WATCHOS) as well?
Comment 8 Per Arne Vollan 2021-02-24 15:51:36 PST
(In reply to Brent Fulgham from comment #7)
> Comment on attachment 421452 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421452&action=review
> 
> r=me
> 
> > Source/WebKit/UIProcess/WebPageProxy.cpp:7988
> > +#if PLATFORM(IOS)
> 
> Should this check #if !PLATFORM(MACCATALYST) && !PLATFORM(WATCHOS) as well?

That is a good point. I think we even could create a HAVE(MANAGED_CONFIGURATION) define, to avoid these platform defines. I can create a follow-up patch for that. What do you think?

Thanks for reviewing!
Comment 9 EWS 2021-02-24 16:08:28 PST
Committed r273452: <https://commits.webkit.org/r273452>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 421452 [details].
Comment 10 Simon Fraser (smfr) 2021-02-24 18:54:09 PST
Comment on attachment 421452 [details]
Patch

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

> Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm:49
> +    static NeverDestroyed<Optional<bool>> allowsRequest;

Why isn't this just static bool value = [[PAL::getMCProfileConnectionClass() sharedConnection] effectiveBoolValueForSetting:@"allowDeprecatedWebKitSynchronousXHRLoads"] == MCRestrictedBoolExplicitYes;  in the function below?

> Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm:62
> +    cachedAllowsRequest() = allowsRequest;

This reads oddly.

>>> Source/WebKit/UIProcess/WebPageProxy.cpp:7988
>>> +#if PLATFORM(IOS)
>> 
>> Should this check #if !PLATFORM(MACCATALYST) && !PLATFORM(WATCHOS) as well?
> 
> That is a good point. I think we even could create a HAVE(MANAGED_CONFIGURATION) define, to avoid these platform defines. I can create a follow-up patch for that. What do you think?
> 
> Thanks for reviewing!

Why not just not #ifdef this. It's fine if it's false by default.

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:642
> +#if PLATFORM(IOS)
> +    setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload(parameters.allowsDeprecatedSynchronousXMLHttpRequestDuringUnload);
> +#endif

This pollutes the WebPage ctor with random stuff. Why is this here and not a bunch of other config stuff?
Comment 11 Per Arne Vollan 2021-02-25 08:30:10 PST
(In reply to Simon Fraser (smfr) from comment #10)
> Comment on attachment 421452 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421452&action=review
> 
> > Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm:49
> > +    static NeverDestroyed<Optional<bool>> allowsRequest;
> 
> Why isn't this just static bool value = [[PAL::getMCProfileConnectionClass()
> sharedConnection]
> effectiveBoolValueForSetting:@"allowDeprecatedWebKitSynchronousXHRLoads"] ==
> MCRestrictedBoolExplicitYes;  in the function below?
> 

We would like to avoid all Managed Configuration calls in WP, since loading the library can then be avoided.

> > Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm:62
> > +    cachedAllowsRequest() = allowsRequest;
> 
> This reads oddly.
> 

Yes, I can look into a better way of doing this.

> >>> Source/WebKit/UIProcess/WebPageProxy.cpp:7988
> >>> +#if PLATFORM(IOS)
> >> 
> >> Should this check #if !PLATFORM(MACCATALYST) && !PLATFORM(WATCHOS) as well?
> > 
> > That is a good point. I think we even could create a HAVE(MANAGED_CONFIGURATION) define, to avoid these platform defines. I can create a follow-up patch for that. What do you think?
> > 
> > Thanks for reviewing!
> 
> Why not just not #ifdef this. It's fine if it's false by default.
>

Yes, I think we could do that. Alternatively, we could add a HAVE(MANAGED_CONFIGURATION) define, since this only applies for platforms using this feature. This would also remove some of the other platform defines related to this.
 
> > Source/WebKit/WebProcess/WebPage/WebPage.cpp:642
> > +#if PLATFORM(IOS)
> > +    setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload(parameters.allowsDeprecatedSynchronousXMLHttpRequestDuringUnload);
> > +#endif
> 
> This pollutes the WebPage ctor with random stuff. Why is this here and not a
> bunch of other config stuff?

That's a good point. It would be better to pass this as part of the Web process creation parameters, I think.

I will create a follow-up patch addressing these issues.

Thanks for reviewing!