match_about_blank causes race condition

145 views
Skip to first unread message

Salmin Skenderovic

unread,
Jul 18, 2025, 9:39:03 AM7/18/25
to Chromium Extensions
The match_about_blank flag on content scripts that run_at: document_end cause an race condition.

To replicate, make a vanilla extension (manifest + contentEnd.js).

contentEnd.js is empty
manifest.json
{
"manifest_version": 3,
"name": "simple-extension",
"version": "1.0",
"content_scripts": [
{
"matches": ["<all_urls>"],
"run_at": "document_end",
"js": ["contentEnd.js"],
"match_about_blank": true,
"all_frames": true
}
]
}


Test against this site:

function printPartOfPage() {
const windowUrl = "about:blank";
const uniqueName = new Date();
const windowName = "Print" + uniqueName.getTime();
const printWindow = window.open(
windowUrl,
windowName,
"left=50000,top=50000,width=0,height=0"
);
printWindow.document.write(
"<html><head></head><body><h1>hello world</h1></body></html>"
);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}


This causes the popup to close before the print dialog shows up.
If you turn off the extension, change match_about_blank to false, or switch run_at, the issue is no longer present.

I also noticed some irregularities with having multiple extensions installed, but I don't have the steps to replicate it.

We have several clients that have internal sites that have reported this issue. We need these flags on the manifest and we can't make changes to their internal systems.

Regards,
Salmin

Patrick Kettner

unread,
Jul 22, 2025, 1:12:21 PM7/22/25
to Salmin Skenderovic, Chromium Extensions
Hey Salmin
Thanks for the report! Would you care to file a bug report about this on crbug.com?

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/d7b44dcb-3072-4f16-a81d-9ac6cb2406bbn%40chromium.org.

Salmin Skenderovic

unread,
Jul 22, 2025, 1:37:56 PM7/22/25
to Chromium Extensions, Patrick Kettner, Chromium Extensions, Salmin Skenderovic
Reply all
Reply to author
Forward
0 new messages