Bug 252554 - WebKitTestRunner: Non-Cocoa TestController::platformAdjustContext should recreate WKPreferences
Summary: WebKitTestRunner: Non-Cocoa TestController::platformAdjustContext should recr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-19 23:21 PST by Fujii Hironori
Modified: 2023-02-22 13:34 PST (History)
2 users (show)

See Also:


Attachments
WIP patch (674 bytes, patch)
2023-02-20 21:36 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (1.48 KB, patch)
2023-02-21 12:48 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
[fast-cq] Patch (1.51 KB, patch)
2023-02-22 12:42 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2023-02-19 23:21:20 PST
favicon-loads-with-images-disabled.html has LoadsImagesAutomatically=false.
It makes some subsequent tests fail.

Unexpected flakiness: text-only failures (2)
  http/tests/misc/image-blocked-src-change.html [ Pass Failure ]
Unexpected flakiness: timeouts (2)
  http/tests/misc/image-checks-for-accept.html [ Timeout Pass ]
Comment 1 Fujii Hironori 2023-02-20 21:36:08 PST
Created attachment 465103 [details]
WIP patch
Comment 2 Fujii Hironori 2023-02-20 22:39:34 PST
This isn't producible with Mac port. How does it reset the pref?

> run-webkit-tests http/tests/misc/favicon-loads-with-icon-loading-override.html http/tests/misc/image-blocked-src-change.html --iterations=2 --child-processes=1
Comment 3 Fujii Hironori 2023-02-20 23:52:47 PST
The implementations of TestController::platformPreferences and
TestController::platformAdjustContext are different.

TestController::ensureViewSupportsOptionsForTest decides to
create a new webview because test options don't match.

However, non-Cocoa TestController::platformPreferences constantly
returns a same preference object.

Cocoa's TestController::platformAdjustContext re-initializes it.
Comment 4 Fujii Hironori 2023-02-21 12:24:31 PST
The result of "grep -r LoadsImagesAutomatically *" in LayoutTests directory:

> fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html\012:    internals.settings.setLoadsImagesAutomatically(false);
> fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html\024:    internals.settings.setLoadsImagesAutomatically(true);
> http/tests/cache/display-image-unset-allows-cached-image-load.html\021:    window.internals.settings.setLoadsImagesAutomatically(false);
> http/tests/misc/favicon-loads-with-icon-loading-override.html\01:<html><!-- webkit-test-runner [ LoadsImagesAutomatically=false ] -->
> http/tests/misc/favicon-loads-with-images-disabled.html\01:<html><!-- webkit-test-runner [ LoadsImagesAutomatically=false LoadsSiteIconsIgnoringImageLoadingPreference=false ] -->
> svg/as-image/svg-image-with-data-uri-images-disabled.html\014:      internals.settings.setLoadsImagesAutomatically(false);

LoadsImagesAutomatically=false webkit-test-runner header is used only by two tests.

wk2/TestExpectations skipps both.

> webkit.org/b/115809 http/tests/misc/favicon-loads-with-images-disabled.html
> webkit.org/b/115809 http/tests/misc/favicon-loads-with-icon-loading-override.html

This is the reason GTK and WPE layout tests don't observe this bug.

wincairo/TestExpectations marks it as Failure for WinCairo WK1.

> http/tests/misc/favicon-loads-with-icon-loading-override.html [ Failure ]

This is the reason only WinCairo detects.
Comment 5 Fujii Hironori 2023-02-21 12:48:37 PST
Created attachment 465113 [details]
Patch
Comment 6 Fujii Hironori 2023-02-22 11:42:10 PST
Comment on attachment 465113 [details]
Patch

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

> Tools/WebKitTestRunner/TestController.cpp:3082
> +    WKPageGroupSetPreferences(m_pageGroup.get(), WKPreferencesCreate());

This pref leaks. I have to adopt it.
Comment 7 Fujii Hironori 2023-02-22 12:42:21 PST
Created attachment 465123 [details]
[fast-cq] Patch
Comment 8 Darin Adler 2023-02-22 13:02:54 PST
Comment on attachment 465123 [details]
[fast-cq] Patch

Glad you caught the need to adopt!
Comment 9 EWS 2023-02-22 13:33:18 PST
Committed 260699@main (b9b283e66f3d): <https://commits.webkit.org/260699@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 465123 [details].
Comment 10 Radar WebKit Bug Importer 2023-02-22 13:34:19 PST
<rdar://problem/105796205>