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

Avoid use of window.fullScreen and test for its absence #28862

Closed
wants to merge 1 commit into from

Conversation

foolip
Copy link
Member

@foolip foolip commented May 6, 2021

The is_fullscreen helper accidentally depended on both the Gecko-only
window.fullScreen and the WebKit-only document.webkitIsFullScreen, and
wouldn't have worked in a browser supporting only the standard
Fullscreen API.

Use document.fullscreen instead, and add a negative test for
window.fullScreen.

The is_fullscreen helper accidentally depended on both the Gecko-only
window.fullScreen and the WebKit-only document.webkitIsFullScreen, and
wouldn't have worked in a browser supporting only the standard
Fullscreen API.

Use document.fullscreen instead, and add a negative test for
window.fullScreen.

test(function() {
assert_false('fullScreen' in window);
}, 'window.fullScreen must not be supported');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand why we need this test here.

window.fullScreen in Gecko is not a historical implementation of the Fullscreen API. It was dated back way earlier than Fullscreen API, and actually was there before Firefox. It was initially implemented in a bug 20 years ago to allow the browser window to go full screen, and this API probably has been leaked to the web content since then.

So I don't think this test makes sense here, as it's unrelated to the Fullscreen API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean it doesn't return the same value as document.fullscreen? I think https://github.com/mozilla/gecko-dev/blob/2ec947a6853ee7fca5997ff5e45bd45b6afd6218/dom/base/nsGlobalWindowInner.cpp#L3655-L3664 is the implementation but I can't figure out where it ends up really returning a value.

If it's truly uncoupled to the Fullscreen API, then I agree a negative test doesn't belong here.

Copy link
Member

@upsuper upsuper May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not return the same value as document.fullscreen.

So basically, when document.fullscreen returns true, window.fullScreen returns true as well, because the browser window is also full screen, but not vice versa. If you use F11 to make the browser window full screen on a website which doesn't use Fullscreen API, then window.fullScreen also returns true while document.fullscreen would be false.

In that sense, they are not completely uncoupled, but they are different things.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wonder why this difference isn't resulting in failing tests. Or even worse, maybe the WebDriver tests depend on the Firefox behavior for window.fullScreen...

Needs investigation!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just because nothing tried to make the browser enter full screen mode without using the Fullscreen API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the tests are for https://w3c.github.io/webdriver/#dfn-fullscreen-window, which is defined in terms of https://fullscreen.spec.whatwg.org/#fullscreen-an-element, fortunately it's not exercising the browser UI fullscreen feature which isn't observable to web content.

@foolip
Copy link
Member Author

foolip commented May 6, 2021

Bad new, this regresses the webdriver tests in Firefox, for example:
https://wpt.fyi/results/webdriver/tests/fullscreen_window/fullscreen.py?diff&filter=ADC&run_id=5713487634366464&run_id=5703555254059008

My guess is that https://w3c.github.io/webdriver/#dfn-fullscreen-window in Firefox isn't implemented in terms of the Fullscreen API, so that document.fullscreen remains false. That actually seems like a sensible implementation to me, but it wouldn't be possible to test in this manner.

@jgraham what do you think we should do here? Add elaborate comments and depend on window.fullScreen in Firefox, let the tests fail, or something else?

@foolip
Copy link
Member Author

foolip commented Apr 1, 2022

I don't know how to make progress with this, so I'm abandoning it.

@foolip foolip closed this Apr 1, 2022
@foolip foolip deleted the foolip/webdriver_is_fullscreen branch April 1, 2022 13:31
@jgraham jgraham restored the foolip/webdriver_is_fullscreen branch April 1, 2022 15:06
@jgraham jgraham reopened this Apr 1, 2022
@jgraham
Copy link
Contributor

jgraham commented Apr 1, 2022

I totally missed this one, sorry. I'll look at the gecko implementation.

@whimboo
Copy link
Contributor

whimboo commented Apr 1, 2022

@jgraham what do you think we should do here? Add elaborate comments and depend on window.fullScreen in Firefox, let the tests fail, or something else?

Yes, we are setting window.fullScreen which we would have to change. I think that if other browsers pass with this change we should get it pushed. But maybe @jgraham can come up with fix somewhat soon we could wait and maybe get it merged with a next downstream sync? At least there is a bug now: https://bugzilla.mozilla.org/show_bug.cgi?id=1762622

@foolip foolip closed this Oct 11, 2022
@foolip foolip deleted the foolip/webdriver_is_fullscreen branch October 11, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants