Bug 210013 - REGRESSION (r259531?): [iOS] TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia is timing out
Summary: REGRESSION (r259531?): [iOS] TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPause...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Peng Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-04 19:08 PDT by Aakash Jain
Modified: 2020-05-12 12:12 PDT (History)
6 users (show)

See Also:


Attachments
Patch (9.95 KB, patch)
2020-04-06 17:08 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 Aakash Jain 2020-04-04 19:08:06 PDT
TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia seems to be failing consistently.

History: https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia

Results database indicate regression point as r259531 which was today (April 4). However, this issue was first noticed on EWS 2 days back (April 2) in https://ews-build.webkit.org/#/builders/9/builds/21024
Comment 1 Radar WebKit Bug Importer 2020-04-06 12:24:18 PDT
<rdar://problem/61353942>
Comment 2 Peng Liu 2020-04-06 12:37:05 PDT
This seems to be problem for a while. See comment 14 of webkit.org/b/192829.
Comment 3 Ryan Haddad 2020-04-06 12:42:03 PDT
(In reply to Peng Liu from comment #2)
> This seems to be problem for a while. See comment 14 of webkit.org/b/192829.
It looks like the test has been intermittently timing out for a while, but something changed with r259531 that made it 100% reproducible.
Comment 4 Peng Liu 2020-04-06 17:08:49 PDT
Created attachment 395634 [details]
Patch
Comment 5 Daniel Bates 2020-04-06 19:06:29 PDT
Comment on attachment 395634 [details]
Patch

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

Patch looks good.

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:41
> +static bool didFinishLoad = false;

Ok as is. No change is needed.  The current code is the optimal solution: no initialization is needed.

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:42
> +static bool gotMainFrame = false;

Ditto

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:45
> +static bool readyToTest = false;

Ditto for this line and 2 more below.

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:46
> +static bool didReceivePause  = false;

Ok as is. No change needed. Look like extra space after before =

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:79
> +    RetainPtr<WebPreferences> preferences = [WebPreferences standardPreferences];

Ok as is. No change needed. The optimal solution stores into raw pointer because function returns process global singleton.

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:80
> +    preferences.get().mediaDataLoadsAutomatically = YES;

Ok as is. No change needed. The optimal solution is to not use .get() and switch to [preferences serX:....] notation because it aesthetically  more pleasing to read and idiomatic. Same remarks for next two lines below

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:91
> +    [uiWebView loadRequest:[NSURLRequest requestWithURL:[NSBundle.mainBundle URLForResource:@"one-video" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];

Ok as is. No change needed. There may be an existing helper method that returns the resource URL relative to the bundle or a test function that does that + load it (at least there is one on TestWKWebView$.

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:99
> +        DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"];

Ok as is. No change needed. The optimal solution uses RetainPtr because future proofs this code should in the future is added that causes document destruction.

> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:113
> +        DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"];

Ok as is. No change needed. The optimal  solution uses retainptr
Comment 6 EWS 2020-04-06 20:39:45 PDT
Committed r259622: <https://trac.webkit.org/changeset/259622>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395634 [details].
Comment 7 Daniel Bates 2020-04-06 21:21:26 PDT
Comment on attachment 395634 [details]
Patch

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

>> Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:99
>> +        DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"];
> 
> Ok as is. No change needed. The optimal solution uses RetainPtr because future proofs this code should in the future is added that causes document destruction.

Optimal solution is right, but the reason for it is wrong (since the DOMNode refs the WebCore::Node). The real reason is to future proof against future code that may drain the autorelease pool.