Bug 182485 - [iOS] UI for Experimental Features does not correctly update preferences
Summary: [iOS] UI for Experimental Features does not correctly update preferences
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 149264
  Show dependency treegraph
 
Reported: 2018-02-05 07:41 PST by Frédéric Wang (:fredw)
Modified: 2018-11-15 10:38 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2018-02-05 07:41:45 PST
I'm testing with iOS Simulator 10.0, using a nightly build and the public SDK. Here is a way to reproduce:

1) Launch Safari with Tools/Script/run-safari --ios-simulator
2) Use Home button and go to "Settings => Safari => Experimental Features". Disable all but "Constant Properties". Use Home button and go back to Safari, so that the settings are updated.
3) Debug MobileSafari, place a break point on WebPreferences::setEnabledForFeature after the key string is retrieved (DerivedSources/WebKit2/WebPreferencesExperimentalFeatures.cpp)
4) Use Home button, go back to Settings and enable WebGPU. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is not called.
5) Use Home button, go back to Settings and disable WebGPU. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is not called.
6) Use Home button; go back to Settings and enable Async Frame Scrolling. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is called with key "AsyncFrameScrollingEnabled".
7) Use Home button, go back to Settings and enable WebGPU. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is called with key "AsyncFrameScrollingEnabled".
8) Use Home button, go back to Settings and disable Async Frame Scrolling. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is not called.

Actual result: WebPreferences::setEnabledForFeature is sometimes not called, sometimes not for the modified key. 
Expected result: WebPreferences::setEnabledForFeature should be called for each key that was modified.
Comment 1 Frédéric Wang (:fredw) 2018-02-22 14:04:06 PST
After more analysis, this is a more accurate description of the behavior I see:

* For the options that are not in the setters[] array then WebPreferences::setEnabledForFeature is never called. This includes the obsolete UI items "CSS display: contents", "Remove Legacy WebRTC API" and "Viewport Fit". Note that I was testing with WEBGPU disabled in comment 0 so "WebGPUEnabled" was not in the setters[] array.

* If you enable "Constant Properties", then WebPreferences::setEnabledForFeature is *not* called for "ConstantPropertiesEnabled". If you disable "Constant Properties" then WebPreferences::setEnabledForFeature is called.

* For other properties, this is the other way around: WebPreferences::setEnabledForFeature is called when the option is enabled but *not* when the option is disabled. This includes the case of "AsyncFrameScrollingEnabled" mentioned in comment 0.

* If "Constant Properties" was disabled when you modified the value of another option then WebPreferences::setEnabledForFeature is called for "ConstantPropertiesEnabled" in addition to any other calls mentioned above.
Comment 2 Radar WebKit Bug Importer 2018-02-22 14:25:53 PST
<rdar://problem/37802321>
Comment 3 Frédéric Wang (:fredw) 2018-04-02 09:03:39 PDT
I tried again with XCode 9.3 and iOS 11.3 (released end of march 2018) ; the behavior has changed and is still difficult to determine... But here is what I now see:

1) Launch Safari with Tools/Script/run-safari --ios-simulator
2) Use Home button and go to "Settings => Safari => Experimental Features". Enable "Cache API", "Constant Properties", "Secure Contexts API", "Link Preload", "CSS Spring Animations", "Storage Access API" and "SubresourceIntegrity" and disable all the other options. Use Home button and go back to Safari, so that the settings are updated.
3) Debug MobileSafari, place a break point on WebPreferences::setEnabledForFeature after the key string is retrieved (DerivedSources/WebKit2/WebPreferencesExperimentalFeatures.cpp)
4) Use Home button, go back to Settings and enable AsyncFrameScrolling. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is called.
5) Use Home button, go back to Settings and disable AsyncFrameScrolling. Use Home button and go back to Safari, so that the settings are updated. Breakpoint is not called.

Actual result: WebPreferences::setEnabledForFeature is sometimes not called.
Expected result: WebPreferences::setEnabledForFeature should be called for each key that was modified.
Comment 4 Frédéric Wang (:fredw) 2018-06-18 05:49:36 PDT
(In reply to Frédéric Wang (:fredw) from comment #3)
> I tried again with XCode 9.3 and iOS 11.3 (released end of march 2018) ; the

The same behavior is noticed with XCode 9.4 and iOS 11.4 (June 15 update).
Comment 5 Frédéric Wang (:fredw) 2018-11-15 06:41:20 PST
For several existing features it is no longer possible to set them via the iOS experimental features menu because they have been moved to internal. See bug 191679.
Comment 6 Dean Jackson 2018-11-15 10:23:32 PST
Yes, this was intentional. A future version of iOS will no longer have those in the experimental features menu.

Is there a reason you need to toggle them?
Comment 7 Frédéric Wang (:fredw) 2018-11-15 10:38:21 PST
(In reply to Dean Jackson from comment #6)
> Yes, this was intentional. A future version of iOS will no longer have those
> in the experimental features menu.
> 
> Is there a reason you need to toggle them?

Thanks. I will be interested in AsyncFrameScrolling when the feature is ready to be tested by the users, but I think this can wait for now.