Title: [242138] trunk/Source/WebCore
- Revision
- 242138
- Author
- cdu...@apple.com
- Date
- 2019-02-27 11:03:21 -0800 (Wed, 27 Feb 2019)
Log Message
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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (242137 => 242138)
--- trunk/Source/WebCore/ChangeLog 2019-02-27 19:02:03 UTC (rev 242137)
+++ trunk/Source/WebCore/ChangeLog 2019-02-27 19:03:21 UTC (rev 242138)
@@ -1,3 +1,23 @@
+2019-02-27 Chris Dumez <cdu...@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 <grao...@apple.com>
Support Pointer Events on macOS
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (242137 => 242138)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2019-02-27 19:02:03 UTC (rev 242137)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2019-02-27 19:03:21 UTC (rev 242138)
@@ -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,14 +1878,38 @@
}
}
#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()
{
Document* document = this->document();
Modified: trunk/Source/WebCore/page/DOMWindow.h (242137 => 242138)
--- trunk/Source/WebCore/page/DOMWindow.h 2019-02-27 19:02:03 UTC (rev 242137)
+++ trunk/Source/WebCore/page/DOMWindow.h 2019-02-27 19:03:21 UTC (rev 242138)
@@ -353,6 +353,10 @@
void resetDOMWindowProperties();
+#if ENABLE(DEVICE_ORIENTATION)
+ void failedToRegisterDeviceMotionEventListener();
+#endif
+
bool isSameSecurityOriginAsMainFrame() const;
#if ENABLE(GAMEPAD)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes