Skip to content

Commit

Permalink
Reject makeXRCompatible promise resolver on WebGLRenderingContext lost
Browse files Browse the repository at this point in the history
makeXRCompatible creates a ScriptPromiseResolver that is active until
the callback is completed by the browser process. If the
WebGLRenderingContextBase is lost before the callback is invoked,
the ScriptPromiseResolver must be rejected and disposed properly.

Bug: 1321399
Change-Id: I00d9a648c19eb62dd415f5d1d641a32e3046b67d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3651559
Reviewed-by: Brandon Jones <[email protected]>
Commit-Queue: Alexander Cooper <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1005910}
NOKEYCHECK=True
GitOrigin-RevId: 2c1bf1c0cfcc492ffc8f275395db3e78564561e8
  • Loading branch information
patrto authored and copybara-github committed May 20, 2022
1 parent afe3583 commit e7bd282
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions blink/renderer/modules/webgl/webgl_rendering_context_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7067,6 +7067,13 @@ void WebGLRenderingContextBase::LoseContextImpl(
for (wtf_size_t i = 0; i < kWebGLExtensionNameCount; ++i)
extension_enabled_[i] = false;

// This resolver is non-null during a makeXRCompatible call, while waiting
// for a response from the browser and XR process. If the WebGL context is
// lost before we get a response, the resolver has to be rejected to be
// be properly disposed of.
xr_compatible_ = false;
CompleteXrCompatiblePromiseIfPending(DOMExceptionCode::kInvalidStateError);

RemoveAllCompressedTextureFormats();

// If the DrawingBuffer is destroyed during a real lost context event it
Expand Down

0 comments on commit e7bd282

Please sign in to comment.