Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in FS.createPreloadedFile: request for Module['canvas']? #2309

Closed
polymeris opened this issue Apr 24, 2014 · 2 comments
Closed

Error in FS.createPreloadedFile: request for Module['canvas']? #2309

polymeris opened this issue Apr 24, 2014 · 2 comments

Comments

@polymeris
Copy link
Contributor

After adding a text file with --preload-file, I started to get the following error:

Uncaught TypeError: Cannot read property 'requestPointerLock' of undefined tox.js:6883
Browser.init tox.js:6883
FS.createPreloadedFile tox.js:3978
DataRequest.finish tox.js:104
DataRequest.onload tox.js:99
processPackageData tox.js:128
start tox.js:68
xhr.onload

The "undefined" value is actually Module['canvas']
The culprit seems to be src/librarybrowser.js:198

      var canvas = Module['canvas'];

      // forced aspect ratio can be enabled by defining 'forcedAspectRatio' on Module
      // Module['forcedAspectRatio'] = 4 / 3;

      canvas.requestPointerLock = canvas['requestPointerLock'] ||
                                  canvas['mozRequestPointerLock'] ||
                                  canvas['webkitRequestPointerLock'] ||
                                  canvas['msRequestPointerLock'] ||
                                  function(){};

My program doesn't even use canvas (and the loaded file is not an image or animation), so I don't understand what the purpose of this code is.

Edit: Issue #1042 might be related.

@kripken
Copy link
Member

kripken commented Apr 24, 2014

I think your project's html file does not define a canvas? I pushed a commit now to incoming to not set up the events if a canvas is not present, does that fix it?

@polymeris
Copy link
Contributor Author

Yes, that does the trick. Thanks, @kripken

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

No branches or pull requests

2 participants