Bug 226305

Summary: Calling -[WKWebView _closeAllMediaPresentations] crashes
Product: WebKit Reporter: Peng Liu <peng.liu6>
Component: New BugsAssignee: Peng Liu <peng.liu6>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, eric.carlson, katherine_cheney, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=226340
Attachments:
Description Flags
Patch
none
Add an API test
cdumez: review+
Fix a mistake in the API test
none
Patch for landing none

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].