Webworker violating cross-origin policy silently ignored, instead of throwing a SecurityError
Categories
(Core :: DOM: Workers, defect, P2)
Tracking
()
Webcompat Priority | P1 |
People
(Reporter: pokechu022, Assigned: edenchuang)
References
(Blocks 1 open bug)
Details
(Keywords: webcompat:platform-bug)
User Story
platform-scheduled:2025-01-30
Attachments
(1 obsolete file)
Comment 1•7 years ago
|
||
Reporter | ||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Reporter | ||
Comment 4•7 years ago
|
||
Updated•7 years ago
|
Updated•3 years ago
|
Comment 5•2 years ago
|
||
A Google employee just confirmed that this is actually causing a webcompat issue on some versions of Google Maps, if sites are misconfigured. Chrome will still end up loading the map because it detects a SecurityError being thrown on worker creation, while Firefox does not, and ends up hitting less tested codepaths in Maps as a result:
The site in question seems to be trying to use the webGL version of maps, which uses Web Workers. On my machine, Chrome fails this worker creation with a SecurityError exception blocking the script from running due to content security policy of the site, so Maps JS API fallback to running a png map. On Firefox, this seems to not throw, but just silently not start the workers, so Maps API tries running WebGL with workers and stalls waiting for the worker to start.
I suppose a strict reading of the spec does not require the browser to throw a SecurityError in such a case, but the spec says the user agent "may throw a 'SecurityError'DOMException if the request violates a policy decision" https://html.spec.whatwg.org/multipage/workers.html#dom-worker
I suspect for general debuggability by all application developers, it's probably valuable to throw a SecurityError in such a case of a worker script violating the content security policy of a page.
This problem can currently be seen at https://www.exploretock.com/city/seattle/search?city=Seattle&date=2022-03-29&latlng=47.6062095%2C-122.3320708&size=2&time=15%3A30&type=DINE_IN_EXPERIENCES , as reported at https://github.com/webcompat/web-bugs/issues/100874#issuecomment-1611839988 .
I will let the Google folks know to try using onerror
as a work-around; hopefully that will be enough for them to fix the issue without too much trouble. But it strikes me as a good idea to match Chrome if this is demonstrably causing such webcompat breakage.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 6•2 years ago
|
||
The severity field for this bug is set to S3. However, this bug has a P1 WebCompat priority.
:jjalkanen, could you consider increasing the severity of this web compatibility bug?
For more information, please visit BugBot documentation.
Comment 7•2 years ago
|
||
I increase the severity for better visibility because major functionality/product is severely impaired.
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
|
||
Assignee | ||
Comment 9•2 years ago
|
||
Fire a spec issue for discussion, https://github.com/whatwg/html/issues/9794
Updated•2 years ago
|
Assignee | ||
Comment 10•2 years ago
|
||
https://github.com/web-platform-tests/wpt/issues/41745
According to the discussion, I think this bug can be closed.
Comment 11•2 years ago
|
||
Alright. I've just pinged my email thread with Google, as ExploreTock is still broken on Firefox (and will be on WebKit and Blink when they adopt the spec text). Hopefully the Maps team will at least handle sync and async cases until browsers align on the new spec text.
Updated•9 months ago
|
Comment 12•9 months ago
|
||
Reopening as the map on exploretock is still broken (bug1927467).
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•6 months ago
|
Assignee | ||
Updated•5 months ago
|
Comment 13•5 months ago
|
||
Eden, why did you close this? Google maps on exploretock is still broken
Comment hidden (offtopic) |
Comment 15•5 months ago
|
||
I think we should probably just fix it, doesn't seem like the kind of hill worth dying on.
Comment 16•5 months ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #13)
Eden, why did you close this? Google maps on exploretock is still broken
Apologies, we lost track of the exploretock bug in the thicket of bugs around this issue.
https://bugzilla.mozilla.org/show_bug.cgi?id=1919592#c7 has spec issue links but the tl;dr is that browsers are in agreement that everyone should do what Firefox is doing and Blink is moving to conform and Webkit by way of :annevk was strongly opposed to changing the spec back to what non-Firefox browsers were doing, although it's not immediately clear when they will conform.
Also note that we got this into interop-2025: https://github.com/web-platform-tests/interop/issues/855 noting that the initial set of tests was wrong and will be corrected to only be the CSP test (see https://github.com/web-platform-tests/interop/issues/932) but which is the specific case Jeff has identified in https://bugzilla.mozilla.org/show_bug.cgi?id=1927467#c3 and the WPT tests I believe have now been all updated. Browsers will not be able to get to 100% in interop-2025 without fixing their implementations.
It's probably most efficient if you engage on the spec issues directly if you want to make the case for permanent carve-outs in the fetch spec, although I should point out that the workaround Eden was pursuing for this ran into some real technical problems when it comes to nested workers which will potentially result in Firefox deadlocking where other browsers don't deadlock because we can't run our security checks OMT.
Description
•