Open Bug 1940773 Opened 2 months ago Updated 16 hours ago

Perma [tier 2] toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js | uncaught exception - TypeError: can't access property "todo", SpecialPowers.SimpleTest is undefined at a11yWarn@chrome://mochikit/content/tests/SimpleTest/

Categories

(Toolkit :: Add-ons Manager, defect)

defect

Tracking

()

Tracking Status
firefox-esr128 --- unaffected
firefox134 --- unaffected
firefox135 --- affected
firefox136 --- affected

People

(Reporter: intermittent-bug-filer, Assigned: Jamie)

References

(Regression)

Details

(4 keywords, Whiteboard: [stockwell disabled])

Attachments

(2 files)

Filed by: chorotan [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=489404646&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/VWeE0r9kT_S-Dx8xDpavQQ/runs/0/artifacts/public/logs/live_backing.log


task 2025-01-09T15:29:24.778Z] 15:29:24     INFO - TEST-PASS | toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js | Initial checkbox state - 
[task 2025-01-09T15:29:24.778Z] 15:29:24     INFO - Buffered messages finished
[task 2025-01-09T15:29:24.781Z] 15:29:24     INFO - TEST-UNEXPECTED-FAIL | toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js | uncaught exception - TypeError: can't access property "todo", SpecialPowers.SimpleTest is undefined at a11yWarn@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:768:5
[task 2025-01-09T15:29:24.781Z] 15:29:24     INFO - assertLabelled@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:981:17
[task 2025-01-09T15:29:24.781Z] 15:29:24     INFO - assertCanBeClicked@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:1176:21
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - runIfA11YChecks/this.AccessibilityUtils@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:1140:40
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - handleEvent@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:1257:12
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - toggleUserScriptCheckbox@chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:116:12
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - verifyUserScriptPromptDeniedByDefault@chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:165:31
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - async*test_userScripts_not_allowed_by_default@chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:203:9
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - async*handleTask@chrome://mochikit/content/browser-test.js:1147:26
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - _runTaskBasedTest@chrome://mochikit/content/browser-test.js:1219:18
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - async*Tester_execTest@chrome://mochikit/content/browser-test.js:1360:14
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - nextTest/<@chrome://mochikit/content/browser-test.js:1136:14
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - SimpleTest.waitForFocus/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:1058:13
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - 
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - Stack trace:
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:simpletestOnerror:2068
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:toggleUserScriptCheckbox:116
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:verifyUserScriptPromptDeniedByDefault:165
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:test_userScripts_not_allowed_by_default:203
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochikit/content/browser-test.js:handleTask:1147
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1219
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1360
[task 2025-01-09T15:29:24.782Z] 15:29:24     INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1136
[task 2025-01-09T15:29:24.783Z] 15:29:24     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1058
[task 2025-01-09T15:29:24.783Z] 15:29:24     INFO - GECKO(12767) | JavaScript error: chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js, line 768: TypeError: can't access property "todo", SpecialPowers.SimpleTest is undefined
[task 2025-01-09T15:29:24.784Z] 15:29:24     INFO - TEST-PASS | toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js | Checked state should change - 
[task 2025-01-09T15:29:24.784Z] 15:29:24     INFO - TEST-PASS | toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js | Should be able to Deny the prompt - 
[task 2025-01-09T15:29:24.786Z] 15:29:24     INFO - Console message: [JavaScript Error: "TypeError: can't access property "todo", SpecialPowers.SimpleTest is undefined" {file: "chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js" line: 768}]
[task 2025-01-09T15:29:24.786Z] 15:29:24     INFO - a11yWarn@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:768:5
[task 2025-01-09T15:29:24.786Z] 15:29:24     INFO - assertLabelled@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:981:17
[task 2025-01-09T15:29:24.787Z] 15:29:24     INFO - assertCanBeClicked@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:1176:21
[task 2025-01-09T15:29:24.787Z] 15:29:24     INFO - runIfA11YChecks/this.AccessibilityUtils@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:1140:40
[task 2025-01-09T15:29:24.787Z] 15:29:24     INFO - handleEvent@chrome://mochikit/content/tests/SimpleTest/AccessibilityUtils.js:1257:12
[task 2025-01-09T15:29:24.787Z] 15:29:24     INFO - toggleUserScriptCheckbox@chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:116:12
[task 2025-01-09T15:29:24.787Z] 15:29:24     INFO - verifyUserScriptPromptDeniedByDefault@chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:165:31
[task 2025-01-09T15:29:24.787Z] 15:29:24     INFO - async*test_userScripts_not_allowed_by_default@chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js:203:9
[task 2025-01-09T15:29:24.788Z] 15:29:24     INFO - async*handleTask@chrome://mochikit/content/browser-test.js:1147:26
[task 2025-01-09T15:29:24.788Z] 15:29:24     INFO - _runTaskBasedTest@chrome://mochikit/content/browser-test.js:1219:18
[task 2025-01-09T15:29:24.788Z] 15:29:24     INFO - async*Tester_execTest@chrome://mochikit/content/browser-test.js:1360:14
[task 2025-01-09T15:29:24.788Z] 15:29:24     INFO - nextTest/<@chrome://mochikit/content/browser-test.js:1136:14
[task 2025-01-09T15:29:24.788Z] 15:29:24     INFO - SimpleTest.waitForFocus/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:1058:13
[task 2025-01-09T15:29:24.788Z] 15:29:24     INFO - 

