Skip to content

Keep alive OffscreenCanvas's wrapper object until webglcontextlost event is dispatched#64921

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
fujii:eng/OffscreenCanvas-virtualHasPendingActivity
May 18, 2026
Merged

Keep alive OffscreenCanvas's wrapper object until webglcontextlost event is dispatched#64921
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
fujii:eng/OffscreenCanvas-virtualHasPendingActivity

Conversation

@fujii
Copy link
Copy Markdown
Contributor

@fujii fujii commented May 14, 2026

2be1403

Keep alive OffscreenCanvas's wrapper object until webglcontextlost event is dispatched
https://bugs.webkit.org/show_bug.cgi?id=314269

Reviewed by Chris Dumez.

webgl/lose-context-after-context-lost.html randomly caused an assertion failure
for GTK and WPE.

> ASSERTION FAILED: m_wrapper
> Source/WebCore/bindings/js/JSEventListener.h(171) :
>     JSC::JSObject* WebCore::JSEventListener::ensureJSFunction(WebCore::ScriptExecutionContext&) const

OffscreenCanvas's wrapper object was reclaimed when the webglcontextlost event
was dispatched.

222794@main fixed the same issue for HTMLCanvasElement by adding
HTMLCanvasElement::virtualHasPendingActivity(). Do the same for
OffscreenCanvas.

Tests: webgl/lose-context-after-context-lost.html

* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::virtualHasPendingActivity const):
(WebCore::OffscreenCanvas::eventListenersDidChange):
* Source/WebCore/html/OffscreenCanvas.h:

Canonical link: https://commits.webkit.org/313384@main

3865b8b

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
❌ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim ✅ 🧪 mac-site-isolation
✅ 🛠 watch
✅ 🛠 watch-sim

@fujii fujii requested review from cdumez and rniwa as code owners May 14, 2026 09:45
@fujii fujii self-assigned this May 14, 2026
@fujii fujii added the WebKitGTK Bugs related to the Gtk API layer. label May 14, 2026
Comment thread Source/WebCore/html/OffscreenCanvas.h
Comment thread Source/WebCore/html/OffscreenCanvas.h
@fujii fujii force-pushed the eng/OffscreenCanvas-virtualHasPendingActivity branch from 24f261d to 3865b8b Compare May 18, 2026 01:41
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

iOS Safer C++ Build #25927 (3865b8b)

❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 18, 2026
@fujii fujii added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels May 18, 2026
…ent is dispatched

https://bugs.webkit.org/show_bug.cgi?id=314269

Reviewed by Chris Dumez.

webgl/lose-context-after-context-lost.html randomly caused an assertion failure
for GTK and WPE.

> ASSERTION FAILED: m_wrapper
> Source/WebCore/bindings/js/JSEventListener.h(171) :
>     JSC::JSObject* WebCore::JSEventListener::ensureJSFunction(WebCore::ScriptExecutionContext&) const

OffscreenCanvas's wrapper object was reclaimed when the webglcontextlost event
was dispatched.

222794@main fixed the same issue for HTMLCanvasElement by adding
HTMLCanvasElement::virtualHasPendingActivity(). Do the same for
OffscreenCanvas.

Tests: webgl/lose-context-after-context-lost.html

* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::virtualHasPendingActivity const):
(WebCore::OffscreenCanvas::eventListenersDidChange):
* Source/WebCore/html/OffscreenCanvas.h:

Canonical link: https://commits.webkit.org/313384@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/OffscreenCanvas-virtualHasPendingActivity branch from 3865b8b to 2be1403 Compare May 18, 2026 02:37
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 313384@main (2be1403): https://commits.webkit.org/313384@main

Reviewed commits have been landed. Closing PR #64921 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 2be1403 into WebKit:main May 18, 2026
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label May 18, 2026
@fujii fujii deleted the eng/OffscreenCanvas-virtualHasPendingActivity branch May 18, 2026 03:57
@aperezdc aperezdc added the GLib Suggested Backport - 2.52 Suggest this merge request be backported to the webkitglib/2.52 stable branch label May 19, 2026
@aperezdc
Copy link
Copy Markdown
Contributor

Backported into webkitglib/2.52 as commit 857093a

@aperezdc aperezdc removed the GLib Suggested Backport - 2.52 Suggest this merge request be backported to the webkitglib/2.52 stable branch label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKitGTK Bugs related to the Gtk API layer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants