Bug 1432950 - Remove the scrollbar-base binding to prevent XBL JS from running on scrollbars in content;r=smaug;r=dao
The events that get silenced here are already covered for native anonymous content
by IsEventStoppedFromAnonymousScrollbar.
In trees, where <xul:scrollbar> and <xul:scrollcorner> are part of the DOM, copy the
handlers over into attributes on each instance.
MozReview-Commit-ID: Huk5nFC7Qua
--- a/toolkit/content/widgets/scrollbar.xml
+++ b/toolkit/content/widgets/scrollbar.xml
@@ -6,26 +6,17 @@
<bindings id="scrollbarBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="thumb" extends="xul:button" />
- <binding id="scrollbar-base" bindToUntrustedContent="true">
- <handlers>
- <handler event="contextmenu" preventdefault="true" action="event.stopPropagation();"/>
- <handler event="click" preventdefault="true" action="event.stopPropagation();"/>
- <handler event="dblclick" action="event.stopPropagation();"/>
- <handler event="command" action="event.stopPropagation();"/>
- </handlers>
- </binding>
-
- <binding id="scrollbar" bindToUntrustedContent="true" extends="chrome://global/content/bindings/scrollbar.xml#scrollbar-base">
+ <binding id="scrollbar" bindToUntrustedContent="true">
<content clickthrough="always">
<xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="curpos,maxpos,disabled,sborient=orient"/>
<xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" xbl:inherits="curpos,maxpos,disabled,sborient=orient"/>
<xul:slider flex="1" xbl:inherits="disabled,curpos,maxpos,pageincrement,increment,orient,sborient=orient">
<xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient,collapsed=disabled"
align="center" pack="center"/>
</xul:slider>
<xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" xbl:inherits="curpos,maxpos,disabled,sborient=orient"/>
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -33,18 +33,26 @@
<children includes="treecols"/>
<xul:stack class="tree-stack" flex="1">
<xul:treerows class="tree-rows" flex="1" xbl:inherits="hidevscroll">
<children/>
</xul:treerows>
<xul:textbox anonid="input" class="tree-input" left="0" top="0" hidden="true"/>
</xul:stack>
<xul:hbox xbl:inherits="collapsed=hidehscroll">
- <xul:scrollbar orient="horizontal" flex="1" increment="16" style="position:relative; z-index:2147483647;"/>
- <xul:scrollcorner xbl:inherits="collapsed=hidevscroll"/>
+ <xul:scrollbar orient="horizontal" flex="1" increment="16" style="position:relative; z-index:2147483647;"
+ oncontextmenu="event.stopPropagation(); event.preventDefault();"
+ onclick="event.stopPropagation(); event.preventDefault();"
+ ondblclick="event.stopPropagation();"
+ oncommand="event.stopPropagation();"/>
+ <xul:scrollcorner xbl:inherits="collapsed=hidevscroll"
+ oncontextmenu="event.stopPropagation(); event.preventDefault();"
+ onclick="event.stopPropagation(); event.preventDefault();"
+ ondblclick="event.stopPropagation();"
+ oncommand="event.stopPropagation();"/>
</xul:hbox>
</content>
<implementation implements="nsIDOMXULTreeElement, nsIDOMXULMultiSelectControlElement">
<!-- ///////////////// nsIDOMXULTreeElement ///////////////// -->
<property name="columns"
@@ -1047,17 +1055,21 @@
</implementation>
</binding>
<binding id="treerows" extends="chrome://global/content/bindings/tree.xml#tree-base">
<content>
<xul:hbox flex="1" class="tree-bodybox">
<children/>
</xul:hbox>
- <xul:scrollbar height="0" minwidth="0" minheight="0" orient="vertical" xbl:inherits="collapsed=hidevscroll" style="position:relative; z-index:2147483647;"/>
+ <xul:scrollbar height="0" minwidth="0" minheight="0" orient="vertical" xbl:inherits="collapsed=hidevscroll" style="position:relative; z-index:2147483647;"
+ oncontextmenu="event.stopPropagation(); event.preventDefault();"
+ onclick="event.stopPropagation(); event.preventDefault();"
+ ondblclick="event.stopPropagation();"
+ oncommand="event.stopPropagation();"/>
</content>
<handlers>
<handler event="underflow">
<![CDATA[
// Scrollport event orientation
// 0: vertical
// 1: horizontal
// 2: both (not used)
--- a/toolkit/themes/osx/global/nativescrollbars.css
+++ b/toolkit/themes/osx/global/nativescrollbars.css
@@ -68,17 +68,16 @@ scrollbarbutton[type="decrement"] {
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {
-moz-appearance: scrollbarbutton-up;
}
/* ::::: square at the corner of two scrollbars ::::: */
scrollcorner {
/* XXX -moz-appearance: scrollcorner; */
- -moz-binding: url(chrome://global/content/bindings/scrollbar.xml#scrollbar-base);
width: 16px;
cursor: default;
background-color: white;
}
/* ::::::::::::::::::::: MEDIA PRINT :::::::::::::::::::::: */
@media print {
html|div scrollbar {
--- a/toolkit/themes/windows/global/xulscrollbars.css
+++ b/toolkit/themes/windows/global/xulscrollbars.css
@@ -60,17 +60,16 @@ scrollbarbutton {
min-width: 16px;
min-height: 16px;
}
/* ::::: square at the corner of two scrollbars ::::: */
scrollcorner {
/* XXX -moz-appearance: scrollcorner; */
- -moz-binding: url(chrome://global/content/bindings/scrollbar.xml#scrollbar-base);
width: 16px;
cursor: default;
background-color: -moz-Dialog;
}
/* ..... increment .... */
scrollbarbutton[type="increment"] {