 +            return;
 +
 +          if (this.getAttribute("bgtype") == "csslength") {
++            var _self = this;
 +            if (event.keyCode == KeyEvent.DOM_VK_UP) {
 +              IncreaseLength(this, this.getAttribute("units"));
++              if (this.oninput)
++                this.oninput.call(_self);
 +              event.preventDefault();
 +            }
 +            else if (event.keyCode == KeyEvent.DOM_VK_DOWN) {
 +              DecreaseLength(this, this.getAttribute("units"), !(this.getAttribute("unsigned") == "true"));
++              if (this.oninput)
++                this.oninput.call(_self);
 +              event.preventDefault();
 +            }
 +          }

           this.setAttribute('focused','true');
         ]]>
       </handler>
@@ -574,24 +581,35 @@
               // For now, only do this when the outermost menupopup opens.
               this.menuBoxObject.activeChild = this.mSelectedInternal;
           }

 
   <binding id="menulist-description" display="xul:menu"
            extends="chrome://global/content/bindings/menulist.xml#menulist">
diff --git a/toolkit/content/widgets/tree.xml b/toolkit/content/widgets/tree.xml
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -710,17 +710,18 @@
       <handler event="MozSwipeGesture" preventdefault="true">
         <![CDATA[
           // Figure out which row to show
           let targetRow = 0;
 
           // Only handle swipe gestures up and down
           switch (event.direction) {
             case event.DIRECTION_DOWN:
-              targetRow = this.view.rowCount - 1;
+              if (this.view)
+                targetRow = this.view.rowCount - 1;
               // Fall through for actual action
             case event.DIRECTION_UP:
               this.treeBoxObject.ensureRowIsVisible(targetRow);
               break;
           }
         ]]>
       </handler>
       <handler event="select" phase="target"
@@ -1463,35 +1464,36 @@
           <![CDATA[
             // We no longer cache the picker content, remove the old content.
             while (aPopup.childNodes.length > 2)
               aPopup.removeChild(aPopup.firstChild);
 
             var refChild = aPopup.firstChild;
 
             var tree = this.parentNode.parentNode;
-            for (var currCol = tree.columns.getFirstColumn(); currCol;
-                 currCol = currCol.getNext()) {
-              // Construct an entry for each column in the row, unless
-              // it is not being shown.
-              var currElement = currCol.element;
-              if (!currElement.hasAttribute("ignoreincolumnpicker")) {
-                var popupChild = document.createElement("menuitem");
-                popupChild.setAttribute("type", "checkbox");
-                var columnName = currElement.getAttribute("display") ||
-                                 currElement.getAttribute("label");
-                popupChild.setAttribute("label", columnName);
-                popupChild.setAttribute("colindex", currCol.index);
-                if (currElement.getAttribute("hidden") != "true")
-                  popupChild.setAttribute("checked", "true");
-                if (currCol.primary)
-                  popupChild.setAttribute("disabled", "true");
-                aPopup.insertBefore(popupChild, refChild);
+            if (tree.columns) // sanity case
+              for (var currCol = tree.columns.getFirstColumn(); currCol;
+                   currCol = currCol.getNext()) {
+                // Construct an entry for each column in the row, unless
+                // it is not being shown.
+                var currElement = currCol.element;
+                if (!currElement.hasAttribute("ignoreincolumnpicker")) {
+                  var popupChild = document.createElement("menuitem");
+                  popupChild.setAttribute("type", "checkbox");
+                  var columnName = currElement.getAttribute("display") ||
+                                   currElement.getAttribute("label");
+                  popupChild.setAttribute("label", columnName);
+                  popupChild.setAttribute("colindex", currCol.index);
+                  if (currElement.getAttribute("hidden") != "true")
+                    popupChild.setAttribute("checked", "true");
+                  if (currCol.primary)
+                    popupChild.setAttribute("disabled", "true");
+                  aPopup.insertBefore(popupChild, refChild);
+                }
               }
-            }
 
             var hidden = !tree.enableColumnDrag;
             const anonids = ["menuseparator", "menuitem"];
             for (var i = 0; i < anonids.length; i++) {
               var element = document.getAnonymousElementByAttribute(this, "anonid", anonids[i]);
               element.hidden = hidden;
             }
           ]]>
diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
