Title: [242140] branches/safari-607-branch/Source/WebCore
- Revision
- 242140
- Author
- alanc...@apple.com
- Date
- 2019-02-27 11:44:50 -0800 (Wed, 27 Feb 2019)
Log Message
Cherry-pick r242138. rdar://problem/48444136
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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (242139 => 242140)
--- branches/safari-607-branch/Source/WebCore/ChangeLog 2019-02-27 19:15:28 UTC (rev 242139)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog 2019-02-27 19:44:50 UTC (rev 242140)
@@ -1,3 +1,48 @@
+2019-02-27 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r242138. rdar://problem/48444136
+
+ 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:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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 Babak Shafiei <bshaf...@apple.com>
Cherry-pick r242099. rdar://problem/48429675
Modified: branches/safari-607-branch/Source/WebCore/page/DOMWindow.cpp (242139 => 242140)
--- branches/safari-607-branch/Source/WebCore/page/DOMWindow.cpp 2019-02-27 19:15:28 UTC (rev 242139)
+++ branches/safari-607-branch/Source/WebCore/page/DOMWindow.cpp 2019-02-27 19:44:50 UTC (rev 242140)
@@ -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"
@@ -1883,14 +1885,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: branches/safari-607-branch/Source/WebCore/page/DOMWindow.h (242139 => 242140)
--- branches/safari-607-branch/Source/WebCore/page/DOMWindow.h 2019-02-27 19:15:28 UTC (rev 242139)
+++ branches/safari-607-branch/Source/WebCore/page/DOMWindow.h 2019-02-27 19:44:50 UTC (rev 242140)
@@ -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