Nightly OffscreenCanvas API breaks multiple visualization libraries
Categories
(Core :: Graphics: CanvasWebGL, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr91 | --- | unaffected |
firefox95 | --- | unaffected |
firefox96 | --- | unaffected |
firefox97 | --- | disabled |
People
(Reporter: bpeiris, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Edit: This bug was initially filed to report issues with the three.js library, but as commented below, we've found that it breaks several other libraries and sites.
Older versions of three.js (versions r109 to r111) attempt to feature-detect and use the OffscreenCanvas API. However this breaks in Nightly since it seems the API implementation is partial or incompatible.
The error occurs while three.js is initializing, which means it breaks three.js-based apps entirely. This will cause issues with our Mozilla Hubs Cloud product as well, since some users choose to use older custom client code, which use older versions of three.js.
The error message is Uncaught TypeError: OffscreenCanvas.getContext: '2d' (value of argument 1) is not a valid value for enumeration OffscreenRenderingContextId.
The error can be reproduced in Nightly with this example page:
https://rawcdn.githack.com/mrdoob/three.js/r111/examples/webgl_materials_envmaps_hdr.html
Cannot be reproduced in Firefox Stable or Chrome.
Can confirm. It's been reported as https://github.com/webcompat/web-bugs/issues/97181 for pinafore.social, though bug was rejected because the site needs a Mastodon account in order to check.
Two-liner test case:
var x = new OffscreenCanvas(32, 32);
var y = x.getContext("2d");
I believe it was broken in hg changeset https://hg.mozilla.org/mozilla-central/rev/25ca519aa6fc61f63feb42446740a9f68170c8c2.
Updated•3 years ago
|
Updated•3 years ago
|
Probably depends on bug 1746750, since bug 1736177 was only about webgl implementation. Please revert if not.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Set release status flags based on info from the regressing bug 1746110
Comment 4•3 years ago
|
||
Offscreen canvas is currently held to Nightly. These three.js revisions are over two years old. Don't think this warrants a backout of our OC work, or even holds up our eventual rollout. (Sites that use the older revs of three.js can upgrade.)
(In reply to Jim Mathies [:jimm] from comment #4)
Don't think this warrants a backout of our OC work, or even holds up our eventual rollout.
Apologies for disagreeing here, but as I said in comment 1,
var x = new OffscreenCanvas(32, 32);
var y = x.getContext("2d");
is a completely standalone test case (no three.js involved) and it's been regressed on 97. This renders any site that uses OffscreenCanvas with a 2d context unusable, because getContext is not supposed to throw an exception with a fully documented and valid enum value; it should, at the very least, return null
instead. See https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/getContext#parameters .
In my own case, I've had to gfx.offscreencanvas.enable
set to false in order to be able to read my Mastodon timeline again via https://pinafore.social.
Comment 6•3 years ago
|
||
We've got a report in https://github.com/webcompat/web-bugs/issues/97457 and the same issue is present in a current version of cytoscape.
The library is being used by a lot of sites according to https://js.cytoscape.org/#introduction/who-uses-cytoscape.js
Reporter | ||
Comment 7•3 years ago
|
||
(In reply to Jim Mathies [:jimm] from comment #4)
Offscreen canvas is currently held to Nightly.
Does this mean that this regression will not be released to Stable?
Comment 8•3 years ago
|
||
This also affects mapgenie.io, which is using mapbox.
Example on mapbox website https://docs.mapbox.com/mapbox-gl-js/example/add-terrain/, where 3d terrain is not rendered
(getContext('2d')
is being used in https://github.com/mapbox/mapbox-gl-js/blob/main/src/source/raster_dem_tile_worker_source.js#L29)
Updated•3 years ago
|
Comment 9•3 years ago
|
||
mapbox-gl-js attempts to detect the support, but it does not consider the case where .getContext('2d')
throws.
Comment 10•3 years ago
|
||
:jimm, can you please re-evaluate this based on comment 5 and comment 6? It looks like the scope larger than initially seen and this is causing webcompat issues. Thanks!
Comment 12•3 years ago
|
||
This also breaks image previews in Matrix/Element chats.
Comment 13•3 years ago
|
||
Backed out Bug 1746110 for causing this regression.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 14•3 years ago
|
||
OffscreenCanvas was preffed off for 97.
Updated•3 years ago
|
Comment 15•3 years ago
|
||
We changed plans to ship via a simplified origin trial and we are implementing the necessary remaining pieces for Canvas2D in 2022. I think we can close this.
Description
•