-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Extra return in minified JS causing "unreachable code after return statement" #8684
Comments
👋 Thanks for opening your first issue here! 👋 If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
It's at this line, buffered() {
var e = ou(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null,
t = ou(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
if (t && !e) return this.audioBuffered();
if (e && !t) return this.videoBuffered();
{
var r = this.audioBuffered();
var n = this.videoBuffered();
let e = null,
t = null,
i = 0;
var a = [],
o = [];
if (!(r && r.length && n && n.length)) return Vl();
let s = r.length;
for (; s--; ) a.push({ time: r.start(s), type: "start" }), a.push({ time: r.end(s), type: "end" });
for (s = n.length; s--; ) a.push({ time: n.start(s), type: "start" }), a.push({ time: n.end(s), type: "end" });
for (
a.sort(function (e, t) {
return e.time - t.time;
}),
s = 0;
s < a.length;
s++
)
"start" === a[s].type ? 2 === ++i && (e = a[s].time) : "end" === a[s].type && 1 === --i && (t = a[s].time), null !== e && null !== t && (o.push([e, t]), (e = null), (t = null));
return Vl(o);
return;
}
}
setDuration(e, t = tu) {
du({ type: "mediaSource", sourceUpdater: this, action: lu.duration(e), name: "duration", doneFn: t });
} |
It's benign, but does cause a warning in the console and I wonder why it would add the extra return statement |
We need to look at switching the minifier we are using. |
Description
There appears to be an odd issue with the minification process. An extra return statement is causing "unreachable code after return statement," reported to me at
video.min.js:38:146220
You can find it here: http://vjs.zencdn.net/8.10.0/video.min.js
By searching for the string
return Vl(o);return}}setDuration
I believe the specific
setDuration
reference is from around line 57,340 in the unminified version and perhaps it's getting mixed up in thebuffered()
method that comes directly before it. When I remove the extra return manually from a bundled minified version it works perfectly without error or warning.Reduced test case
https://jsfiddle.net/7bhg3j68/
Steps to reproduce
Errors
No response
What version of Video.js are you using?
8.10.0
Video.js plugins used.
None
What browser(s) including version(s) does this occur with?
Firefox 124
What OS(es) and version(s) does this occur with?
Linux
The text was updated successfully, but these errors were encountered: