Bug 226305 - Calling -[WKWebView _closeAllMediaPresentations] crashes
Summary: Calling -[WKWebView _closeAllMediaPresentations] crashes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Peng Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-26 16:42 PDT by Peng Liu
Modified: 2021-09-09 16:37 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.35 KB, patch)
2021-05-26 16:50 PDT, Peng Liu
no flags Details | Formatted Diff | Diff
Add an API test (3.94 KB, patch)
2021-05-26 17:37 PDT, Peng Liu
cdumez: review+
Details | Formatted Diff | Diff
Fix a mistake in the API test (4.11 KB, patch)
2021-05-26 20:04 PDT, Peng Liu
no flags Details | Formatted Diff | Diff
Patch for landing (4.10 KB, patch)
2021-05-27 09:50 PDT, Peng Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peng Liu 2021-05-26 16:42:41 PDT
Calling -[WKWebView _closeAllMediaPresentations] crashes
Comment 1 Peng Liu 2021-05-26 16:50:23 PDT
<rdar://78538835>
Comment 2 Peng Liu 2021-05-26 16:50:46 PDT
Created attachment 429814 [details]
Patch
Comment 3 Chris Dumez 2021-05-26 16:51:30 PDT
Comment on attachment 429814 [details]
Patch

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

> Source/WebKit/ChangeLog:11
> +        (-[WKWebView _closeAllMediaPresentations]):

Can we write an API test for this?
Comment 4 Peng Liu 2021-05-26 16:56:06 PDT
Comment on attachment 429814 [details]
Patch

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

>> Source/WebKit/ChangeLog:11
>> +        (-[WKWebView _closeAllMediaPresentations]):
> 
> Can we write an API test for this?

Yes. Let me add a test.
Comment 5 Peng Liu 2021-05-26 17:37:58 PDT
Created attachment 429819 [details]
Add an API test
Comment 6 Peng Liu 2021-05-26 20:04:02 PDT
Created attachment 429831 [details]
Fix a mistake in the API test
Comment 7 Eric Carlson 2021-05-27 08:42:26 PDT
Comment on attachment 429831 [details]
Fix a mistake in the API test

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:111
> +    } while (true);

I think it would be better to loop a fixed number of times so if the test fails rather than timings out if it doesn't exit from PiP for some reason.
Comment 8 Peng Liu 2021-05-27 09:46:58 PDT
Comment on attachment 429831 [details]
Fix a mistake in the API test

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

>> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:111
>> +    } while (true);
> 
> I think it would be better to loop a fixed number of times so if the test fails rather than timings out if it doesn't exit from PiP for some reason.

Agree.
Actually this pattern is used multiple times in this file. Filed bug 226340 to fix all of them.
Comment 9 Peng Liu 2021-05-27 09:50:25 PDT
Created attachment 429888 [details]
Patch for landing
Comment 10 EWS 2021-05-27 10:56:28 PDT
Committed r278169 (238213@main): <https://commits.webkit.org/238213@main>

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