Title: [222022] branches/safari-604-branch/Source/WebCore
Revision
222022
Author
[email protected]
Date
2017-09-14 09:15:29 -0700 (Thu, 14 Sep 2017)

Log Message

Cherry-pick r221968. rdar://problem/34169683

Modified Paths

Diff

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (222021 => 222022)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-09-14 16:09:03 UTC (rev 222021)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-09-14 16:15:29 UTC (rev 222022)
@@ -1,3 +1,33 @@
+2017-09-14  Jason Marcell  <[email protected]>
+
+        Cherry-pick r221968. rdar://problem/34169683
+
+    2017-09-12  Matt Rajca  <[email protected]>
+
+            Ensure the user interacted with the page before setting m_userHasInteractedWithMediaElement
+            https://bugs.webkit.org/show_bug.cgi?id=176816
+
+            Reviewed by Eric Carlson.
+
+            Currently, when the user presses a keyboard shortcut in the client to reload a page, that may
+            get registered as a user gesture on the reloaded page. Before setting the
+            m_userHasInteractedWithMediaElement flag, we should check if a user gesture was actually handled
+            by checking the userDidInteractWithPage flag. In case of key events that aren't handled by the
+            page, this will be set to false by EventHandler:
+
+                // If the key event was not handled, do not treat it as user interaction with the page.
+                if (topDocument && !wasHandled)
+                    topDocument->setUserDidInteractWithPage(savedUserDidInteractWithPage);
+
+            We need to revisit this in the future in webkit.org/b/176817 and ensure user gesture tokens
+            don't carry over across reloads of the page.
+
+            Tests: I wasn't able to trigger the pathological scenario this aims to fix with a test that calls
+            window.location.reload() from a synthetic keyDown event.
+
+            * dom/Document.cpp:
+            (WebCore::Document::noteUserInteractionWithMediaElement):
+
 2017-09-12  Jason Marcell  <[email protected]>
 
         Cherry-pick r221917. rdar://problem/34404461

Modified: branches/safari-604-branch/Source/WebCore/dom/Document.cpp (222021 => 222022)


--- branches/safari-604-branch/Source/WebCore/dom/Document.cpp	2017-09-14 16:09:03 UTC (rev 222021)
+++ branches/safari-604-branch/Source/WebCore/dom/Document.cpp	2017-09-14 16:15:29 UTC (rev 222022)
@@ -3608,6 +3608,9 @@
     if (m_userHasInteractedWithMediaElement)
         return;
 
+    if (!topDocument().userDidInteractWithPage())
+        return;
+
     m_userHasInteractedWithMediaElement = true;
     updateIsPlayingMedia();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to