script.addPreloadScript causes a console error message on navigation
Categories
(Remote Protocol :: WebDriver BiDi, defect, P3)
Tracking
(firefox-esr140 unaffected, firefox149 wontfix, firefox150 wontfix, firefox151 wontfix, firefox152 wontfix, firefox153 fixed, firefox154 fixed)
People
(Reporter: hbenl, Assigned: Sasha)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [webdriver:m20][webdriver:external])
The following test checks that adding a preload script and navigating doesn't add any console messages:
async def test_add_preload_script_no_log_messages(
bidi_session, add_preload_script, subscribe_events
):
await add_preload_script(function_declaration="() => 42")
log = []
async def on_event(method, data):
log.append(data)
remove_listener = bidi_session.add_event_listener("log.entryAdded", on_event)
new_context = await bidi_session.browsing_context.create(type_hint="tab")
await subscribe_events(
events=["log.entryAdded"], contexts=[new_context["context"]]
)
await bidi_session.browsing_context.navigate(
context=new_context["context"],
url="data:text/html,",
wait="complete",
)
assert log == []
remove_listener()
It fails due to an unexpected permission denied error:
E assert [{'type': 'javascript', 'level': 'error', 'source': {'realm': 'bf31ba61-dc38-4355-aeaf-69fd1a18e028', 'context': 'c950fb41-bb2a-42ae-a3e5-77338f9f0f59'}, 'text': 'Error: Permission denied to access property "length"', 'timestamp': 1776262656353}] == []
The issue causes this Playwright test to fail: it runs a Playwright test with tracing enabled (tracing is implemented using a preload script) and then checks the test's console messages in Playwright's trace viewer.
Sadly there is no stack available. Do you see in the browser logs more details? Would be good to know where exactly the error is raised. Is that maybe a recent regression?
| Reporter | ||
Comment 2•3 months ago
|
||
I couldn't find any more details in the browser logs.
The error first showed up in Playwright CI on 2026-02-16 and then permanently from 2026-02-20. On 2026-02-19, D284029 was merged and when I undo the changes from that patch, the error disappears and the test passes. Unfortunately this doesn't tell us where the error occurs and I have no idea why it happened on 2026-02-16.
Comment 3•3 months ago
|
||
Set release status flags based on info from the regressing bug 1985997
:Sasha, since you are the author of the regressor, bug 1985997, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Thanks, Holger. If this only results in a console error from a non-critical code path, it may be acceptable. What I am wondering, though, is whether it could actually prevent the preload script from being added. That would be a much more serious regression, and in that case I would expect we might already have seen related bug reports given that 149 was released nearly 4 weeks ago. Hopefully that is not happening, or only in a very specific edge case.
Updated•3 months ago
|
Updated•3 months ago
|
| Assignee | ||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
| Reporter | ||
Comment 5•3 months ago
|
||
I found another Playwright test that fails because of this issue: the test blocks service workers (using a preload script) and verifies that no error is thrown on navigation to about:blank but it receives the permission denied error.
The test started permafailing on 2026-02-13 but worked consistently before that date.
(In reply to Holger Benl [:hbenl] from comment #5)
The test started permafailing on 2026-02-13 but worked consistently before that date.
Thanks. Bug 1936770 landed that day and seems to be related to this regression.
Comment 7•3 months ago
|
||
This is already marked as a regression from Bug 1985997, now we added Bug 1936770. Are both the same issue?
| Reporter | ||
Comment 8•3 months ago
•
|
||
For now we can only speculate what regressed this. FWIW I don't think it's related to Bug 1936770, I rather suspect Bug 2005558 (which modified the same file as Bug 1985997, which I suspect is responsible for the first mentioned Playwright test starting to permafail, but it already had one failure before that patch). Bug 2005558 landed on 2026-02-12.
Comment 9•3 months ago
|
||
Makes sense, thanks for the details Holger.
Also Bug 1936770 landed on the 14th (first Nightly), and I don't know if PW was able to run with a Nightly containing this one on the 14th or the 15th, but if the first failure was on the 13th, it's very unlikely to be related. I will remove the regressed link, overall let's wait until we have some evidence before flagging bugs as regressors.
Updated•2 months ago
|
| Reporter | ||
Comment 10•1 month ago
|
||
The Playwright tests started passing last night and the test in the description is also passing now. I assume this was fixed with Bug 2046390.
Marking for m20 but not tracking the points because the patch is on the other bug.
The patch on bug 2046390 was uplifted to 153.
Description
•