Bug 203981

Summary: TestController may reuse a view that used window.open(), which prevents process-swapping and causes flakiness
Product: WebKit Reporter: Yury Semikhatsky <yurys>
Component: Tools / TestsAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, beidson, ggaren, hi, rniwa, webkit-bug-importer, youennf, yurys
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 203965    
Attachments:
Description Flags
WIP Patch
none
Patch
none
Patch rniwa: review+

Yury Semikhatsky
Reported 2019-11-07 15:37:46 PST
TestController may reuse Page for which previous test changed Page::openedByDOMWithOpener to true. This may disable PSON for cross-process navigation in subsequent tests and cause flakiness. See https://webkit.org/b/203965#c3 for one example how http/tests/dom/new-window-can-target-opener.html inadvertently disabled PSON for http/tests/inspector/target/target-events-for-provisional-page.html and made it fail.
Attachments
WIP Patch (1.89 KB, patch)
2019-11-07 15:59 PST, Chris Dumez
no flags
Patch (4.39 KB, patch)
2019-11-07 16:06 PST, Chris Dumez
no flags
Patch (4.40 KB, patch)
2019-11-07 16:43 PST, Chris Dumez
rniwa: review+
Chris Dumez
Comment 1 2019-11-07 15:45:13 PST
trying to find this logic in TestController..
Chris Dumez
Comment 2 2019-11-07 15:53:02 PST
I think it is more likely we don't swap because: navigation.hasOpenedFrames(). Meaning that the previous test opened another window via window.open().
Chris Dumez
Comment 3 2019-11-07 15:59:49 PST
Created attachment 383086 [details] WIP Patch
Chris Dumez
Comment 4 2019-11-07 16:06:30 PST
Yury Semikhatsky
Comment 5 2019-11-07 16:19:56 PST
(In reply to Chris Dumez from comment #2) > I think it is more likely we don't swap because: > navigation.hasOpenedFrames(). Meaning that the previous test opened another > window via window.open(). FWIW, while debugging the failure I saw '"Browsing context been opened by DOM without 'noopener'" coming from https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/UIProcess/WebProcessPool.cpp?rev=252014#L2139 Should be easy to reproduce by running: 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
Chris Dumez
Comment 6 2019-11-07 16:20:43 PST
(In reply to Yury Semikhatsky from comment #5) > (In reply to Chris Dumez from comment #2) > > I think it is more likely we don't swap because: > > navigation.hasOpenedFrames(). Meaning that the previous test opened another > > window via window.open(). > > FWIW, while debugging the failure I saw > > '"Browsing context been opened by DOM without 'noopener'" > > coming from > https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/UIProcess/ > WebProcessPool.cpp?rev=252014#L2139 > > > Should be easy to reproduce by running: > > 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 Yes, I have already confirmed that my fix addresses the flakiness with the command you provided.
Yury Semikhatsky
Comment 7 2019-11-07 16:26:29 PST
(In reply to Chris Dumez from comment #6) > (In reply to Yury Semikhatsky from comment #5) > > (In reply to Chris Dumez from comment #2) > Yes, I have already confirmed that my fix addresses the flakiness with the > command you provided. Your change will certainly fix the test failure I was more concerned about the Process/Page being reused in prod. Since you mentioned hasOpenedFrames I wanted to double check if that's actually root cause because it didn't match what I saw in the output. In any case thanks for the quick fix!
Yury Semikhatsky
Comment 8 2019-11-07 16:27:06 PST
Comment on attachment 383087 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=383087&action=review lgtm > Tools/WebKitTestRunner/TestController.cpp:774 > + if (!m_createdOtherPage && m_mainWebView->viewSupportsOptions(options)) Neat!
Chris Dumez
Comment 9 2019-11-07 16:43:22 PST
Chris Dumez
Comment 10 2019-11-07 18:45:11 PST
Radar WebKit Bug Importer
Comment 11 2019-11-07 18:46:19 PST
Note You need to log in before you can comment on or make changes to this bug.