Martin Robinson
1a99f74c36
script: Use a WeakRef for references to WebGLRenderingContext ( #40725 )
...
Many WebGL objects refer to a `WebGLRenderingContext` and rely on it for
messaging to the `WebGLThread`. This poses a problem, because WebGL
objects often need to send a message to the `WebGLThread` during their
`Drop` implementation. If the `Drop` is triggered as part of garbage
collection, references to the `WebGLRenderingContext` might be invalid,
if they were garbage collected first as part of the same harvest.
This change makes it so that all of these objects store a `WeakRef`
instead of a `Dom<>`. The `WeakRef` is only used if it can be rooted,
otherwise a `ContextLost` error is given. In cases where only messaging
is needed, a cloned `WebGLMsgSender` is used to perform messages
regardless of whether the context is garbage collected or not.
This isn't a replacement for #37622 , but should make it easier to
implement as
the `WebGLMsgSender` and the `WeakRef` could be stored in the droppable
portion of the DOM object.
Testing: This fixes a use-after-free issue which is mainly detectable
via ASAN
builds. Since we do not run ASAN on CI, this is a bit hard to create
automated
tests for. I verified that this fixed the issue manually.
Fixes : #40655 .
Signed-off-by: Martin Robinson <mrobinson@igalia.com >
2025-11-19 12:29:46 +00:00
..
2025-11-07 01:08:00 +00:00
2025-11-19 05:55:55 +00:00
2025-11-06 11:06:03 +00:00
2025-11-15 18:35:31 +00:00
2025-11-04 07:15:51 +00:00
2025-11-18 10:47:56 +00:00
2025-11-06 11:06:03 +00:00
2025-10-02 04:17:36 +00:00
2025-11-19 00:34:15 +00:00
2025-11-16 05:51:49 +00:00
2025-11-15 09:10:27 +00:00
2025-11-07 02:56:30 +00:00
2025-11-13 09:48:17 +00:00
2025-11-15 09:19:11 +00:00
2025-11-10 10:09:03 +00:00
2025-11-10 11:41:59 +00:00
2025-11-19 12:29:46 +00:00
2025-11-06 11:06:03 +00:00
2025-11-06 11:06:03 +00:00
2025-11-19 12:29:46 +00:00
2025-11-16 09:30:16 +00:00
2025-09-13 18:34:14 +00:00
2025-11-16 04:53:54 +00:00
2025-08-19 11:07:53 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-15 17:59:57 +00:00
2025-11-01 05:32:45 +00:00
2025-11-09 22:05:12 +00:00
2025-09-27 19:23:05 +00:00
2025-11-08 14:27:35 +00:00
2025-11-13 14:53:57 +00:00
2025-11-04 18:29:06 +00:00
2025-10-05 15:12:16 +00:00
2025-11-04 20:43:59 +00:00
2025-11-04 18:29:06 +00:00
2025-11-04 18:29:06 +00:00
2025-11-05 05:22:13 +00:00
2025-11-08 14:27:35 +00:00
2025-11-10 13:45:56 +00:00
2025-11-08 14:27:35 +00:00
2025-11-04 18:29:06 +00:00
2025-11-04 18:29:06 +00:00
2025-11-15 09:19:11 +00:00
2025-11-13 09:48:17 +00:00
2025-07-09 19:07:29 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-10-09 18:18:03 +00:00
2025-10-23 14:02:28 +00:00
2025-10-05 15:12:16 +00:00
2025-10-05 15:12:16 +00:00
2025-10-26 03:15:20 +00:00
2025-08-12 04:53:53 +00:00
2025-11-06 19:43:52 +00:00
2025-11-05 05:22:13 +00:00
2025-11-04 18:29:06 +00:00
2025-11-04 18:29:06 +00:00
2025-11-01 05:32:45 +00:00
2025-11-04 18:29:06 +00:00
2025-11-17 15:53:43 +00:00
2025-11-17 15:53:43 +00:00
2025-11-19 11:53:17 +00:00
2025-11-13 14:53:57 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-10-06 17:23:03 +00:00
2025-11-01 05:32:45 +00:00
2025-09-09 08:33:46 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-10-26 01:34:06 +00:00
2025-11-01 05:32:45 +00:00
2025-11-18 19:13:26 +00:00
2025-10-26 03:29:51 +00:00
2025-11-01 05:32:45 +00:00
2025-10-26 11:36:36 +00:00
2025-11-11 22:30:40 +00:00
2025-11-16 04:53:54 +00:00
2025-11-01 05:32:45 +00:00
2025-10-02 07:51:19 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-11-09 22:05:12 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-19 05:55:55 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-08-19 11:07:53 +00:00
2025-10-25 08:53:05 +00:00
2025-11-08 23:04:03 +00:00
2025-11-03 15:19:34 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-11-07 01:08:00 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-12 18:44:15 +00:00
2025-11-04 18:29:06 +00:00
2025-11-13 19:14:30 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-14 12:53:33 +00:00
2025-11-17 23:18:41 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-11 22:30:40 +00:00
2025-11-01 05:32:45 +00:00
2025-11-10 11:41:59 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-08-09 18:01:00 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-08-04 16:27:00 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-11 22:30:40 +00:00
2025-11-01 05:32:45 +00:00
2025-11-08 14:27:35 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-09-09 08:33:46 +00:00
2025-11-13 14:53:57 +00:00
2025-11-12 07:34:47 +00:00
2025-08-31 01:00:09 +00:00
2025-08-19 11:07:53 +00:00
2025-11-09 22:05:12 +00:00
2025-11-16 15:32:17 +00:00
2025-11-06 11:06:03 +00:00
2025-11-09 22:05:12 +00:00
2025-11-11 22:30:40 +00:00
2025-10-23 14:02:28 +00:00
2025-11-01 05:32:45 +00:00
2025-11-03 15:19:34 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-09-26 22:12:37 +00:00
2025-11-07 01:08:00 +00:00
2025-11-06 11:06:03 +00:00
2025-11-18 07:02:13 +00:00
2025-08-19 11:07:53 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-08-31 01:00:09 +00:00
2025-11-17 10:19:41 +00:00
2025-11-07 01:08:00 +00:00
2025-11-11 11:03:41 +00:00
2025-11-04 18:29:06 +00:00
2025-11-06 11:06:03 +00:00
2025-11-06 11:06:03 +00:00
2025-11-06 11:06:03 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-11-07 01:08:00 +00:00
2025-11-02 18:20:18 +00:00
2025-09-15 08:50:16 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-10-15 07:42:11 +00:00
2025-10-15 07:42:11 +00:00
2025-10-15 07:42:11 +00:00
2025-11-10 13:45:56 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-06 11:06:03 +00:00
2025-10-09 18:18:03 +00:00
2025-08-31 01:00:09 +00:00
2025-10-26 03:29:51 +00:00
2025-11-13 14:53:57 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 05:32:45 +00:00
2025-11-01 10:01:15 +00:00
2025-10-29 11:41:52 +00:00
2025-11-07 01:08:00 +00:00
2025-11-07 01:08:00 +00:00
2025-11-06 11:06:03 +00:00
2025-11-01 05:32:45 +00:00
2025-11-16 09:30:16 +00:00
2025-11-12 15:37:25 +00:00
2025-11-10 11:41:59 +00:00
2025-11-10 11:41:59 +00:00
2025-11-06 11:06:03 +00:00
2025-11-06 11:06:03 +00:00
2025-10-05 15:12:16 +00:00
2025-11-01 05:32:45 +00:00
2025-11-12 10:05:46 +00:00
2025-11-12 10:05:46 +00:00
2025-10-25 23:25:01 +00:00
2025-11-06 12:24:07 +00:00
2025-11-06 12:24:07 +00:00