emscripten-core / emscripten-core/emscripten
Uncaught TypeError in setCanvasElementSizeCallingThread
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 125
Description
The error says
Uncaught TypeError: Cannot read properties of null (reading '0')
The error comes from the code below.
var autoResizeViewport = false;
if (canvas.GLctxObject && canvas.GLctxObject.GLctx) {
var prevViewport = canvas.GLctxObject.GLctx.getParameter(2978);
autoResizeViewport =
prevViewport[0] === 0 &&
prevViewport[1] === 0 &&
prevViewport[2] === canvas.width &&
prevViewport[3] === canvas.height;
}
It seems prevViewport is 0.
I'm not really familiar with the js side. Is the js file that contains setCanvasElementSizeCallingThread generated by emsdk? I'm not sure if this is an emsdk issue or a user issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating setCanvasElementSizeCallingThread in the generated JavaScript and compare it with the emsdk source that produces it. Reproduce the reported null or zero prevViewport case and determine the expected behavior for the viewport lookup; the issue is complete when the TypeError is accounted for and the behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, wasm
- Domain
- compilers, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100