Skip to content

Commit

Permalink
Bug 1432950 - Remove the scrollbar-base binding to prevent XBL JS fro…
Browse files Browse the repository at this point in the history
…m running on scrollbars in content;r=dao,smaug

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

--HG--
extra : rebase_source : f5e596f04c6a2022b9d6019d49e61bf64422f912
  • Loading branch information
bgrins committed Feb 14, 2018
1 parent 7f66b81 commit a9b38c8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
11 changes: 1 addition & 10 deletions toolkit/content/widgets/scrollbar.xml
Expand Up @@ -11,16 +11,7 @@

<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"/>
Expand Down
18 changes: 15 additions & 3 deletions toolkit/content/widgets/tree.xml
Expand Up @@ -38,8 +38,16 @@
<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>

Expand Down Expand Up @@ -1052,7 +1060,11 @@
<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">
Expand Down
1 change: 0 additions & 1 deletion toolkit/themes/osx/global/nativescrollbars.css
Expand Up @@ -73,7 +73,6 @@ scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {

scrollcorner {
/* XXX -moz-appearance: scrollcorner; */
-moz-binding: url(chrome://global/content/bindings/scrollbar.xml#scrollbar-base);
width: 16px;
cursor: default;
background-color: white;
Expand Down
1 change: 0 additions & 1 deletion toolkit/themes/windows/global/xulscrollbars.css
Expand Up @@ -65,7 +65,6 @@ scrollbarbutton {

scrollcorner {
/* XXX -moz-appearance: scrollcorner; */
-moz-binding: url(chrome://global/content/bindings/scrollbar.xml#scrollbar-base);
width: 16px;
cursor: default;
background-color: -moz-Dialog;
Expand Down

0 comments on commit a9b38c8

Please sign in to comment.