Bug 203965

Summary: Web Inspector: http/tests/inspector/target/target-events-for-provisional-page.html is flaky when running with other tests
Product: WebKit Reporter: Yury Semikhatsky <yurys>
Component: Web InspectorAssignee: Yury Semikhatsky <yurys>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cdumez, commit-queue, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 203981    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Yury Semikhatsky 2019-11-07 09:53:12 PST
http/tests/inspector/target/target-events-for-provisional-page.html

added in https://trac.webkit.org/changeset/251494/webkit

is a flakey failure when running with other tests.

Probable cause:

Some side effect of previous tests that disable PSON.

Flakiness Dashboard:

https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=http%2Ftests%2Finspector%2Ftarget%2Ftarget-events-for-provisional-page.html
Comment 1 Yury Semikhatsky 2019-11-07 09:58:45 PST
The test reliably fails when running after  http/tests/dom/new-window-can-target-opener.html.

Tools/Scripts/run-webkit-tests --no-show-results --no-retry-failures --child-processes=1 http/tests/dom/new-window-can-target-opener.html http/tests/inspector/target/target-events-for-provisional-page.html
Comment 2 Radar WebKit Bug Importer 2019-11-07 10:50:18 PST
<rdar://problem/56988642>
Comment 3 Yury Semikhatsky 2019-11-07 14:36:46 PST
The problem is that new-window-can-target-opener-win.html opened in a child window calls open() on its opener window, i.e. the test page itself (new-window-can-target-opener.html). It in turn triggers Page::setOpenedByDOMWithOpener() on the parent page. The next test will reuse the same instance of PlatformWebView and consequently the same Page in the WebProcess. Since instance of the page is the same it still has Page::openedByDOMWithOpener() == true. Because of that[1] cross-origin navigation in the next test page will reuse same process. I don't know if this is intentional behavior.

I'm going to add 
<!-- webkit-test-runner [ enableProcessSwapOnWindowOpen=true ] -->
as a temporary workaround for the flaky inspector test but we should probably never reuse a page which was openedByDOM.

[1] https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/UIProcess/WebProcessPool.cpp?rev=252014#L2139

[2] https://trac.webkit.org/browser/webkit/trunk/LayoutTests/http/tests/dom/resources/new-window-can-target-opener-win.html#L19
Comment 4 Yury Semikhatsky 2019-11-07 14:48:29 PST
Created attachment 383075 [details]
Patch
Comment 5 Devin Rousso 2019-11-07 15:04:47 PST
Comment on attachment 383075 [details]
Patch

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

rs=me

> LayoutTests/ChangeLog:11
> +        that may run before (the test may reuse Page instance from the previous test on which
> +        Page::openedByDOMWithOpener==true).

This seems like a bug.  Can you file a separate bug to fix this please?
Comment 6 Yury Semikhatsky 2019-11-07 15:39:40 PST
Filed https://bugs.webkit.org/show_bug.cgi?id=203981
Comment 7 WebKit Commit Bot 2019-11-07 15:45:02 PST
Comment on attachment 383075 [details]
Patch

Clearing flags on attachment: 383075

Committed r252214: <https://trac.webkit.org/changeset/252214>
Comment 8 WebKit Commit Bot 2019-11-07 15:45:04 PST
All reviewed patches have been landed.  Closing bug.