-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Regression in modularize mode (currentSrc issue) #6903
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
Comments
That bit appears to have come from d1f303a |
Odd, isn't that https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind (of binding an object which is then |
If that's not it, is it possible that the line with |
I suspect it is called, but asynchronously as part of a bigger bundle. You may want to adjust your build process or override |
Hmm, we do the And we do check if Maybe another binding happens later, overriding this one? |
Btw, this code slightly changed since the original landing - @Brion is this still an issue on latest incoming? |
(document and document.currentScript are defined at the time that bind() is called, I checked in the debugger) |
Ah, I understand what the bind() call is doing now -- it's putting the _currentScript property on the hidden this, not on the Module object... investigating further on my end. |
AHA! My call to the OGVDemuerWebMW module function was made like this:
which used to work fine. That "new" replaces the "this" parameter from the bind() call with a copy of the prototype, which has no _currentScript property. Removing the "new" from the calls should get it working... recompiling now. :) |
Aaaaand it works now. :) As far as I know following documentation correctly in the initial call would have saved me here. :D |
Great, thanks for the update @Brion! I added a commit to #6894 to avoid crashing in either the case of |
* handle the case of a missing document.currentScript, and of the MODULARIZE .bind() being overridden by `new` (see discussion in #6903). in both cases we can't find the scriptDirectory, but we should at least not crash. * generalize blob url handling in scriptDirectory computation to also handle workers
* Support new Module() (instead of just Module() ) in finding the scriptDirectory. This is done by avoiding .bind(), and saving it in a closure. This seems like a potential common pitfall, so worth supporting even if it isn't the documented use (see #6903). * Don't emit the _scriptDir code for MODULARIZE_INSTANCE - we only need it in MODULARIZE. * Refactor the emcc.py code, do the extra scriptDirectory or instance stuff later, which I think is clearer. * Add testing for MODULARIZE_INSTANCE and scriptDirectory detection.
@kripken this introduces a new problem. |
Honestly, I only came across it in this Google codelab and that's how I found the issue. I suppose the use case is interactive SVGs sharable without HTML glue? |
Interesting, thanks @tgds |
Compiling ogv.js with emscripten sdk 1.38.10, I'm seeing a new failure mode with my demuxer module, which is loaded asynchronously into the web page context:
This is in the (minified) setup code:
source:
Something about this isn't doing what I expect...
I notice at the end of the .js file is this which appears to be an attempt to capture the currentSource:
But that syntax for the Function.prototype.bind function doesn't appear to be documented on MDN, and it doesn't seem to do anything that I can tell on Safari 11.1.2.
The text was updated successfully, but these errors were encountered: