You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In parser.js, the entities object is assigned to this on line 29:
line 29: this.entities = entities
If we console.log(this) right after line 29, we see that this corresponds to WebVTTParser.
Next on line 30, this.parse is assigned to a function. In the parse function on line 177, it is attempted to pass that same entities object to the WebVTTCueTextParser:
line 177: var cuetextparser = new WebVTTCueTextParser(cue.text, err, mode, this.entities)
However, if we do another console.log(this) here, we see that it corresponds to Window because it is being used inside the function.
So this on line 29 is not the same as this on line 177, meaning that the argument this.entities passed to the WebVTTCueTextParser on line 177 will always be undefined. This causes a bug later on line 639 in the parser
if(self.entities[buffer]) {
Uncaught TypeError: Cannot read properties of undefined (reading '&M') where the buffer here is &M and self.entities is undefined.
Proposed Change
The proposed solution is to update how entities is passed to the WebVTTCueTextParser constructor on line 177 of parser.js:
Before:
var cuetextparser = new WebVTTCueTextParser(cue.text, err, mode, this.entities)
After:
var cuetextparser = new WebVTTCueTextParser(cue.text, err, mode, entities)
Bug Description
In
parser.js
, theentities
object is assigned tothis
on line 29:If we
console.log(this)
right after line 29, we see thatthis
corresponds toWebVTTParser
.Next on line 30, this.parse is assigned to a function. In the parse function on line 177, it is attempted to pass that same entities object to the WebVTTCueTextParser:
However, if we do another
console.log(this)
here, we see that it corresponds toWindow
because it is being used inside the function.So
this
on line 29 is not the same asthis
on line 177, meaning that the argumentthis.entities
passed to the WebVTTCueTextParser on line 177 will always be undefined. This causes a bug later on line 639 in the parserUncaught TypeError: Cannot read properties of undefined (reading '&M')
where the buffer here is&M
andself.entities
is undefined.Proposed Change
The proposed solution is to update how entities is passed to the WebVTTCueTextParser constructor on line 177 of
parser.js
:Before:
After:
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: