Bug 210859 - fast/events/event-handler-detached-document-dispatchEvent.html is crashing
Summary: fast/events/event-handler-detached-document-dispatchEvent.html is crashing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-22 08:43 PDT by Eric Carlson
Modified: 2020-04-22 12:38 PDT (History)
9 users (show)

See Also:


Attachments
Patch (4.28 KB, patch)
2020-04-22 08:55 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing. (4.28 KB, patch)
2020-04-22 10:52 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2020-04-22 08:43:27 PDT
r260182 causes fast/events/event-handler-detached-document-dispatchEvent.html to crash.
Comment 1 Eric Carlson 2020-04-22 08:43:50 PDT
<rdar://problem/62072269>
Comment 2 Eric Carlson 2020-04-22 08:55:40 PDT
Created attachment 397197 [details]
Patch
Comment 3 Jer Noble 2020-04-22 09:53:22 PDT
Comment on attachment 397197 [details]
Patch

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

r=me, with nit.

> Source/WebCore/html/MediaElementSession.cpp:146
> +    if (m_haveAddedMediaUsageManagerSession)
> +        return;
> +
> +    auto page = m_element.document().page();
> +    if (!page)
> +        return;
> +
> +    page->chrome().client().addMediaUsageManagerSession(mediaSessionIdentifier(), m_element.sourceApplicationIdentifier(), m_element.document().url());
> +    m_haveAddedMediaUsageManagerSession = true;

A smart person once told me <https://bugs.webkit.org/show_bug.cgi?id=210589#c3> that they preferred to set this kind of state before calling the callback to protect against re-entrancy. ;)
Comment 4 Eric Carlson 2020-04-22 10:50:47 PDT
Comment on attachment 397197 [details]
Patch

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

>> Source/WebCore/html/MediaElementSession.cpp:146
>> +    m_haveAddedMediaUsageManagerSession = true;
> 
> A smart person once told me <https://bugs.webkit.org/show_bug.cgi?id=210589#c3> that they preferred to set this kind of state before calling the callback to protect against re-entrancy. ;)

LOL, good point!
Comment 5 Eric Carlson 2020-04-22 10:52:23 PDT
Created attachment 397224 [details]
Patch for landing.
Comment 6 EWS 2020-04-22 12:38:04 PDT
Committed r260529: <https://trac.webkit.org/changeset/260529>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397224 [details].