window.open with scrollbars=0 sets BarProp {visible: false} on window.scrollbars
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
Webcompat Priority | P3 |
Tracking | Status | |
---|---|---|
firefox71 | --- | affected |
People
(Reporter: karlcow, Assigned: alchen)
References
(Depends on 1 open bug, )
Details
Attachments
(1 obsolete file)
Here a testcase
https://codepen.io/webcompat/pen/wvvWLbB
<a
href="http://www.mozilla.org/"
target="Moz_WindowName"
onclick="openRequestedPopup(); return false;"
>Test me!</a></p>
<script>
var windowObjectReference;
var strWindowFeatures = "height=500,width=500,scrollbars=0";
function openRequestedPopup() {
windowObjectReference = window.open("https://mozilla.org", "Moz_WindowName", strWindowFeatures);
}
</script>
On the new window, window.scrollbars
returns
- On Firefox
BarProp {visible: false}
- On Chrome, Safari
BarProp {visible: true}
Basically Chrome, Safari ignores it.
https://html.spec.whatwg.org/multipage/window-object.html#dom-window-scrollbars
I don't see anything how scrollbars=0
should be translated.
![]() |
Reporter | |
Comment 1•5 years ago
|
||
Ah here.
https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean
To parse a boolean feature given a string value:
If value is the empty string, then return true.
If value is a case-sensitive match for yes, then return true.
Let parsed be the result of parsing value as an integer.
If parsed is an error, then set it to 0.
Return false if parsed is 0, and true otherwise.
So I guess chrome and safari do not follow the spec here. Or maybe it's not clear
if value is `0`, then return false
Should I open a bug on the whatwg spec.
![]() |
Reporter | |
Comment 2•5 years ago
|
||
I see https://bugs.chromium.org/p/chromium/issues/detail?id=310691
Issue 310691: Remove BarProp properties from Window object
Oh Bug 1200936
Comment 4•5 years ago
|
||
As far as I can tell Firefox is the only browser that lets the site dictate the scrollbar. Other browsers ignore scrollbars=0
and have a scrollbar anyway (which frankly seems a lot better for security). (No difference if the popup is same origin by the way.) I don't think bug 1200936 will help with this however as this bug is mostly whether window.open()
features are respected, and of those scrollbars
in particular.
As those window.open()
features are still not properly defined some care probably has to be taken in removing support for one of them. I suspect bz would be best suited to at least explain what someone tackling this would need to do.
![]() |
||
Comment 5•5 years ago
|
||
Basically modify https://searchfox.org/mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c/toolkit/components/windowwatcher/nsWindowWatcher.cpp#1718-1723 so that we always add the nsIWebBrowserChrome::CHROME_SCROLLBARS
flag in the cases when !aDialog && !aHasChromeParent && !aChromeURL
.
Comment 6•5 years ago
|
||
Per https://github.com/whatwg/html/issues/2464 there might also be other features we'd want to disallow web content to set (I haven't tested if these work to begin with, mind), potentially as a follow-up:
- resizable
- menubar
- status
![]() |
||
Comment 7•5 years ago
|
||
"resizable" and "status" are already disallowed by default. See https://searchfox.org/mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c/modules/libpref/init/all.js#949,951 and bug 177838 and bug 283103 (or maybe bug 22183) respectively.
"menubar" is allowed at the moment, as far as I can tell.
![]() |
Reporter | |
Comment 8•5 years ago
|
||
scrollbars=0
→BarProp {visible: false}
in Firefoxscrollbars=
→BarProp {visible: false}
in Firefoxscrollbars
→BarProp {visible: true}
in Firefoxscrollbars=yes
→BarProp {visible: true}
in Firefoxscrollbars=no
→BarProp {visible: false}
in Firefox
Safari, Chrome always BarProp {visible: true}
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
Backed out changeset 4dfd98d37804 (bug 1589299) for Wr failures at css/css-writing-modes/wm-propagation-svg-root-scrollbar.svg
Backout: https://hg.mozilla.org/integration/autoland/rev/c230c87ea4414402b1e803ee965422310815f69b
Failure push: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=4dfd98d37804f1f34f846bef0c31e2a5523146f5
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=290586781&repo=autoland&lineNumber=25178
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
Backed out changeset 3da713367dfd (Bug 1589299) for causing mochitest permafailures in layout/base/tests/test_transformed_scrolling_repaints_3.html CLOSED TREE
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=291472060&repo=autoland&lineNumber=16113
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 17•5 years ago
•
|
||
Since this bug is trying to "force scrollbars flag to be always enabled for new window", I remove all places of "set scroballbars flag" from our tests in the latest revision.
Only two of them will affect the result:
dom/html/test/test_bug369370.html: Fix the failure by refining the test.
layout/base/tests/test_transformed_scrolling_repaints_3.html: The scrollbar will affect the result on windows. After investigation, we can enlarge the new window to prevent the scrollbar and it won't affect the test purpose and result.
However, if we want to keep the ability to disable scrollbars, maybe we should introduce a preference for testing. What do you think?
Assignee | ||
Comment 18•5 years ago
|
||
Try result with removing all places of "set scroballbars flag" from our tests
https://treeherder.mozilla.org/#/jobs?repo=try&revision=440d6e02762322bab4bef29fe8100859c9c2876c
dom/html/test/test_bug369370.html | Checking scrollLeft - got 415, expected 400
OS X 10.14 debug, OS X 10.14 Shippable opt
layout/base/tests/test_transformed_scrolling_repaints_3.html | Fully-visible scrolled element should not have been painted - got true, expected false
Windows 7 opt, debug, Shippable opt
Windows 10 x64 opt, asan, debug, Shippable opt
Comment 19•5 years ago
•
|
||
I'm not sure whether we need a pref, but no need to modify the tests.
I mean, if the test passes with or without the scrollbar=*
Comment 20•5 years ago
|
||
FWIW, I don't think we should keep the capability to open a popup that does not have scrollbars. The popup can make the scrollbars disappear itself, but letting someone else do it is problematic.
Comment 21•5 years ago
|
||
bug 1507375 is going to change the features
parameter (UI related items) just a condition for whether to open a popup or not,
just like Google Chrome and Safari.
Comment 22•5 years ago
|
||
Perhaps we should just land bug 1507375 and not this one at all.
Assignee | ||
Comment 23•5 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #22)
Perhaps we should just land bug 1507375 and not this one at all.
Agree.
Updated•5 years ago
|
Description
•