[webkit-changes] [WebKit/WebKit] f144d4: Regression(255659 at main) ABN AMRO Creditcard app ha...

Chris Dumez noreply at github.com
Fri Feb 24 13:32:15 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f144d4e39c665081571eb0557f347d3e19d6522b
      https://github.com/WebKit/WebKit/commit/f144d4e39c665081571eb0557f347d3e19d6522b
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-02-24 (Fri, 24 Feb 2023)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h
    M Source/WebCore/page/ScreenOrientation.idl
    M Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
    M Source/WebKit/Shared/WebPreferencesDefaultValues.h

  Log Message:
  -----------
  Regression(255659 at main) ABN AMRO Creditcard app hangs on launch
https://bugs.webkit.org/show_bug.cgi?id=252910
rdar://105743884

Reviewed by Geoffrey Garen.

This app is a Cordova/PhoneGap app using the following plugin to support the
screen orientation API:
- https://www.npmjs.com/package/cordova-plugin-screen-orientation

The app expects the screen orientation API to work and tries to lock the
orientation to portrait when on an iPhone. When we expose our native screen
orientation API support, the app's polyfill is no longer used and they try to
lock the orientation using our native API. However, we reject the orientation
locking promise with an UnsupportedError since we only support orientation lock
after using the JS fullscreen API to be in full screen. The promise rejection
was breaking the app, causing it to stop loading after showing its splash
screen.

To address the issue, I made the following changes:
1. Move ScreenOrientation.lock() / ScreenOrientation.unlock() behind a runtime
feature flag, off by default. Sadly, these functions are not currently useful
and always reject the promise with UnsupportedError. The reasons for this are
that locking is gated on using the fullscreen API, which is currently supported
on iPad but not iPhone. As a result, no support on iPhone. While the fullscreen
API works on iPad, screen orientation locking usually doesn't because apps are
not in control of their orientation if they opt into multitask support (aka
split-view), which apps (such as MobileSafari) usually do.
2. Move the rest of the Screen Orientation API (the readonly part which works
well: ScreenOrientation.type, ScreenOrientation.angle, change event) behind
a linked-on-after check so that it gets exposed only when the app gets rebuilt
with the new SDK.

Change 1 was not sufficient to fix the app. The polyfill will not currently
add the lock() / unlock() functions if `screen.orientation` exists. For this
reason, it had to make change 2 as well.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h:
* Source/WebCore/page/ScreenOrientation.idl:
* Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultShouldEnableScreenOrientationAPI):
* Source/WebKit/Shared/WebPreferencesDefaultValues.h:

Canonical link: https://commits.webkit.org/260812@main




More information about the webkit-changes mailing list