Skip to content

canvas: fix unrecognized offscreen webgl context#44159

Merged
jdm merged 7 commits into
servo:mainfrom
niyabits:canvas/fix-getcontext-webgl
Apr 15, 2026
Merged

canvas: fix unrecognized offscreen webgl context#44159
jdm merged 7 commits into
servo:mainfrom
niyabits:canvas/fix-getcontext-webgl

Conversation

@niyabits
Copy link
Copy Markdown
Contributor

fix unrecognized type error on OffscreenCanvas

Testing: existing WPT:

  • tests/wpt/webgl/tests/conformance/offscreencanvas
  • tests/wpt/webgl/tests/conformance2/offscreencanvas

Fixes: #43540

@niyabits
Copy link
Copy Markdown
Contributor Author

niyabits commented Apr 13, 2026

Creating a draft PR with compiler errors because I need some help.

@jdm I looked at the get_or_init_webgl_context implementation in htmlcanvaselement.rs.

As part of getting the context step, I need to pass a &Window type.

It does not exist for the offscreen canvas.

        let window = self.global();
        let canvas =
            RootedHTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(DomRoot::from_ref(self));
        let size = self.get_size();
        let attrs = Self::get_gl_attributes(cx, options, can_gc)?;
        let context = WebGLRenderingContext::new(
            &window,
            &canvas,
            WebGLVersion::WebGL1,
            size,
            attrs,
            can_gc,
        )?;

Do we need to create a OffscreenCanvasRenderingContextWebGL like we have for 2D?

