Bug 166957 - [WK2][Cocoa] Avoid null dereference in Fullscreen code.
Summary: [WK2][Cocoa] Avoid null dereference in Fullscreen code.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-01-11 18:01 PST by Brent Fulgham
Modified: 2017-01-11 21:06 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.66 KB, patch)
2017-01-11 18:04 PST, Brent Fulgham
eric.carlson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2017-01-11 18:01:13 PST
Crash tracing statistics indicate that the 'WebVideoFullScreenManager::didSetupFullscreen' encounters stability issues under certain conditions.

We do not have a reproducible test case showing this behavior, but code inspection indicates that the page values in the completion Block were not being referenced consistently with other methods in the same class. It also did not account for the possibility that the page object had been cleared between starting the dispatch and when the block actually runs.
Comment 1 Brent Fulgham 2017-01-11 18:01:29 PST
<rdar://problem/27745004>
Comment 2 Brent Fulgham 2017-01-11 18:04:18 PST
Created attachment 298649 [details]
Patch
Comment 3 Eric Carlson 2017-01-11 18:08:49 PST
Comment on attachment 298649 [details]
Patch

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

> Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm:333
> +            if (strongThis->m_page)
> +                strongThis->m_page->send(Messages::WebVideoFullscreenManagerProxy::EnterFullscreen(contextId), strongThis->m_page->pageID());

Nit: "strongThis" is only really necessary for the "if". Leaving the second line with implied "this" looks cleaner IMO. It would probably be even better to return early if m_page is NULL.
Comment 4 Brent Fulgham 2017-01-11 21:04:39 PST
Committed r210619: <http://trac.webkit.org/changeset/210619>
Comment 5 Brent Fulgham 2017-01-11 21:06:48 PST
Comment on attachment 298649 [details]
Patch

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

>> Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm:333
>> +                strongThis->m_page->send(Messages::WebVideoFullscreenManagerProxy::EnterFullscreen(contextId), strongThis->m_page->pageID());
> 
> Nit: "strongThis" is only really necessary for the "if". Leaving the second line with implied "this" looks cleaner IMO. It would probably be even better to return early if m_page is NULL.

OK!