Hi Rob! Could this permafailure be caused by your changes made on Bug 1931548 ? If so, could you please take a look? Thanks.

Flags: needinfo?(rob)
Keywords: regression
Regressed by: 1931548

Set release status flags based on info from the regressing bug 1931548

While bug 1931548 added a new test, I am not sure if this is really an issue with my patches.

I simulate a checkbox change with checkbox.click() at https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js#115-116.
The checkbox is visible, with a label - nothing special: https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/browser/base/content/browser-addons.js#345-351

When a11y checks are enabled, that apparently triggers an error at https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js#755. This error is independent of my test.
The error is in an attempt to call SimpleTest.todo, which should have been a non-fatal error. The intended result is to log "Form elements should have a visible text label" at https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js#981

Oddly, when I run the test on macOS, I don't get any failures (nor warnings):

./mach test toolkit/mozapps/extensions/test/browser/browser_permission_prompt_userScripts.js --headless --log-mach-verbose --enable-a11y-checks

Flags: needinfo?(rob)

Anna, see comment 5 and the summary below. Do you know what is going on here?

For some reason, AccessibilityUtils.js thinks that the checkbox does not have a form label, on Linux only (not on macOS), at https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js#981.
That would ordinarily have been a non-fatal warning, but somehow SpecialPowers.SimpleTest is undefined at that point, causing a failure upon calling SpecialPowers.SimpleTest.todo at https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js#755

Flags: needinfo?(ayeddi)

This is not unique to browser_permission_prompt_userScripts.js, here is a try push with the same error for browser_installtrigger_install.js.

https://treeherder.mozilla.org/jobs?repo=try&revision=7c45e3468d6060973d8078dbab6da50e4b980b15&selectedTaskRun=IFh7vpc2StarkBMl4Yv10w.0

See Also: → 1861339

This test currently permafails, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1940773#c5 and
https://bugzilla.mozilla.org/show_bug.cgi?id=1940773#c6

Disabling test on a11y_checks until the underlying issue is addressed.

I'm going to skip the test when running with a11y_checks, since the failures are not helpful. There is a pending needinfo in comment 6 that blocks the "proper" resolution of this bug.

Keywords: leave-open
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/ae6cc07c5af6 Skip a11y_checks in browser_permission_prompt_userScripts.js r=rpl
Whiteboard: [stockwell disable-recommended] → [stockwell disabled]

I'm looking into this.

Assignee: nobody → jteh

For some reason I don't understand, window.SpecialPowers.SimpleTest and window.SimpleTest sometimes seem to be cleared during tests (or the global scope changes completely).
Ultimately, we don't control the test scope, so it's best not to rely on it anyway.
Instead, save a reference to SimpleTest in the AccessibilityUtils scope in AccessibilityUtils.init so we can always rely on it being there, since AccessibilityUtils completely controls that scope.
This patch also re-enables the test which was perma failing on CI.

While this fixes the error, there is still the issue of why the todo() was triggered. I described the circumstances leading to this error at https://bugzilla.mozilla.org/show_bug.cgi?id=1940773#c6

Do you know why that is happening? Sounds like a potential issue with a11y tests or an a11y bug in the checkbox implementation.

Flags: needinfo?(jteh)

(In reply to Rob Wu [:robwu] from comment #20)

While this fixes the error, there is still the issue of why the todo() was triggered.

Fair. However, I'd suggest we tackle this in a separate bug, since the error is hurting us, where the warning likely isn't, and the fixes are going to be very different.

(In reply to Rob Wu [:robwu] from comment #6)

For some reason, AccessibilityUtils.js thinks that the checkbox does not have a form label, on Linux only (not on macOS)

Note that a11y-checks jobs only run on CI for Linux. There can also be timing issues with Fluent that cause a11y-checks to not be able to examine the label in time, in which case we will pass silently rather than failing. There's not much we can do about that.

at https://searchfox.org/mozilla-central/rev/9f9fa5d2cb72b12ac7e168b7f6ee9820f63291e9/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js#981.

Looking at this briefly, I think this might be happening because the accessibility engine knows how to get the label text for XUL controls which use label="text", but not the label element itself. The label element possibly isn't even in the accessibility tree because check boxes aren't supposed to have children in accessibility terms. So, I think the fix here will probably be to make an exception to avoid this warning in this case in AccessibilityUtils.

Flags: needinfo?(jteh)
See Also: → 1950495

(In reply to James Teh [:Jamie] from comment #21)

(In reply to Rob Wu [:robwu] from comment #20)

While this fixes the error, there is still the issue of why the todo() was triggered.

Fair. However, I'd suggest we tackle this in a separate bug, since the error is hurting us, where the warning likely isn't, and the fixes are going to be very different.

I filed bug 1950495 and quoted the relevant parts of the comments here.

Flags: needinfo?(ayeddi)
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3548a4263a84 Keep a reference to SimpleTest in AccessibilityUtils. r=ayeddi,robwu
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: