Bug 1432950 - Remove the scrollbar-base binding to prevent XBL JS from running on scrollbars in content;r=dao,smaug
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 14 Feb 2018 09:12:56 -0800
changeset 458776 7080e442652d1a3725b68f7ce36348360276aa73
parent 458775 ab50bf89a3ac2937572aa2fc176acbf5cc52682e
child 458777 36480ec73c274b6e671fcf4498d051410e318434
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, smaug
bugs1432950
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1432950 - Remove the scrollbar-base binding to prevent XBL JS from 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
toolkit/content/widgets/scrollbar.xml
toolkit/content/widgets/tree.xml
toolkit/themes/osx/global/nativescrollbars.css
toolkit/themes/windows/global/xulscrollbars.css
--- 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"] {