Closed Bug 1780488 Opened 2 years ago Closed 2 years ago

Fix test_ext_userScripts_register.js with parent-controlled navigation

Categories

(WebExtensions :: General, task, P3)

task

Tracking

(firefox105 fixed)

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

When parent controlled navigation is enabled, this XPCShell test fails in automation, about 40% of the time.

The failure is:

xpcshell-remote.ini:toolkit/components/extensions/test/xpcshell/test_ext_userScripts_register.js | test_userscripts_register_cookieStoreId - [test_userscripts_register_cookieStoreId : 119] Expected textContent on content page - "" == "private"

I think this means that the web extension content script that is supposed to run on the page that is opened with private browsing (because it matches "firefox-private") fails to run, so it ends up with the unmodified page and returns "" instead of the expected "private".

If I run this test locally with --verify and Fission enabled, I get different failures, but I haven't managed to reproduce the private browsing failure yet. I'll have to see if Anny fixed other tests related to private browsing before.

See Also: → 1780576

Bug 1763197 is the tracking bug for the (rare) intermittent failures for this test. In bug 1780576, I am investigating why parent-controlled navigation increases the failure rate of this test to about 40% in automation.

See Also: → 1763197

It looks like this test is racy. If I add in await new Promise(r => setTimeout(r, 2000)); to the start of any of the content scripts, that test will fail.

Looking at test_ext_contentScripts_register.js, one test has run_at of "document_idle" instead of "document_end". Another couple of the scripts that do use "document_end" explicitly send a message when the content script has finished running. I'll try looking at the bug that added test_ext_userScripts_register.js to see if I can figure out what they are really trying to test here.

Severity: -- → N/A
Priority: -- → P3

I thought about this some more, and I think my reasoning in the previous comment was bogus. So I'll have to come up with another theory.

I looked at the code that runs content scripts, and it does look like it is racey, even though my prior attempt to demonstrate that was probably bogus. I rewrote this test a bit to do a set timeout wait loop and that at least makes the test pass locally with Fission in verify mode. It does require an extra check fairly often. I'll have to see if this also fixes my parent-controlled navigation issue. While this is probably not the way to do it, at least it might suggest that my raciness theory is right.

Attachment #9287799 - Attachment is obsolete: true
Attachment #9287799 - Attachment description: Bug 1780488 - Wait more in test_ext_userScripts_register.js DO NOT LAND → Bug 1780488 - Fix the race in test_ext_userScripts_register.js.
Attachment #9287799 - Attachment is obsolete: false
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/795366a82263
Fix the race in test_ext_userScripts_register.js. r=rpl
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: