Bug 143720 - Media elements not in a page shouldn't load
Summary: Media elements not in a page shouldn't load
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-14 12:51 PDT by Brady Eidson
Modified: 2015-04-14 14:25 PDT (History)
2 users (show)

See Also:


Attachments
Patch v1 (2.23 KB, patch)
2015-04-14 12:56 PDT, Brady Eidson
jer.noble: review+
jer.noble: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (2.82 KB, patch)
2015-04-14 13:03 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Real patch for landing. (1.35 KB, patch)
2015-04-14 13:15 PDT, Brady Eidson
beidson: commit-queue-
Details | Formatted Diff | Diff
Land it (1.34 KB, patch)
2015-04-14 13:35 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2015-04-14 12:51:19 PDT
Media elements not in a page shouldn't load
Comment 1 Brady Eidson 2015-04-14 12:51:36 PDT
Noticed while working on an unrelated patch.

Have no test to reproduce.
Comment 2 Brady Eidson 2015-04-14 12:56:30 PDT
Created attachment 250727 [details]
Patch v1
Comment 3 Jer Noble 2015-04-14 12:58:19 PDT
Comment on attachment 250727 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=250727&action=review

> Source/WebCore/html/HTMLMediaSession.cpp:146
> -    if (m_restrictions & RequirePageConsentToLoadMedia && page && !page->canStartMedia()) {
> +    if (!page || !page->canStartMedia() || m_restrictions & RequirePageConsentToLoadMedia) {

This should be: if (m_restrictions & RequirePageConsentToLoadMedia && (!page || !page->canStartMedia()))
Comment 4 Brady Eidson 2015-04-14 12:59:50 PDT
(In reply to comment #3)
> Comment on attachment 250727 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250727&action=review
> 
> > Source/WebCore/html/HTMLMediaSession.cpp:146
> > -    if (m_restrictions & RequirePageConsentToLoadMedia && page && !page->canStartMedia()) {
> > +    if (!page || !page->canStartMedia() || m_restrictions & RequirePageConsentToLoadMedia) {
> 
> This should be: if (m_restrictions & RequirePageConsentToLoadMedia && (!page
> || !page->canStartMedia()))

Kinda.

The page checks should be first.

But the joining clause after them *should* be an or.

Thanks!
Comment 5 Brady Eidson 2015-04-14 13:00:19 PDT
(In reply to comment #4)

> Kinda.
> 
> The page checks should be first.
> 
> But the joining clause after them *should* be an or.
> 

I meant it should be an and.  *sigh*
Comment 6 Brady Eidson 2015-04-14 13:03:14 PDT
We found another one we discussed on IRC.
Comment 7 Brady Eidson 2015-04-14 13:03:32 PDT
Created attachment 250729 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2015-04-14 13:04:39 PDT
Attachment 250729 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Brady Eidson 2015-04-14 13:15:07 PDT
Created attachment 250731 [details]
Real patch for landing.

Disagreement on the media session parts - landing only the loadResource part.
Comment 10 Darin Adler 2015-04-14 13:21:28 PDT
Comment on attachment 250727 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=250727&action=review

> Source/WebCore/html/HTMLMediaElement.cpp:1093
> +    if (!frame->mainFrame().page()) {

Should just be frame->page().
Comment 11 Brady Eidson 2015-04-14 13:33:33 PDT
(In reply to comment #10)
> Comment on attachment 250727 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250727&action=review
> 
> > Source/WebCore/html/HTMLMediaElement.cpp:1093
> > +    if (!frame->mainFrame().page()) {
> 
> Should just be frame->page().

Yup, you're definitely correct. Brain dead copy mistake.
Comment 12 Brady Eidson 2015-04-14 13:35:13 PDT
Created attachment 250734 [details]
Land it
Comment 13 WebKit Commit Bot 2015-04-14 14:25:47 PDT
Comment on attachment 250734 [details]
Land it

Clearing flags on attachment: 250734

Committed r182810: <http://trac.webkit.org/changeset/182810>
Comment 14 WebKit Commit Bot 2015-04-14 14:25:50 PDT
All reviewed patches have been landed.  Closing bug.