WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
62601
anyPageIsProcessingUserGesture is not longer needed because user gesture state is static
https://bugs.webkit.org/show_bug.cgi?id=62601
Summary
anyPageIsProcessingUserGesture is not longer needed because user gesture stat...
WebKit Review Bot
Reported
2011-06-13 14:56:02 PDT
anyPageIsProcessingUserGesture is not longer needed because user gesture state is static Requested by abarth on #webkit.
Attachments
work-in-progress
(15.06 KB, patch)
2011-06-13 14:58 PDT
,
Adam Barth
no flags
Details
Formatted Diff
Diff
Patch
(17.57 KB, patch)
2011-06-13 15:29 PDT
,
Adam Barth
no flags
Details
Formatted Diff
Diff
Patch for landing
(17.35 KB, patch)
2011-06-13 15:44 PDT
,
Adam Barth
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Adam Barth
Comment 1
2011-06-13 14:58:02 PDT
Created
attachment 97012
[details]
work-in-progress
Adam Barth
Comment 2
2011-06-13 15:29:03 PDT
Created
attachment 97018
[details]
Patch
Adam Barth
Comment 3
2011-06-13 15:30:36 PDT
+ some folks who might like to review this beautiful patch. :)
Darin Adler
Comment 4
2011-06-13 15:35:12 PDT
Comment on
attachment 97018
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=97018&action=review
> Source/WebCore/bindings/ScriptControllerBase.cpp:59 > + // FIXME: Why does the URL of the script depend on forceUserGesture? > + // This looks suspiciously like an old user-gesture back-channel. > return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->document()->url()));
Fix me indeed! WTF?
> Source/WebCore/bindings/js/JSDocumentCustom.cpp:81 > + bool lockHistory = !ScriptController::processingUserGesture();
I am no fan of this “lock history” name. You are not the first to use it, nor will you be the last. But I am not interested in the history of locks!
> Source/WebCore/page/DOMWindow.cpp:1823 > targetFrame->navigationScheduler()->scheduleLocationChange(activeFrame->document()->securityOrigin(), > - firstFrame->document()->completeURL(urlString).string(), > - firstFrame->loader()->outgoingReferrer(), > - !activeFrame->script()->anyPageIsProcessingUserGesture(), false); > - > + firstFrame->document()->completeURL(urlString).string(), > + firstFrame->loader()->outgoingReferrer(), > + lockHistory, > + false); > return targetFrame->domWindow();
Our coding style guidelines tell us to line things up the way this was before, not the way it is after. I’m guessing your editor wanted to help you do it this way. I would be happier with a style that does not require re-indenting when we rename something.
Eric Seidel (no email)
Comment 5
2011-06-13 15:37:21 PDT
Comment on
attachment 97018
[details]
Patch LGTM. It's a bit silly that we have to transmute the processingUserGesture() bool into the lockHistory bool, but I don't have a better suggestion.
Eric Seidel (no email)
Comment 6
2011-06-13 15:37:43 PDT
Comment on
attachment 97018
[details]
Patch Clearing my cq+ after seeing Darin's comments.
Adam Barth
Comment 7
2011-06-13 15:38:59 PDT
> > Source/WebCore/bindings/js/JSDocumentCustom.cpp:81 > > + bool lockHistory = !ScriptController::processingUserGesture(); > > I am no fan of this “lock history” name. You are not the first to use it, nor will you be the last. But I am not interested in the history of locks!
Yeah, I don't really understand what lockHistory means either. I'm just copying the name of the formal parameter so it's clear what this argument means.
> > Source/WebCore/page/DOMWindow.cpp:1823 > > targetFrame->navigationScheduler()->scheduleLocationChange(activeFrame->document()->securityOrigin(), > > - firstFrame->document()->completeURL(urlString).string(), > > - firstFrame->loader()->outgoingReferrer(), > > - !activeFrame->script()->anyPageIsProcessingUserGesture(), false); > > - > > + firstFrame->document()->completeURL(urlString).string(), > > + firstFrame->loader()->outgoingReferrer(), > > + lockHistory, > > + false); > > return targetFrame->domWindow(); > > Our coding style guidelines tell us to line things up the way this was before, not the way it is after. I’m guessing your editor wanted to help you do it this way. I would be happier with a style that does not require re-indenting when we rename something.
Will fix. Thanks for the review.
Adam Barth
Comment 8
2011-06-13 15:39:40 PDT
> LGTM. It's a bit silly that we have to transmute the processingUserGesture() bool into the lockHistory bool, but I don't have a better suggestion.
We don't need to. I just always forget what these arguments are and figured I should write it into the code instead of looking it up for the Nth time.
David Levin
Comment 9
2011-06-13 15:40:51 PDT
View in context:
https://bugs.webkit.org/attachment.cgi?id=97018&action=review
> Source/WebCore/page/DOMWindow.cpp:1817 > + bool lockHistory = !ScriptController::processingUserGesture();
It almost looks like this happens at every call site. Perhaps it would be nice to move it inside of scheduleLocationChange if possible (at some point).
Adam Barth
Comment 10
2011-06-13 15:43:39 PDT
(In reply to
comment #9
)
> View in context:
https://bugs.webkit.org/attachment.cgi?id=97018&action=review
> > > Source/WebCore/page/DOMWindow.cpp:1817 > > + bool lockHistory = !ScriptController::processingUserGesture(); > > It almost looks like this happens at every call site. Perhaps it would be nice to move it inside of scheduleLocationChange if possible (at some point).
Good idea. I'll study that next.
Adam Barth
Comment 11
2011-06-13 15:44:56 PDT
Created
attachment 97022
[details]
Patch for landing
WebKit Review Bot
Comment 12
2011-06-13 16:28:36 PDT
Comment on
attachment 97022
[details]
Patch for landing Clearing flags on attachment: 97022 Committed
r88731
: <
http://trac.webkit.org/changeset/88731
>
WebKit Review Bot
Comment 13
2011-06-13 16:28:41 PDT
All reviewed patches have been landed. Closing bug.
Johnny(Jianning) Ding
Comment 14
2011-06-14 04:21:45 PDT
> > Source/WebCore/bindings/ScriptControllerBase.cpp:59 > > + // FIXME: Why does the URL of the script depend on forceUserGesture? > > + // This looks suspiciously like an old user-gesture back-channel. > > return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->document()->url())); > > Fix me indeed! WTF?
I can explain this FIXME:) In ScriptController::processingUserGesture(), we treat current call running in a user gesture if the URL of running script is empty. See ScriptController::isJavaScriptAnchorNavigation() in jsc binding. It is a trick for some scripts which must be run as user gesture like inline javascript in href of <A>. See ScriptController::evaluateInWorld in jsc binding. WebKit also uses this trick to support the manual typed javascript running as a user geature. Think about typing javascript:window.open(url) in address bar, then WebKit will pass true to forceUserGesture when calling ScriptController::executeScript(script, forceUserGesture), that is why the URL of the script depends on forceUserGesture. If we want to eliminate this URL-gesture dependence, we can add a bool member named forceGesture in ScriptController and check it in ScriptController::processingUserGesture. Does it make sense?
Adam Barth
Comment 15
2011-06-14 09:36:52 PDT
> If we want to eliminate this URL-gesture dependence, we can add a bool member named forceGesture in ScriptController and check it in ScriptController::processingUserGesture. Does it make sense?
Why don't we just set the user gesture indicator to DefinitelyProcessingUserGesture?
Johnny(Jianning) Ding
Comment 16
2011-06-15 06:08:43 PDT
(In reply to
comment #15
)
> > If we want to eliminate this URL-gesture dependence, we can add a bool member named forceGesture in ScriptController and check it in ScriptController::processingUserGesture. Does it make sense? > > Why don't we just set the user gesture indicator to DefinitelyProcessingUserGesture?
you are right, should be this way
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug