WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
209950
WebCore::HTMLMediaElement::mediaCanStart crashes
https://bugs.webkit.org/show_bug.cgi?id=209950
Summary
WebCore::HTMLMediaElement::mediaCanStart crashes
Peng Liu
Reported
2020-04-02 20:14:24 PDT
WebCore::HTMLMediaElement::mediaCanStart crashes
Attachments
Patch
(4.99 KB, patch)
2020-04-02 21:10 PDT
,
Peng Liu
jer.noble
: review+
Details
Formatted Diff
Diff
Patch for landing (replace computeSize() with computesEmpty())
(4.98 KB, patch)
2020-04-02 22:29 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Peng Liu
Comment 1
2020-04-02 20:22:34 PDT
<
rdar://problem/49677331
>
Peng Liu
Comment 2
2020-04-02 21:10:29 PDT
Created
attachment 395343
[details]
Patch
Jer Noble
Comment 3
2020-04-02 21:25:21 PDT
Comment on
attachment 395343
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=395343&action=review
r=me, with nits.
> Source/WebCore/dom/Document.cpp:6426 > void Document::addMediaCanStartListener(MediaCanStartListener& listener) > { > - ASSERT(!m_mediaCanStartListeners.contains(&listener)); > - m_mediaCanStartListeners.add(&listener); > + ASSERT(!m_mediaCanStartListeners.contains(listener)); > + m_mediaCanStartListeners.add(listener);
The way I'd do this would be: void Document::addMediaCanStartListener(WeakPtr<MediaCanStartListener>&& listener) { ASSERT(!m_mediaCanStartListeners.contains(listener)); m_mediaCanStartListeners.add(WTFMove(listener)); } This way, MediaCanStartListener doesn't need to directly inherit from CanMakeWeakPtr.
> Source/WebCore/dom/Document.cpp:6437 > + if (!m_mediaCanStartListeners.computeSize())
I think this could be: `if (m_mediaCanStartListeners.computeEmpty())`.
> Source/WebKit/WebProcess/MediaStream/UserMediaPermissionRequestManager.h:37 > -class UserMediaPermissionRequestManager : public CanMakeWeakPtr<UserMediaPermissionRequestManager>, private WebCore::MediaCanStartListener { > +class UserMediaPermissionRequestManager : private WebCore::MediaCanStartListener {
Then this could get reverted. It would mean all the call sites to addMediaCanStartListener() would have to change, though.
Peng Liu
Comment 4
2020-04-02 21:54:25 PDT
Comment on
attachment 395343
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=395343&action=review
>> Source/WebCore/dom/Document.cpp:6426 >> + m_mediaCanStartListeners.add(listener); > > The way I'd do this would be: > > void Document::addMediaCanStartListener(WeakPtr<MediaCanStartListener>&& listener) > { > ASSERT(!m_mediaCanStartListeners.contains(listener)); > m_mediaCanStartListeners.add(WTFMove(listener)); > } > > This way, MediaCanStartListener doesn't need to directly inherit from CanMakeWeakPtr.
That's a good idea! Unfortunately it requires us to add WeakHashSet::add(WeakPtr<U>&& value) to the current implementation.
>> Source/WebCore/dom/Document.cpp:6437 >> + if (!m_mediaCanStartListeners.computeSize()) > > I think this could be: `if (m_mediaCanStartListeners.computeEmpty())`.
Yes, that will work. I chose to use computeSize() because it will clean up nullptrs.
>> Source/WebKit/WebProcess/MediaStream/UserMediaPermissionRequestManager.h:37 >> +class UserMediaPermissionRequestManager : private WebCore::MediaCanStartListener { > > Then this could get reverted. > > It would mean all the call sites to addMediaCanStartListener() would have to change, though.
Maybe we can do it later after extending WeakHashSet.
Peng Liu
Comment 5
2020-04-02 22:29:36 PDT
Created
attachment 395349
[details]
Patch for landing (replace computeSize() with computesEmpty())
EWS
Comment 6
2020-04-03 00:21:09 PDT
Committed
r259447
: <
https://trac.webkit.org/changeset/259447
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 395349
[details]
.
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