OtterBrowser / otter-browser

Otter Browser aims to recreate the best aspects of the classic Opera (12.x) UI using Qt5
https://otter-browser.org
GNU General Public License v3.0
1.83k stars 277 forks source link

A `<video>` with `<track>` inside, with `controls = false` produces errors #1676

Open NaitLee opened 3 years ago

NaitLee commented 3 years ago

OtterBrowser can't handle something properly. Details below:


Here's the HTML:

<video id="myvideo">
    <track />
</video>

Do javascript:

myvideo.src = '/path/to/video.mp4';
myvideo.controls = false;
myvideo.play();

Then errors flows in console. (Both .exe and .appimage)

TypeError: null is not an object (evaluating 'panel.parentElement.querySelector')

I've looked a bit into the problem, it's when browser trying to update time (bar?), verifying whether controls are visible, but somewhere not going well:

// At line 900, in a seems built-in script, but named "Annonymous Script 1"
    controlsAreHidden: function()
    {
        if (this.controlsAreAlwaysVisible())
            return false;
        var panel = this.controls.panel;
        return (!panel.classList.contains(this.ClassNames.show) || panel.classList.contains(this.ClassNames.hidden)) && (panel.parentElement.querySelector(':hover') !== panel);
    },

panel.parentElement is null. It maybe somewhere else have missed setting it.

Besides, a <video> without <track> works without errors.

P.S. I see another problem, but not verified well Edit: exists on all webkit browsers:

<video src="path/to/video.mp4">
    <track id="mytrack" />
</video>
mytrack.src = 'path/to/vtt';
mytrack.src = 'path/to/another_vtt';
video.play();

Both vtt subtitles are in timeline.

But on other browsers like firefox, the vtt will be replaced, i.e. only 'another_vtt' shows.


That's all... ;)