Skip to content
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

video.js - infinite recursion with unprefixed Fullscreen API #2498

Closed
upsuper opened this issue Apr 29, 2016 · 14 comments
Closed

video.js - infinite recursion with unprefixed Fullscreen API #2498

upsuper opened this issue Apr 29, 2016 · 14 comments
Labels
browser-edge browser-firefox engine-gecko The browser uses the Gecko rendering engine priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. status-needsinfo
Milestone

Comments

@upsuper
Copy link

upsuper commented Apr 29, 2016

URL: https://github.com/videojs/video.js
Browser / Version: Firefox 47+ / Microsoft Edge
Operating System:
Problem type: Something else - I'll add details below

Video.js (in the url) has a bug in version 4.7~4.12 that it would trigger an infinite recursion in handler of fullscreenchange event if unprefixed Fullscreen API is available.

(Before 4.7, they were detecting unprefixed API via a leagcy name which no one ever uses. After 5.0, they fix this issue via changing their internal mechanism somehow.)

Browsers all have some kind of recursion limiting mechanism, so this doesn't break functionality significantly, but it could make fullscreen change very slow.

Steps to Reproduce

  1. Navigate to sites use an old version of video.js, e.g. http://sho.co/embed/16VID
  2. Click the fullscreen button

Expected Behavior:
It enters fullscreen immediately.

Actual Behavior:
It could block the browser for up to several seconds before the content is eventually in fullscreen. And in Firefox, a line "too much recursion" would be printed in the console.

From webcompat.com with ❤️

@upsuper
Copy link
Author

upsuper commented Apr 29, 2016

cc @ehsan @annevk @foolip @tantek

@upsuper upsuper changed the title github.com - see bug description video.js - infinite recursion with unprefixed Fullscreen API Apr 29, 2016
@annevk
Copy link

annevk commented Apr 29, 2016

I'm not sure what I can do to help here. I'm guessing you don't want to change the API?

@foolip
Copy link
Member

foolip commented Apr 29, 2016

Yeah, I have been made aware of this problem in Edge before. Do all site that have this problem still function correctly after the "too much recursion" bailout, or are there sites that have code after that that fails to run, breaking the page?

@upsuper
Copy link
Author

upsuper commented Apr 29, 2016

To be honest, I didn't find many examples of this issue. I searched in Google's BigQuery (in the requests table), but most of the results are referred from an index page which doesn't actually use this library. So I cannot tell whether the page would be broken.

But given that we still have proper style applied, and this issue doesn't happen for unfullscreen, it shouldn't be too bad.

There are several potential solutions we discussed today:

  1. Make exitFullscreen in document return false to fool their feature detection (not sure whether it is feasible, though).
  2. Ask Video.js to fix all affected versions from their CDN, so that most sites would be fine. This shouldn't be too complicated for them to fix, they could just break their feature detection like what was done before 4.7 (they detected cancelFullScreen rather than exitFullscreen at that time) which should not break anything.

From the implementation side, we are considering limiting the stack size for handler of fullscreenchange to make it fail faster. (See our bug 1268794)

@foolip
Copy link
Member

foolip commented Apr 29, 2016

Replacing the copies in CDN is an interesting idea, have you talked to the video.js developers about it?

@upsuper
Copy link
Author

upsuper commented Apr 29, 2016

I haven't. Probably we can page them here?

cc @gkatsev @heff: Would you consider changing copies in CDN to make this issue less serious?

@upsuper
Copy link
Author

upsuper commented Jun 14, 2016

@foolip Do you have any plan to mitigate this issue in Blink before shipping unprefixed Fullscreen API? It seems to me this is the biggest single blocker. Gecko may try to limit the stack size as I said in some previous comment, and see what will happen.

@foolip
Copy link
Member

foolip commented Jun 14, 2016

I definitely need to test how it will behave as step zero, so I've filed https://bugs.chromium.org/p/chromium/issues/detail?id=620082

@karlcow
Copy link
Member

karlcow commented Aug 3, 2017

I wonder what is the status of this issue 1year+

@karlcow karlcow added this to the sitewait milestone Oct 30, 2017
@foolip
Copy link
Member

foolip commented Sep 4, 2018

I've tested http://sho.co/embed/16VID with Chrome Canary with the unprefixed Fullscreen API enabled and did see "Maximum call stack size exceeded". It doesn't break the functionality of this site though. There is an Intent to Ship: Unprefixed Fullscreen API with FullscreenOptions on blink-dev, and we may run into this issue in the wild and see cases where the effects are more serious.

@foolip
Copy link
Member

foolip commented Sep 4, 2018

Based on @upsuper's 4.7-5.0 range, I did a search for 'Video.js v4.' in httparchive. There are 1519 matches. Probably not all of them are 4.7+, but most that I looked at are. In other words, this code is still fairly widespread. How often it results in noticeable breakage remains to be seen.

Details: on http://sho.co/embed/16VID the version used is 4.12.15, and the code added in videojs/video.js@753ce48#diff-3b0266ff1c037b289ec624ab25b0272eR608 (first in v4.0.3) is part of the code that I see on the stack. But as @upsuper says it wasn't reached at first because of a div.cancelFullscreen !== undefined, which remained until videojs/video.js@46aa551

@miketaylr miketaylr added the engine-gecko The browser uses the Gecko rendering engine label Apr 30, 2019
@softvision-oana-arbuzov
Copy link
Member

For me on Firefox the video enters full screen immediately but still displayed the "to much recursion" error message in the console.
image

On Chrome I also receive "Uncaught RangeError: Maximum call stack size exceeded" error message when entering full screen.
image

Tested with:
Browser / Version: Firefox Nightly 70.0a1 (2019-08-21), Chrome 76.0.3809.100
Operating System: Windows 10 Pro

@upsuper can you still reproduce the initial issues ?

@softvision-oana-arbuzov softvision-oana-arbuzov added status-needsinfo severity-important A non-core broken piece of functionality, not behaving the way you would expect. priority-normal labels Aug 22, 2019
@upsuper
Copy link
Author

upsuper commented Aug 24, 2019

It seems that the fullscreen preceeds quickly now for me as well. I don't know what has been changed, but it seems that too deep recursion is no longer a problem?

@softvision-oana-arbuzov
Copy link
Member

Thanks @upsuper, I will close it as fixed. If you will encounter the issue in the future feel free to reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-edge browser-firefox engine-gecko The browser uses the Gecko rendering engine priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. status-needsinfo
Projects
None yet
Development

No branches or pull requests

7 participants