WebKit Bugzilla
Attachment 340353 Details for
Bug 185615
: Storage Access API: Allow documents that have been granted storage access to also do a popup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185615-20180514140116.patch (text/plain), 6.11 KB, created by
Brent Fulgham
on 2018-05-14 14:01:16 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2018-05-14 14:01:16 PDT
Size:
6.11 KB
patch
obsolete
>Subversion Revision: 231727 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index efb1d0346ebcbc57e71ad9ff5d0299431c0794f4..b98b1b8091267423e35faa507b973b759ea11963 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-05-14 Brent Fulgham <bfulgham@apple.com> >+ >+ Storage Access API: Allow documents that have been granted storage access to also do a popup >+ https://bugs.webkit.org/show_bug.cgi?id=185615 >+ <rdar://problem/39105791> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * dom/Document.cpp: >+ (WebCore::Document::requestStorageAccess): If the user approves Storage Access, drain the JSC micro >+ task queue, establish a new UserInteraction scope, then drain the micro task queue after resolving >+ the promise. >+ * dom/UserGestureIndicator.cpp: >+ (WebCore::UserGestureToken::clearState): Remove one-time user interaction flag. >+ (WebCore::UserGestureIndicator::didConsumeOneTimeUserGesture): Mark the user interaction state as >+ having consumed its one-time access. >+ * dom/UserGestureIndicator.h: >+ (WebCore::UserGestureToken::processingUserGesture const): >+ (WebCore::UserGestureToken::processingUserGestureForMedia const): >+ * page/DOMWindow.cpp: >+ (WebCore::DOMWindow::open) Mark the one-time user interaction gesture as consumed (if appropriate) before >+ returning the newly-opened window. >+ > 2018-05-11 Daniel Bates <dabates@apple.com> > > [iOS] Text decoration of dragged content does not paint with opacity >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 95a3033408177ab8d2f4b3bd9bd5b7cac39aa12a..227ac6214b1947264a1befa066b2170258a46f0d 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -7620,7 +7620,9 @@ void Document::requestStorageAccess(Ref<DeferredPromise>&& promise) > > if (wasGranted) { > document->setHasFrameSpecificStorageAccess(true); >+ UserGestureIndicator gestureIndicator(ProcessingOneTimeUserGesture, document); > promise->resolve(); >+ document->vm().drainMicrotasks(); > } else > promise->reject(); > }); >diff --git a/Source/WebCore/dom/UserGestureIndicator.cpp b/Source/WebCore/dom/UserGestureIndicator.cpp >index 23c936f91b139a4e17ccd22b5cdf7d97815c9217..a8c106c3ecdb05ac4c99946a820fb1b00019f8c5 100644 >--- a/Source/WebCore/dom/UserGestureIndicator.cpp >+++ b/Source/WebCore/dom/UserGestureIndicator.cpp >@@ -46,6 +46,11 @@ UserGestureToken::~UserGestureToken() > observer(*this); > } > >+void UserGestureToken::clearState() >+{ >+ m_state = NotProcessingUserGesture; >+} >+ > UserGestureIndicator::UserGestureIndicator(std::optional<ProcessingUserGestureState> state, Document* document, UserGestureType gestureType, ProcessInteractionStyle processInteractionStyle) > : m_previousToken { currentToken() } > { >@@ -107,4 +112,19 @@ bool UserGestureIndicator::processingUserGestureForMedia() > return currentToken() ? currentToken()->processingUserGestureForMedia() : false; > } > >+void UserGestureIndicator::didConsumeOneTimeUserGesture() >+{ >+ if (!isMainThread()) >+ return; >+ >+ auto token = currentToken(); >+ if (!token) >+ return; >+ >+ if (token->state() != ProcessingOneTimeUserGesture) >+ return; >+ >+ token->clearState(); >+} >+ > } >diff --git a/Source/WebCore/dom/UserGestureIndicator.h b/Source/WebCore/dom/UserGestureIndicator.h >index cf8e393b863f7e4993cd20a23f9ae8552539e7ca..ea68c2c258724df3858413eb8201041035006c1e 100644 >--- a/Source/WebCore/dom/UserGestureIndicator.h >+++ b/Source/WebCore/dom/UserGestureIndicator.h >@@ -39,6 +39,7 @@ class Document; > enum ProcessingUserGestureState { > ProcessingUserGesture, > ProcessingPotentialUserGesture, >+ ProcessingOneTimeUserGesture, > NotProcessingUserGesture > }; > >@@ -54,8 +55,10 @@ public: > WEBCORE_EXPORT ~UserGestureToken(); > > ProcessingUserGestureState state() const { return m_state; } >- bool processingUserGesture() const { return m_state == ProcessingUserGesture; } >- bool processingUserGestureForMedia() const { return m_state == ProcessingUserGesture || m_state == ProcessingPotentialUserGesture; } >+ void clearState(); >+ >+ bool processingUserGesture() const { return m_state == ProcessingUserGesture || m_state == ProcessingOneTimeUserGesture; } >+ bool processingUserGestureForMedia() const { return m_state == ProcessingUserGesture || m_state == ProcessingPotentialUserGesture || m_state == ProcessingOneTimeUserGesture; } > UserGestureType gestureType() const { return m_gestureType; } > > void addDestructionObserver(WTF::Function<void (UserGestureToken&)>&& observer) >@@ -82,6 +85,7 @@ public: > > WEBCORE_EXPORT static bool processingUserGesture(); > WEBCORE_EXPORT static bool processingUserGestureForMedia(); >+ WEBCORE_EXPORT static void didConsumeOneTimeUserGesture(); > > // If a document is provided, its last known user gesture timestamp is updated. > enum class ProcessInteractionStyle { Immediate, Delayed }; >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index ffb07b8232278c340ae23b617b5f2435513d1cbf..ec1341f13eb7e8d2985d5a31edd14efea230312d 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -2380,8 +2380,12 @@ RefPtr<WindowProxy> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWin > return &targetFrame->windowProxy(); > } > >- auto newFrame = createWindow(urlString, frameName, parseWindowFeatures(windowFeaturesString), activeWindow, *firstFrame, *m_frame); >- return newFrame ? &newFrame->windowProxy() : nullptr; >+ if (auto newFrame = createWindow(urlString, frameName, parseWindowFeatures(windowFeaturesString), activeWindow, *firstFrame, *m_frame)) { >+ UserGestureIndicator::didConsumeOneTimeUserGesture(); >+ return &newFrame->windowProxy(); >+ } >+ >+ return nullptr; > } > > void DOMWindow::showModalDialog(const String& urlString, const String& dialogFeaturesString, DOMWindow& activeWindow, DOMWindow& firstWindow, const WTF::Function<void (DOMWindow&)>& prepareDialogFunction)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185615
:
340346
|
340353
|
340462
|
340469
|
340518
|
340536
|
340596