Skip to content
Permalink
Browse files
Unable to log into chase.com on iPad when DeviceMotionEvent API is di…
…sabled

https://bugs.webkit.org/show_bug.cgi?id=195101
<rdar://problem/48423023>

Reviewed by Geoffrey Garen.

Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
tries to register a "devicemotion" event listener and fails because the API is disabled. This is
needed to unblock the site and proceed with the login flow.

Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
guard the quirk behind this flag.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
* page/DOMWindow.h:


Canonical link: https://commits.webkit.org/209454@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Feb 27, 2019
1 parent 8d0069b commit 48264447d2888aed97b308f6d2a8eba5cf32b9ec
Showing 3 changed files with 51 additions and 1 deletion.
@@ -1,3 +1,23 @@
2019-02-27 Chris Dumez <cdumez@apple.com>

Unable to log into chase.com on iPad when DeviceMotionEvent API is disabled
https://bugs.webkit.org/show_bug.cgi?id=195101
<rdar://problem/48423023>

Reviewed by Geoffrey Garen.

Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
tries to register a "devicemotion" event listener and fails because the API is disabled. This is
needed to unblock the site and proceed with the login flow.

Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
guard the quirk behind this flag.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
* page/DOMWindow.h:

2019-02-27 Antoine Quint <graouts@apple.com>

Support Pointer Events on macOS
@@ -47,6 +47,8 @@
#include "DOMURL.h"
#include "DOMWindowExtension.h"
#include "DeviceMotionController.h"
#include "DeviceMotionData.h"
#include "DeviceMotionEvent.h"
#include "DeviceOrientationController.h"
#include "Document.h"
#include "DocumentLoader.h"
@@ -1876,12 +1878,36 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, Ref<EventListene
}
}
#endif // PLATFORM(IOS_FAMILY)
}
} else if (eventType == eventNames().devicemotionEvent)
failedToRegisterDeviceMotionEventListener();
#endif // ENABLE(DEVICE_ORIENTATION)

return true;
}

#if ENABLE(DEVICE_ORIENTATION)

void DOMWindow::failedToRegisterDeviceMotionEventListener()
{
#if PLATFORM(IOS_FAMILY)
if (!isSameSecurityOriginAsMainFrame() || !isSecureContext())
return;

// FIXME: This is a quirk for chase.com on iPad (<rdar://problem/48423023>).
if (toRegistrableDomain(document()->url()) == "chase.com") {
// Fire a fake DeviceMotionEvent with acceleration data to unblock the site's login flow.
document()->postTask([](auto& context) {
if (auto* window = downcast<Document>(context).domWindow()) {
auto acceleration = DeviceMotionData::Acceleration::create();
window->dispatchEvent(DeviceMotionEvent::create(eventNames().devicemotionEvent, DeviceMotionData::create(acceleration.copyRef(), acceleration.copyRef(), DeviceMotionData::RotationRate::create(), WTF::nullopt).ptr()));
}
});
}
#endif // PLATFORM(IOS_FAMILY)
}

#endif // ENABLE(DEVICE_ORIENTATION)

#if PLATFORM(IOS_FAMILY)

void DOMWindow::incrementScrollEventListenersCount()
@@ -353,6 +353,10 @@ class DOMWindow final

void resetDOMWindowProperties();

#if ENABLE(DEVICE_ORIENTATION)
void failedToRegisterDeviceMotionEventListener();
#endif

bool isSameSecurityOriginAsMainFrame() const;

#if ENABLE(GAMEPAD)

0 comments on commit 4826444

Please sign in to comment.