WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
23870
Allow ports to define restrictions on media loading
https://bugs.webkit.org/show_bug.cgi?id=23870
Summary
Allow ports to define restrictions on media loading
Eric Carlson
Reported
2009-02-10 10:37:54 PST
A port should be able to prevent automatic opening of media files by <video> and <audio> elements by returning an error from load() unless it is invoked as a result of a user gesture.
Attachments
proposed patch
(5.71 KB, patch)
2009-02-10 10:45 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
revised patch
(6.10 KB, patch)
2009-02-10 10:54 PST
,
Eric Carlson
simon.fraser
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Eric Carlson
Comment 1
2009-02-10 10:45:00 PST
Created
attachment 27523
[details]
proposed patch
Eric Carlson
Comment 2
2009-02-10 10:54:43 PST
Created
attachment 27530
[details]
revised patch added missing ChangeLog comments
Simon Fraser (smfr)
Comment 3
2009-02-10 11:07:08 PST
Comment on
attachment 27530
[details]
revised patch
> Index: WebCore/ChangeLog > ===================================================================
> +
https://bugs.webkit.org/post_bug.cgi
Please fix the link.
> + make it possible for a port to require a user gesture for an <audio> or <video> element > + to load a file
To load a url? Sentence case.
> Index: WebCore/html/HTMLMediaElement.cpp > ===================================================================
> - if (m_currentLoop < playCount() - 1 && currentTime() >= effectiveLoopEnd()) { > + float now = currentTime();
I'm worried about name conflicts with wtf/CurrentTime at some point, but that's not your problem.
> +bool HTMLMediaElement::processingUserGesture() > +{ > + Frame* frame = document()->frame(); > + FrameLoader *loader = frame ? frame->loader() : NULL;
For C++, use FrameLoader* loader Use 0 not NULL.
> + return loader ? loader->userGestureHint() : false;
Should this return 'true' in the failure case for safety?
> Index: WebCore/html/HTMLMediaElement.h > =================================================================== > --- WebCore/html/HTMLMediaElement.h (revision 40823) > +++ WebCore/html/HTMLMediaElement.h (working copy) > @@ -159,6 +159,8 @@ private: > void seek(float time, ExceptionCode& ec); > void checkIfSeekNeeded(); > > + bool processingUserGesture();
Make this |const|?
> + enum LoadingRestrictions
Rename to LoadRestrictions
> + { > + NO_RESTRICTIONS = 0, > + REQUIRE_USER_GESTURE = 1 << 0, > + };
Maybe rename to NoLoadRestriction, RequireUserGestureLoadRestriction r=me with those fixes
Eric Carlson
Comment 4
2009-02-17 14:38:49 PST
Committed revision 40828.
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