pub(crate) struct OffscreenCanvasRenderingContext2D {

And use that as a context instead?

@jdm
Copy link
Copy Markdown
Member

jdm commented Apr 13, 2026

Actually the code at

and needs to be changed to accept a &GlobalScope, then
let webgl_chan = match window.webgl_chan() {
needs to be rewritten to downcast the global to a Window or WorkerGlobalScope. Then we'll need to add
pub(crate) fn webgl_chan(&self) -> Option<WebGLCommandSender> {
self.webgl_chan
.as_ref()
.map(|chan| WebGLCommandSender::new(chan.clone()))
}
to WorkerGlobalScope, as well as
/// A handle for communicating messages to the WebGL thread, if available.
#[no_trace]
webgl_chan: Option<WebGLChan>,
.

@jdm
Copy link
Copy Markdown
Member

jdm commented Apr 13, 2026

I think you will need to add a webgl_chan member to

pub struct WorkerGlobalScopeInit {
, and then you can access it from WorkerGlobalScope::new. Then you can add a webgl_chan argument to
pub(crate) fn prepare_workerscope_init(
and get it from the globals at the callsites by (again) downcasting them to Window or WorkerGlobalScope.

@niyabits
Copy link
Copy Markdown
Contributor Author

@jdm While calling prepare_workerscope_init here:

let init = prepare_workerscope_init(global, None, Some(worker_id));

Expects a WebGLChan,
But the method on Window type returns a Option<WebGLCommandSender>

pub(crate) fn webgl_chan(&self) -> Option<WebGLCommandSender> {
self.webgl_chan
.as_ref()
.map(|chan| WebGLCommandSender::new(chan.clone()))
}

How should I go about returning WebGLChan from Window or changing the WorkerGlobalScopeInit to take a WebGLCommandSender instead?

@jdm
Copy link
Copy Markdown
Member

jdm commented Apr 14, 2026

That's fun! I suggest adding a temporary method to Window to return the WebGLChan until #44193 is fixed.

@niyabits
Copy link
Copy Markdown
Contributor Author

niyabits commented Apr 14, 2026

Thanks for the help @jdm!
Everything compiles with offscreen webgl and the tests are partially running now :)

That said, I still need to work on some stuff:
I used unwrap quite liberally on the downcast while I tried to get the changes compile.
I will revisit the error handling.

In the draw_offscreen_canvas function in CanvasState we need to specify arms for webgl in the match.
I have added a comment and I will revisit them tomorrow.

if let Some(context) = canvas.context() {
match *context {

Same for the RenderingContext::Placeholder(ref context) in the draw_html_canvas_element function,

RenderingContext::Placeholder(ref context) => {
let Some(context) = context.context() else {
return Err(Error::InvalidState(None));
};
match *context {

I copied an unsafe method and implemented it on the OffscreenCanvas struct.
get_gl_attributes

I think this should be okay, although, I am not sure if there is a better way.

Test Result Summary

tests/wpt/webgl/tests/conformance/offscreencanvas

Ran 12 tests finished in 14.8 seconds.
  • 0 ran as expected.
  • 6 tests crashed unexpectedly
  • 6 tests unexpectedly okay
  • 5 tests had unexpected subtest results

tests/wpt/webgl/tests/conformance2/offscreencanvas

Ran 8 tests finished in 11.0 seconds.
  • 0 ran as expected.
  • 6 tests crashed unexpectedly
  • 2 tests unexpectedly okay
  • 1 tests had unexpected subtest results
Details

Comment thread components/script/dom/workers/worker.rs Outdated
Comment thread components/script/dom/workers/serviceworkerregistration.rs Outdated
Comment thread components/script/dom/canvas/offscreencanvas.rs Outdated
Comment thread components/script/dom/canvas/offscreencanvas.rs Outdated
Comment thread components/script/dom/canvas/2d/canvas_state.rs Outdated
Comment thread components/script/dom/canvas/2d/canvas_state.rs Outdated
@jdm
Copy link
Copy Markdown
Member

jdm commented Apr 14, 2026

Exciting! This is looking really good!

@niyabits niyabits force-pushed the canvas/fix-getcontext-webgl branch from e240528 to dc758c1 Compare April 14, 2026 18:31
@niyabits niyabits marked this pull request as ready for review April 14, 2026 18:41
@niyabits niyabits requested a review from gterzian as a code owner April 14, 2026 18:41
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 14, 2026
Comment on lines +227 to +229
self.global()
.downcast::<Window>()
.and_then(|window| {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, we can file a followup issue about updating WebGLRenderingContext::new to accept a &GlobalScope argument instead.

Copy link
Copy Markdown
Contributor Author

@niyabits niyabits Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have filed an issue :)
#44213

Comment thread components/script/dom/canvas/2d/canvas_state.rs Outdated
@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Apr 14, 2026
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Apr 14, 2026
@jdm jdm added the T-linux-wpt Do a try run of the WPT label Apr 14, 2026
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Apr 14, 2026
@github-actions
Copy link
Copy Markdown

🔨 Triggering try run (#24417719696) for Linux (WPT)

@github-actions
Copy link
Copy Markdown

Test results for linux-wpt from try job (#24417719696):

Flaky unexpected result (34)
  • TIMEOUT /FileAPI/url/url-in-tags-revoke.window.html (#19978)
    • TIMEOUT [expected PASS] subtest: Fetching a blob URL immediately before revoking it works in &lt;script&gt; tags.

      Test timed out
      

  • OK /_mozilla/css/offset_properties_inline.html (#40543)
    • FAIL [expected PASS] subtest: offsetTop

      assert_equals: offsetTop of #inline-1 should be 0. expected 0 but got -1
      

    • FAIL [expected PASS] subtest: offsetLeft

      assert_equals: offsetLeft of #inline-2 should be 40. expected 40 but got 25
      

  • CRASH [expected OK] /_webgl/conformance/ogles/GL/floor/floor_001_to_006.html
  • CRASH [expected OK] /content-security-policy/meta/sandbox-iframe.html (#43478)
  • FAIL [expected PASS] /css/css-backgrounds/background-size-042.html
  • FAIL [expected PASS] /css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-radio-input-border-end-end-radius-001.html
  • OK /encoding-detection/ru-IBM866-late.tentative.html
    • FAIL [expected PASS] subtest: Check detection result

      assert_equals: Expected IBM866 expected "IBM866" but got "UTF-8"
      

  • CRASH [expected OK] /fetch/api/redirect/redirect-to-dataurl.any.worker.html
  • OK [expected ERROR] /fetch/fetch-later/quota/same-origin-iframe/accumulated-oversized-payload.https.window.html (#41705)
  • OK [expected ERROR] /fetch/fetch-later/quota/same-origin-iframe/sandboxed-iframe.https.window.html (#41704)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-cross-origin.sub.window.html (#29056)
    • PASS [expected FAIL] subtest: Cross-origin navigation started from unload handler must be ignored
  • OK /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • PASS [expected FAIL] subtest: aElement.click() before the load event must NOT replace
  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-requestsubmit.html (#44098)
    • FAIL [expected TIMEOUT] subtest: Replace before load, triggered by formElement.requestSubmit()

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement=" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&amp;code=%0A%20%20%20%20const%20form%20%3D%20document.createElement(%22form%22)%3B%0A%20%20%20%20form.action%20%3D%20%22%2Fcommon%2Fblank.html%22%3B%0A%0A%20%20%20%20const%20input%20%3D%20document.createElement(%22input%22)%3B%0A%20%20%20%20input.type%20%3D%20%22hidden%22%3B%0A%20%20%20%20input.name%20%3D%20%22thereplacement%22%3B%0A%20%20%20%20form.append(input)%3B%0A%0A%20%20%20%20document.currentScript.before(form)%3B%0A%20%20%20%20form.requestSubmit()%3B%0A%20%20"
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-submit.html (#44028)
  • OK /html/browsers/history/the-history-interface/traverse_the_history_2.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • CRASH [expected OK] /html/browsers/sandboxing/sandbox-initial-empty-document-toward-same-origin.html (#35948)
  • ERROR [expected OK] /html/canvas/offscreen/text/2d.text.measure.getActualBoundingBox.tentative.html (#43710)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-empty.html (#28259)
    • TIMEOUT [expected FAIL] subtest: Autofocus elements in top-level browsing context's documents with empty fragments should work.

      Test timed out
      

  • OK [expected TIMEOUT] /html/semantics/embedded-content/media-elements/src_object_blob.html (#40340)
    • PASS [expected TIMEOUT] subtest: HTMLMediaElement.srcObject blob
  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_other_frame_popup.sub.html (#39702)
    • TIMEOUT [expected FAIL] subtest: Sandboxed iframe can not navigate other frame's popup

      Test timed out
      

  • CRASH [expected ERROR] /html/semantics/forms/the-select-element/customizable-select/select-appearance-button-after-span.html
  • OK /html/semantics/scripting-1/the-script-element/module/dynamic-import/blob-url.any.worker-module.html (#43510)
    • FAIL [expected PASS] subtest: Revoking a blob URL immediately after calling import will not fail

      promise_test: Unhandled rejection with value: object "TypeError: Module fetching failed"
      

  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html
    • TIMEOUT [expected PASS] subtest: Post-navigation state reset.

      Test timed out
      

  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-dynamic-import.html
    • FAIL [expected PASS] subtest: document.write in an imported module

      assert_true: onload must be called expected true got false
      

  • TIMEOUT [expected OK] /infrastructure/testdriver/click_nested.html (#43887)
    • NOTRUN [expected FAIL] subtest: TestDriver click method with multiple windows and nested iframe
  • OK /mixed-content/tentative/autoupgrades/video-upgrade.https.sub.html (#41135)
    • FAIL [expected PASS] subtest: Video autoupgraded

      assert_equals: Length. expected 1 but got Infinity
      

  • OK /navigation-timing/test-navigation-type-reload.html (#33334)
    • PASS [expected FAIL] subtest: Reload domComplete &gt; Original domComplete
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventEnd &gt; Original domContentLoadedEventEnd
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventStart &gt; Original domContentLoadedEventStart
    • PASS [expected FAIL] subtest: Reload domInteractive &gt; Original domInteractive
    • PASS [expected FAIL] subtest: Reload fetchStart &gt; Original fetchStart
    • PASS [expected FAIL] subtest: Reload loadEventEnd &gt; Original loadEventEnd
    • PASS [expected FAIL] subtest: Reload loadEventStart &gt; Original loadEventStart
  • FAIL [expected PASS] /png/apng/fcTL-dispose-previous.html (#41561)
  • TIMEOUT [expected OK] /pointerevents/compat/pointerevent_touch-action_two-finger_interaction.html
    • NOTRUN [expected PASS] subtest: touch two-finger pan on 'touch-action: pan-x pan-y'
    • NOTRUN [expected FAIL] subtest: touch two-finger pan on 'touch-action: pinch-zoom'
  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?06-10 (#37920)
    • PASS [expected TIMEOUT] subtest: Navigate a frame via anchor with javascript:-urls w/ default policy in report-only mode.
    • FAIL [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ a default policy throwing an exception in enforcing mode.

      promise_test: Unhandled rejection with value: "Unexpected message received: \"No securitypolicyviolation reported!\""
      

    • FAIL [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ a default policy throwing an exception in report-only mode.

      promise_test: Unhandled rejection with value: "Unexpected message received: \"No securitypolicyviolation reported!\""
      

  • OK /webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html (#22849)
    • FAIL [expected PASS] subtest: buffer-stitching-2

      assert_approx_equals: Stitched sine‑wave buffers at sample rate 43800 sample[40023] |-12948399 - 0.8981685638427734| = 12948399.898168564 &gt; 0.0038986 expected 0.8981685638427734 +/- 0.0038986 but got -12948399
      

  • CRASH [expected OK] /webaudio/the-audio-api/the-mediastreamaudiodestinationnode-interface/closed-audiocontext-construction.html
  • OK /webdriver/tests/classic/get_window_handles/get.py
    • ERROR [expected PASS] subtest: test_no_top_browsing_context

      setup error: webdriver.error.NoSuchElementException: no such element (404)
      

  • CRASH [expected ERROR] /workers/Worker-constructor-proto.any.serviceworker.html
Stable unexpected results that are known to be intermittent (17)
  • FAIL [expected PASS] /_mozilla/mozilla/sslfail.html (#10760)
  • TIMEOUT [expected OK] /_mozilla/mozilla/window_resize_event.html (#36741)
    • TIMEOUT [expected PASS] subtest: Popup onresize event fires after resizeTo

      Test timed out
      

  • CRASH [expected PASS] /_mozilla/shadow-dom/move-element-with-ua-shadow-tree-crash.html (#39473)
  • OK [expected ERROR] /_webgl/conformance2/textures/misc/origin-clean-conformance-offscreencanvas.html (#29589)
    • PASS [expected NOTRUN] subtest: Overall test
  • OK /css/css-fonts/generic-family-keywords-001.html (#37467)
    • PASS [expected FAIL] subtest: @font-face matching for quoted and unquoted generic(kai)
  • OK /css/css-fonts/generic-family-keywords-003.html (#38994)
    • FAIL [expected PASS] subtest: @font-face matching for quoted and unquoted fantasy (drawing text in a canvas)

      assert_equals: quoted fantasy matches  @font-face rule expected 125 but got 40
      

    • FAIL [expected PASS] subtest: @font-face matching for quoted and unquoted system-ui (drawing text in a canvas)

      assert_equals: quoted system-ui matches  @font-face rule expected 125 but got 40
      

    • FAIL [expected PASS] subtest: @font-face matching for quoted and unquoted generic(fangsong) (drawing text in a canvas)

      assert_equals: quoted generic(fangsong) matches  @font-face rule expected 125 but got 40
      

    • FAIL [expected PASS] subtest: @font-face matching for quoted and unquoted generic(khmer-mul) (drawing text in a canvas)

      assert_equals: unquoted generic(khmer-mul) does not match @font-face rule expected 40 but got 125
      

    • PASS [expected FAIL] subtest: @font-face matching for quoted and unquoted generic(nastaliq) (drawing text in a canvas)
    • FAIL [expected PASS] subtest: @font-face matching for quoted and unquoted ui-sans-serif (drawing text in a canvas)

      assert_equals: unquoted ui-sans-serif does not match @font-face rule expected 40 but got 125
      

  • TIMEOUT /fetch/metadata/generated/css-images.https.sub.tentative.html (#42229)
    • FAIL [expected PASS] subtest: content sec-fetch-site - Same-Origin -&gt; Same Origin

      assert_unreached: Reached unreachable code
      

  • ERROR [expected OK] /focus/focus-event-after-switching-iframes.sub.html (#40368)
  • TIMEOUT [expected ERROR] /html/browsers/browsing-the-web/history-traversal/pageswap/pageswap-initial-navigation.html (#40387)
  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation expected property 1 to be 5 but got 3 (expected array [6, 5] got [6, 3])
      

  • TIMEOUT /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • TIMEOUT [expected FAIL] subtest: Element with tabindex should support autofocus

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Non-HTMLElement should not support autofocus
  • OK /html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1.html (#39694)
    • FAIL [expected PASS] subtest: Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due

      uncaught exception: Error: assert_unreached: The iframe from which the meta came from must not refresh Reached unreachable code
      

  • OK /mixed-content/tentative/autoupgrades/mixed-content-cors.https.sub.html (#41123)
    • PASS [expected FAIL] subtest: Cross-Origin video should get upgraded even if CORS is set
  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?01-05 (#38975)
    • PASS [expected TIMEOUT] subtest: Navigate a window via anchor with javascript:-urls in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ default policy in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via anchor with javascript:-urls in enforcing mode.
  • TIMEOUT [expected OK] /trusted-types/trusted-types-navigation.html?26-30 (#38807)
    • TIMEOUT [expected PASS] subtest: Navigate a window via form-submission with javascript:-urls in report-only mode.

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Navigate a window via form-submission with javascript:-urls w/ default policy in report-only mode.
    • NOTRUN [expected PASS] subtest: Navigate a frame via form-submission with javascript:-urls in enforcing mode.
    • NOTRUN [expected PASS] subtest: Navigate a frame via form-submission with javascript:-urls w/ default policy in enforcing mode.
  • OK /webdriver/tests/classic/accept_alert/accept.py (#43194)
    • FAIL [expected PASS] subtest: test_null_response_value

      AssertionError: no such alert (404): No user prompt is currently active.
      

  • OK /webdriver/tests/classic/dismiss_alert/dismiss.py (#39098)
    • FAIL [expected PASS] subtest: test_null_response_value

      AssertionError: no such alert (404): No user prompt is currently active.
      

Stable unexpected results (13)
  • OK [expected ERROR] /_webgl/conformance/textures/misc/origin-clean-conformance-offscreencanvas.html
    • PASS [expected NOTRUN] subtest: Overall test
    • FAIL [expected PASS] subtest: WebGL test #3

      assert_true: texSubImage2D with cross-origin image should throw exception. expected true got false
      

  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-alpha-alpha-unsigned_byte.html
    • PASS [expected FAIL] subtest: WebGL test #0
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-luminance-luminance-unsigned_byte.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,255,255
      at (0, 0) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,255,255
      at (0, 16) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,255,255
      at (0, 0) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,255,255
      at (0, 16) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,255,255
      at (0, 0) expected: 255,255,255 was 0,0,0 expected true got false
      

    • And 15 more unexpected results...
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,255,255
      at (0, 0) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,255,255
      at (0, 16) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,255,255
      at (0, 0) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,255,255
      at (0, 16) expected: 255,255,255 was 0,0,0 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,255,255
      at (0, 0) expected: 255,255,255 was 0,0,0 expected true got false
      

    • And 15 more unexpected results...
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_byte.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • And 15 more unexpected results...
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • And 15 more unexpected results...
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_byte.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • And 15 more unexpected results...
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • And 15 more unexpected results...
  • ERROR /_webgl/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html
    • PASS [expected FAIL] subtest: WebGL test #0
    • FAIL [expected PASS] subtest: WebGL test #4

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #6
    • FAIL [expected PASS] subtest: WebGL test #10

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #12
    • FAIL [expected PASS] subtest: WebGL test #16

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #18
    • FAIL [expected PASS] subtest: WebGL test #22

      assert_true: shouldBe 255,0,0,255
      at (0, 16) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #24
    • FAIL [expected PASS] subtest: WebGL test #28

      assert_true: shouldBe 255,0,0,255
      at (0, 0) expected: 255,0,0,255 was 0,255,0,255 expected true got false
      

    • And 15 more unexpected results...
  • OK /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html
    • PASS [expected FAIL] subtest: Test that getContext with supported string returns correct results
    • PASS [expected FAIL] subtest: Test that getContext twice with different context type returns null the second time
    • PASS [expected FAIL] subtest: Test that webglcontext.canvas should return the original OffscreenCanvas
  • OK /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize.html
    • PASS [expected FAIL] subtest: Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a webgl context attached.
  • OK /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html
    • PASS [expected FAIL] subtest: Test that transferToImageBitmap returns an ImageBitmap with correct width and height
  • OK [expected ERROR] /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html

@github-actions
Copy link
Copy Markdown

⚠️ Try run (#24417719696) failed!

@niyabits
Copy link
Copy Markdown
Contributor Author

We could potentially merge this after #44214
I could rebase and replace all the webgl_chan_value() with webgl_chan()

Alternatively, we could do another cleanup PR or do cleanup in #44214 :)

@jdm
Copy link
Copy Markdown
Member

jdm commented Apr 14, 2026

Let's merge this as is :)

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Apr 14, 2026
@jdm jdm added this pull request to the merge queue Apr 14, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 14, 2026
Merged via the queue into servo:main with commit 8bdfb99 Apr 15, 2026
30 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OffscreenCanvas: getContext('webgl') doesn't work

3 participants