Skip to content

Regression in modularize mode (currentSrc issue) #6903

Closed
@bvibber

Description

@bvibber

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:

[Error] TypeError: null is not an object (evaluating 'ca.src')

This is in the (minified) setup code:

        if (n) {
            var da = this._currentScript || document.currentScript;
            0 !== da.src.indexOf("blob:") && (t = da.src.split("/").slice(0, -1).join("/") +
            "/")
        } else

source:

   if (ENVIRONMENT_IS_WEB) {
#if MODULARIZE
    // When MODULARIZE, this JS may be executed later, after document.currentScript is gone, so we send it
    // using this._currentScript.
#else
    var currentScript = document.currentScript;
#endif
     if (currentScript.src.indexOf('blob:') !== 0) {
       scriptDirectory = currentScript.src.split('/').slice(0, -1).join('/') + '/';
     }

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:

OGVDemuxerWebMW = OGVDemuxerWebMW.bind({
    _currentScript: typeof document !== 'undefined' ? document.currentScript : undefined
});

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions