Bug 582023 cleanup based on comments from Dao on things that are not iQ:
authorMichael Yoshitaka Erlewine <mitcho@mitcho.com>
Tue, 10 Aug 2010 19:20:05 -0400
changeset 50306 5a46a7680fd26d82f3337cfe43fbf27dc7dbc5c6
parent 50305 3814227a3bbf0a7b38fefeafab51673b13df3a40
child 50307 09bc63c0e629146fe569d278a200cd6c9662d58e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs582023
milestone2.0b4pre
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 582023 cleanup based on comments from Dao on things that are not iQ: - typeof() is not a function - formatting of && and || at the end of the line - declaring variables more locally using let in Utils.extend - the Initial Developer is the Mozilla Foundation
browser/base/content/tabview/drag.js
browser/base/content/tabview/groupitems.js
browser/base/content/tabview/infoitems.js
browser/base/content/tabview/items.js
browser/base/content/tabview/modules/utils.jsm
browser/base/content/tabview/tabitems.js
browser/base/content/tabview/trench.js
browser/base/content/tabview/ui.js
--- a/browser/base/content/tabview/drag.js
+++ b/browser/base/content/tabview/drag.js
@@ -115,21 +115,21 @@ Drag.prototype = {
     var update = false; // need to update
     var updateX = false;
     var updateY = false;
     var newRect;
     var snappedTrenches = {};
 
     // OH SNAP!
     if ( // if we aren't holding down the meta key...
-         !Keys.meta
-         && (!checkItemStatus // don't check the item status...
-              // OR we aren't a tab on top of something else, and there's no drop site...
-              || (!(this.item.isATabItem && this.item.overlapsWithOtherItems())
-                 && !iQ(".acceptsDrop").length))
+         !Keys.meta &&
+         (!checkItemStatus || // don't check the item status...
+         // OR we aren't a tab on top of something else, and there's no drop site...
+         (!(this.item.isATabItem && this.item.overlapsWithOtherItems()) &&
+             !iQ(".acceptsDrop").length))
         ) {
       newRect = Trenches.snap(bounds,stationaryCorner,assumeConstantSize,keepProportional);
       if (newRect) { // might be false if no changes were made
         update = true;
         snappedTrenches = newRect.snappedTrenches || {};
         bounds = newRect;
       }
     }
@@ -271,18 +271,18 @@ Drag.prototype = {
 
   // ----------
   // Function: stop
   // Called in response to an <Item> draggable "stop" event.
   stop: function() {
     Trenches.hideGuides();
     this.item.isDragging = false;
 
-    if (this.parent && !this.parent.locked.close && this.parent != this.item.parent
-        && this.parent.isEmpty()) {
+    if (this.parent && !this.parent.locked.close && this.parent != this.item.parent &&
+       this.parent.isEmpty()) {
       this.parent.close();
     }
 
     if (this.parent && this.parent.expanded)
       this.parent.arrange();
 
     if (this.item && !this.item.parent) {
       this.item.setZ(drag.zIndex);
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -59,17 +59,17 @@
 //   locked - see <Item.locked>; default is {}
 //   userSize - see <Item.userSize>; default is null
 //   bounds - a <Rect>; otherwise based on the locations of the provided elements
 //   container - a DOM element to use as the container for this groupItem; otherwise will create
 //   title - the title for the groupItem; otherwise blank
 //   dontPush - true if this groupItem shouldn't push away on creation; default is false
 window.GroupItem = function GroupItem(listOfEls, options) {
   try {
-  if (typeof(options) == 'undefined')
+  if (typeof options == 'undefined')
     options = {};
 
   this._inited = false;
   this._children = []; // an array of Items
   this.defaultSize = new Point(TabItems.tabWidth * 1.5, TabItems.tabHeight * 1.5);
   this.isAGroupItem = true;
   this.id = options.id || GroupItems.getNextID();
   this._isStacked = false;
@@ -572,17 +572,17 @@ window.GroupItem.prototype = Utils.exten
       Utils.assertThrow(!item.parent || item.parent == this, 
           "shouldn't already be in another groupItem");
 
       item.removeTrenches();
 
       if (!dropPos)
         dropPos = {top:window.innerWidth, left:window.innerHeight};
 
-      if (typeof(options) == 'undefined')
+      if (typeof options == 'undefined')
         options = {};
 
       var self = this;
 
       var wasAlreadyInThisGroupItem = false;
       var oldIndex = this._children.indexOf(item);
       if (oldIndex != -1) {
         this._children.splice(oldIndex, 1);
@@ -639,17 +639,17 @@ window.GroupItem.prototype = Utils.exten
         item.groupItemData = {};
 
         item.addSubscriber(this, "close", function() {
           self.remove(item);
         });
 
         item.setParent(this);
 
-        if (typeof(item.setResizable) == 'function')
+        if (typeof item.setResizable == 'function')
           item.setResizable(false);
 
         if (item.tab == gBrowser.selectedTab)
           GroupItems.setActiveGroupItem(this);
       }
 
       if (!options.dontArrange) {
         this.arrange();
@@ -681,33 +681,33 @@ window.GroupItem.prototype = Utils.exten
       if (a.isAnItem) {
         item = a;
         $el = iQ(item.container);
       } else {
         $el = iQ(a);
         item = Items.item($el);
       }
 
-      if (typeof(options) == 'undefined')
+      if (typeof options == 'undefined')
         options = {};
 
       var index = this._children.indexOf(item);
       if (index != -1)
         this._children.splice(index, 1);
 
       item.setParent(null);
       item.removeClass("tabInGroupItem");
       item.removeClass("stacked");
       item.removeClass("stack-trayed");
       item.setRotation(0);
 
       item.droppable(true);
       item.removeSubscriber(this, "close");
 
-      if (typeof(item.setResizable) == 'function')
+      if (typeof item.setResizable == 'function')
         item.setResizable(true);
 
       if (!this._children.length && !this.locked.close && !this.getTitle() && !options.dontClose) {
         this.close();
       } else if (!options.dontArrange) {
         this.arrange();
       }
     } catch(e) {
@@ -795,22 +795,22 @@ window.GroupItem.prototype = Utils.exten
       var box = new Rect(this.expanded.bounds);
       box.inset(8, 8);
       Items.arrange(this._children, box, Utils.extend({}, options, {padding: 8, z: 99999}));
     } else {
       var bb = this.getContentBounds();
       var count = this._children.length;
       if (!this.shouldStack(count)) {
         var animate;
-        if (!options || typeof(options.animate) == 'undefined')
+        if (!options || typeof options.animate == 'undefined')
           animate = true;
         else
           animate = options.animate;
 
-        if (typeof(options) == 'undefined')
+        if (typeof options == 'undefined')
           options = {};
 
         this._children.forEach(function(child) {
             child.removeClass("stacked")
         });
 
         this.topChild = null;
 
@@ -871,22 +871,22 @@ window.GroupItem.prototype = Utils.exten
   // Parameters:
   //   bb - <Rect> to arrange within
   //   options - see below
   //
   // Possible "options" properties:
   //   animate - whether to animate; default: true.
   _stackArrange: function(bb, options) {
     var animate;
-    if (!options || typeof(options.animate) == 'undefined')
+    if (!options || typeof options.animate == 'undefined')
       animate = true;
     else
       animate = options.animate;
 
-    if (typeof(options) == 'undefined')
+    if (typeof options == 'undefined')
       options = {};
 
     var count = this._children.length;
     if (!count)
       return;
 
     var zIndex = this.getZ() + count + 1;
 
@@ -1137,21 +1137,21 @@ window.GroupItem.prototype = Utils.exten
         };
       })
       .mouseup(function(e) {
         if (!self._mouseDown || !self._mouseDown.location || !self._mouseDown.className)
           return;
 
         // Don't zoom in on clicks inside of the controls.
         var className = self._mouseDown.className;
-        if (className.indexOf('title-shield') != -1
-            || className.indexOf('name') != -1
-            || className.indexOf('close') != -1
-            || className.indexOf('newTabButton') != -1
-            || className.indexOf('stackExpander') != -1) {
+        if (className.indexOf('title-shield') != -1 ||
+           className.indexOf('name') != -1 ||
+           className.indexOf('close') != -1 ||
+           className.indexOf('newTabButton') != -1 ||
+           className.indexOf('stackExpander') != -1) {
           return;
         }
 
         var location = new Point(e.clientX, e.clientY);
 
         if (location.distance(self._mouseDown.location) > 1.0)
           return;
 
@@ -1401,17 +1401,16 @@ window.GroupItems = {
 
     Storage.saveGroupItemsData(gWindow, {nextID:this.nextID});
   },
 
   // ----------
   // Function: getBoundingBox
   // Given an array of DOM elements, returns a <Rect> with (roughly) the union of their locations.
   getBoundingBox: function GroupItems_getBoundingBox(els) {
-    var el, b;
     var bounds = [iQ(el).bounds() for each (el in els)];
     var left   = Math.min.apply({},[ b.left   for each (b in bounds) ]);
     var top    = Math.min.apply({},[ b.top    for each (b in bounds) ]);
     var right  = Math.max.apply({},[ b.right  for each (b in bounds) ]);
     var bottom = Math.max.apply({},[ b.bottom for each (b in bounds) ]);
 
     return new Rect(left, top, right-left, bottom-top);
   },
--- a/browser/base/content/tabview/infoitems.js
+++ b/browser/base/content/tabview/infoitems.js
@@ -56,17 +56,17 @@
 //
 // Possible options:
 //   locked - see <Item.locked>; default is {}
 //   dontPush - true if this infoItem shouldn't push away on creation; default is false
 window.InfoItem = function(bounds, options) {
   try {
     Utils.assertThrow(Utils.isRect(bounds), 'bounds');
 
-    if (typeof(options) == 'undefined')
+    if (typeof options == 'undefined')
       options = {};
 
     this._inited = false;
     this.isAnInfoItem = true;
     this.defaultSize = bounds.size();
     this.locked = (options.locked ? Utils.copy(options.locked) : {});
     this.bounds = new Rect(bounds);
     this.isDragging = false;
@@ -209,17 +209,17 @@ window.InfoItem.prototype = Utils.extend
     }
   },
 
   // ----------
   // Function: setZ
   // Set the Z order for the item's container.
   setZ: function(value) {
     try {
-      Utils.assertThrow(typeof(value) == 'number', 'value must be a number');
+      Utils.assertThrow(typeof value == 'number', 'value must be a number');
 
       this.zIndex = value;
 
       iQ(this.container).css({zIndex: value});
 
       if (this.$debug)
         this.$debug.css({zIndex: value + 1});
     } catch(e) {
@@ -245,17 +245,17 @@ window.InfoItem.prototype = Utils.extend
     }
   },
 
   // ----------
   // Function: html
   // Sets the item's container's html to the specified value.
   html: function(value) {
     try {
-      Utils.assertThrow(typeof(value) == 'string', 'value must be a string');
+      Utils.assertThrow(typeof value == 'string', 'value must be a string');
       this.$contents.html(value);
     } catch(e) {
       Utils.log(e);
     }
   }
 });
 
 })();
--- a/browser/base/content/tabview/items.js
+++ b/browser/base/content/tabview/items.js
@@ -140,25 +140,25 @@ window.Item = function() {
 window.Item.prototype = {
   // ----------
   // Function: _init
   // Initializes the object. To be called from the subclass's intialization function.
   //
   // Parameters:
   //   container - the outermost DOM element that describes this item onscreen.
   _init: function(container) {
-    Utils.assert(typeof(this.addSubscriber) == 'function' && 
-        typeof(this.removeSubscriber) == 'function' && 
-        typeof(this._sendToSubscribers) == 'function',
+    Utils.assert(typeof this.addSubscriber == 'function' && 
+        typeof this.removeSubscriber == 'function' && 
+        typeof this._sendToSubscribers == 'function',
         'Subclass must implement the Subscribable interface');
     Utils.assert(Utils.isDOMElement(container), 'container must be a DOM element');
-    Utils.assert(typeof(this.setBounds) == 'function', 'Subclass must provide setBounds');
-    Utils.assert(typeof(this.setZ) == 'function', 'Subclass must provide setZ');
-    Utils.assert(typeof(this.close) == 'function', 'Subclass must provide close');
-    Utils.assert(typeof(this.save) == 'function', 'Subclass must provide save');
+    Utils.assert(typeof this.setBounds == 'function', 'Subclass must provide setBounds');
+    Utils.assert(typeof this.setZ == 'function', 'Subclass must provide setZ');
+    Utils.assert(typeof this.close == 'function', 'Subclass must provide close');
+    Utils.assert(typeof this.save == 'function', 'Subclass must provide save');
     Utils.assert(Utils.isPoint(this.defaultSize), 'Subclass must provide defaultSize');
     Utils.assert(this.locked, 'Subclass must provide locked');
     Utils.assert(Utils.isRect(this.bounds), 'Subclass must provide bounds');
 
     this.container = container;
 
     if (this.debug) {
       this.$debug = iQ('<div>')
@@ -571,17 +571,17 @@ window.Item.prototype = {
   // ----------
   // Function: draggable
   // Enables dragging on this item. Note: not to be called multiple times on the same item!
   draggable: function() {
     try {
       Utils.assert(this.dragOptions, 'dragOptions');
 
       var cancelClasses = [];
-      if (typeof(this.dragOptions.cancelClass) == 'string')
+      if (typeof this.dragOptions.cancelClass == 'string')
         cancelClasses = this.dragOptions.cancelClass.split(' ');
 
       var self = this;
       var $container = iQ(this.container);
       var startMouse;
       var startPos;
       var startSent;
       var startEvent;
@@ -893,22 +893,22 @@ window.Items = {
   //   pretend - whether to collect and return the rectangle rather than moving the items; default: false
   //   count - overrides the item count for layout purposes; default: the actual item count
   //   padding - pixels between each item
   //
   // Returns:
   //   the list of rectangles if the pretend option is set; otherwise null
   arrange: function(items, bounds, options) {
     var animate;
-    if (!options || typeof(options.animate) == 'undefined')
+    if (!options || typeof options.animate == 'undefined')
       animate = true;
     else
       animate = options.animate;
 
-    if (typeof(options) == 'undefined')
+    if (typeof options == 'undefined')
       options = {};
 
     var rects = null;
     if (options.pretend)
       rects = [];
 
     var tabAspect = TabItems.tabHeight / TabItems.tabWidth;
     var count = options.count || (items ? items.length : 0);
@@ -947,17 +947,17 @@ window.Items = {
     var row = 0;
     var column = 0;
     var immediately;
 
     var a;
     for (a = 0; a < count; a++) {
 /*
       if (animate == 'sometimes')
-        immediately = (typeof(item.groupItemData.row) == 'undefined' || item.groupItemData.row == row);
+        immediately = (typeof item.groupItemData.row == 'undefined' || item.groupItemData.row == row);
       else
 */
         immediately = !animate;
 
       if (rects)
         rects.push(new Rect(box));
       else if (items && a < items.length) {
         var item = items[a];
--- a/browser/base/content/tabview/modules/utils.jsm
+++ b/browser/base/content/tabview/modules/utils.jsm
@@ -8,22 +8,22 @@
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is utils.js.
  *
- * The Initial Developer of the Original Code is
- * Aza Raskin <aza@mozilla.com>
+ * The Initial Developer of the Original Code is the Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2010
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
+ * Aza Raskin <aza@mozilla.com>
  * Ian Gilman <ian@iangilman.com>
  * Michael Yoshitaka Erlewine <mitcho@mitcho.com>
  *
  * This file incorporates work from:
  * jQuery JavaScript Library v1.4.2: http://code.jquery.com/jquery-1.4.2.js
  * This incorporated work is covered by the following copyright and
  * permission notice:
  * Copyright 2010, John Resig
@@ -131,20 +131,20 @@ Rect.prototype = {
   // Variable: yRange
   // Gives you a new <Range> for the vertical dimension.
   get yRange() new Range(this.top, this.bottom),
 
   // ----------
   // Function: intersects
   // Returns true if this rectangle intersects the given <Rect>.
   intersects: function(rect) {
-    return (rect.right > this.left
-        && rect.left < this.right
-        && rect.bottom > this.top
-        && rect.top < this.bottom);
+    return (rect.right > this.left &&
+           rect.left < this.right &&
+           rect.bottom > this.top &&
+           rect.top < this.bottom);
   },
 
   // ----------
   // Function: intersection
   // Returns a new <Rect> with the intersection of this rectangle and the give <Rect>,
   // or null if they don't intersect.
   intersection: function(rect) {
     var box = new Rect(Math.max(rect.left, this.left), Math.max(rect.top, this.top), 0, 0);
@@ -159,20 +159,20 @@ Rect.prototype = {
   // ----------
   // Function: contains
   // Returns a boolean denoting if the <Rect> is contained inside
   // of the bounding rect.
   //
   // Paramaters
   //  - A <Rect>
   contains: function(rect) {
-    return(rect.left > this.left
-         && rect.right < this.right
-         && rect.top > this.top
-         && rect.bottom < this.bottom)
+    return (rect.left > this.left &&
+           rect.right < this.right &&
+           rect.top > this.top &&
+           rect.bottom < this.bottom);
   },
 
   // ----------
   // Function: center
   // Returns a new <Point> with the center location of this rectangle.
   center: function() {
     return new Point(this.left + (this.width / 2), this.top + (this.height / 2));
   },
@@ -232,20 +232,20 @@ Rect.prototype = {
       this.top += b;
     }
   },
 
   // ----------
   // Function: equals
   // Returns true if this rectangle is identical to the given <Rect>.
   equals: function(rect) {
-    return (rect.left == this.left
-        && rect.top == this.top
-        && rect.width == this.width
-        && rect.height == this.height);
+    return (rect.left == this.left &&
+           rect.top == this.top &&
+           rect.width == this.width &&
+           rect.height == this.height);
   },
 
   // ----------
   // Function: union
   // Returns a new <Rect> with the union of this rectangle and the given <Rect>.
   union: function(a) {
     var newLeft = Math.min(a.left, this.left);
     var newTop = Math.min(a.top, this.top);
@@ -381,17 +381,17 @@ Subscribable.prototype = {
   // ----------
   // Function: addSubscriber
   // The given callback will be called when the Subscribable fires the given event.
   // The refObject is used to facilitate removal if necessary.
   addSubscriber: function(refObject, eventName, callback) {
     try {
       Utils.assertThrow(refObject, "refObject");
       Utils.assertThrow(typeof callback == "function", "callback must be a function");
-      Utils.assertThrow(eventName && typeof(eventName) == "string",
+      Utils.assertThrow(eventName && typeof eventName == "string",
           "eventName must be a non-empty string");
 
       if (!this.subscribers)
         this.subscribers = {};
 
       if (!this.subscribers[eventName])
         this.subscribers[eventName] = [];
 
@@ -415,17 +415,17 @@ Subscribable.prototype = {
   },
 
   // ----------
   // Function: removeSubscriber
   // Removes the callback associated with refObject for the given event.
   removeSubscriber: function(refObject, eventName) {
     try {
       Utils.assertThrow(refObject, "refObject");
-      Utils.assertThrow(eventName && typeof(eventName) == "string",
+      Utils.assertThrow(eventName && typeof eventName == "string",
           "eventName must be a non-empty string");
 
       if (!this.subscribers || !this.subscribers[eventName])
         return;
 
       this.subscribers[eventName] = this.subscribers[eventName].filter(function(element) {
         return element.refObject != refObject;
       });
@@ -434,17 +434,17 @@ Subscribable.prototype = {
     }
   },
 
   // ----------
   // Function: _sendToSubscribers
   // Internal routine. Used by the Subscribable to fire events.
   _sendToSubscribers: function(eventName, eventInfo) {
     try {
-      Utils.assertThrow(eventName && typeof(eventName) == "string",
+      Utils.assertThrow(eventName && typeof eventName == "string",
           "eventName must be a non-empty string");
 
       if (!this.subscribers || !this.subscribers[eventName])
         return;
 
       var self = this;
       var subsCopy = this.subscribers[eventName].concat();
       subsCopy.forEach(function(object) {
@@ -496,32 +496,32 @@ let Utils = {
   },
 
   // ----------
   // Function: assert
   // Prints a stack trace along with label (as a console message) if condition is false.
   assert: function Utils_assert(condition, label) {
     if (!condition) {
       let text;
-      if (typeof(label) != 'string')
+      if (typeof label != 'string')
         text = 'badly formed assert';
       else
         text = "tabview assert: " + label;
 
       this.trace(text);
     }
   },
 
   // ----------
   // Function: assertThrow
   // Throws label as an exception if condition is false.
   assertThrow: function(condition, label) {
     if (!condition) {
       let text;
-      if (typeof(label) != 'string')
+      if (typeof label != 'string')
         text = 'badly formed assert';
       else
         text = "tabview assert: " + label;
 
       // cut off the first two lines of the stack trace, because they're just this function.
       text += Error().stack.replace(/^.*?\n.*?\n/, "");
 
       throw text;
@@ -537,35 +537,35 @@ let Utils = {
       let value;
       try {
         value = obj[prop];
       } catch(e) {
         value = '[!!error retrieving property]';
       }
 
       s += prop + ': ';
-      if (typeof(value) == 'string')
+      if (typeof value == 'string')
         s += '\'' + value + '\'';
-      else if (typeof(value) == 'function')
+      else if (typeof value == 'function')
         s += 'function';
       else
         s += value;
 
       s += ', ';
     }
     return s + '}';
   },
 
   // ----------
   // Function: expandArgumentsForLog
   // Expands all of the given args (an array) into a single string.
   expandArgumentsForLog: function(args) {
     var that = this;
     return Array.map(args, function(arg) {
-      return typeof(arg) == 'object' ? that.expandObject(arg) : arg;
+      return typeof arg == 'object' ? that.expandObject(arg) : arg;
     }).join('; ');
   },
 
   // ___ Misc
 
   // ----------
   // Function: isRightClick
   // Given a DOM mouse event, returns true if it was for the right mouse button.
@@ -579,63 +579,63 @@ let Utils = {
   isDOMElement: function(object) {
     return object instanceof Ci.nsIDOMElement;
   },
 
   // ----------
   // Function: isNumber
   // Returns true if the argument is a valid number.
   isNumber: function(n) {
-    return (typeof(n) == 'number' && !isNaN(n));
+    return typeof n == 'number' && !isNaN(n);
   },
 
   // ----------
   // Function: isRect
   // Returns true if the given object (r) looks like a <Rect>.
   isRect: function(r) {
-    return (r
-        && this.isNumber(r.left)
-        && this.isNumber(r.top)
-        && this.isNumber(r.width)
-        && this.isNumber(r.height));
+    return (r &&
+           this.isNumber(r.left) &&
+           this.isNumber(r.top) &&
+           this.isNumber(r.width) &&
+           this.isNumber(r.height));
   },
 
   // ----------
   // Function: isRange
   // Returns true if the given object (r) looks like a <Range>.
   isRange: function(r) {
-    return (r
-        && this.isNumber(r.min)
-        && this.isNumber(r.max));
+    return (r &&
+           this.isNumber(r.min) &&
+           this.isNumber(r.max));
   },
 
   // ----------
   // Function: isPoint
   // Returns true if the given object (p) looks like a <Point>.
   isPoint: function(p) {
     return (p && this.isNumber(p.x) && this.isNumber(p.y));
   },
 
   // ----------
   // Function: isPlainObject
   // Check to see if an object is a plain object (created using "{}" or "new Object").
   isPlainObject: function(obj) {
     // Must be an Object.
     // Make sure that DOM nodes and window objects don't pass through, as well
-    if (!obj || Object.prototype.toString.call(obj) !== "[object Object]"
-        || obj.nodeType || obj.setInterval) {
+    if (!obj || Object.prototype.toString.call(obj) !== "[object Object]" ||
+       obj.nodeType || obj.setInterval) {
       return false;
     }
 
     // Not own constructor property must be Object
     const hasOwnProperty = Object.prototype.hasOwnProperty;
 
-    if (obj.constructor
-      && !hasOwnProperty.call(obj, "constructor")
-      && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf")) {
+    if (obj.constructor &&
+       !hasOwnProperty.call(obj, "constructor") &&
+       !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf")) {
       return false;
     }
 
     // Own properties are enumerated firstly, so to speed up,
     // if last one is own, then all properties are own.
 
     var key;
     for (key in obj) {}
@@ -652,17 +652,17 @@ let Utils = {
     return true;
   },
 
   // ----------
   // Function: copy
   // Returns a copy of the argument. Note that this is a shallow copy; if the argument
   // has properties that are themselves objects, those properties will be copied by reference.
   copy: function(value) {
-    if (value && typeof(value) == 'object') {
+    if (value && typeof value == 'object') {
       if (Array.isArray(value))
         return this.extend([], value);
       return this.extend({}, value);
     }
     return value;
   },
 
   // ----------
@@ -672,45 +672,46 @@ let Utils = {
     Array.forEach(second, function(el) Array.push(first, el));
     return first;
   },
 
   // ----------
   // Function: extend
   // Pass several objects in and it will combine them all into the first object and return it.
   extend: function() {
+
     // copy reference to target object
-    var target = arguments[0] || {}, i = 1, length = arguments.length, options, name, src, copy;
-
+    let target = arguments[0] || {};
     // Deep copy is not supported
     if (typeof target === "boolean") {
       this.assert(false, "The first argument of extend cannot be a boolean." +
           "Deep copy is not supported.");
       return target;
     }
 
     // Back when this was in iQ + iQ.fn, so you could extend iQ objects with it.
     // This is no longer supported.
+    let length = arguments.length;
     if (length === 1) {
       this.assert(false, "Extending the iQ prototype using extend is not supported.");
       return target;
     }
 
     // Handle case when target is a string or something
     if (typeof target != "object" && typeof target != "function") {
       target = {};
     }
 
-    for (; i < length; i++) {
+    for (let i = 1; i < length; i++) {
       // Only deal with non-null/undefined values
-      if ((options = arguments[i]) != null) {
+      let options = arguments[i];
+      if (options != null) {
         // Extend the base object
-        for (name in options) {
-          src = target[name];
-          copy = options[name];
+        for (let name in options) {
+          let copy = options[name];
 
           // Prevent never-ending loop
           if (target === copy)
             continue;
 
           if (copy !== undefined)
             target[name] = copy;
         }
--- a/browser/base/content/tabview/tabitems.js
+++ b/browser/base/content/tabview/tabitems.js
@@ -888,19 +888,19 @@ window.TabItems = {
   // ----------
   // Function: resumePainting
   // Undoes a call to <pausePainting>. For instance, if you called
   // pausePainting three times in a row, you'll need to call resumePainting
   // three times before TabItems will start updating thumbnails again.
   resumePainting: function() {
     this.paintingPaused--;
 
-    if (!this.isPaintingPaused()
-        && this._tabsWaitingForUpdate.length
-        && !this._heartbeatOn) {
+    if (!this.isPaintingPaused() &&
+        this._tabsWaitingForUpdate.length &&
+        !this._heartbeatOn) {
       this._heartbeatOn = true;
       this.heartbeat();
     }
   },
 
   // ----------
   // Function: isPaintingPaused
   // Returns a boolean indicating whether painting
--- a/browser/base/content/tabview/trench.js
+++ b/browser/base/content/tabview/trench.js
@@ -373,18 +373,19 @@ Trench.prototype = {
   // Computes whether the given "rule" (a line segment, essentially), given by the position and
   // range arguments, overlaps with the current trench. Note that this function assumes that
   // the rule and the trench are in the same direction: both horizontal, or both vertical.
   //
   // Parameters:
   //   position - (integer) a position in px
   //   range - (<Range>) the rule's range
   ruleOverlaps: function Trench_ruleOverlaps(position, range) {
-    return (this.position - this.radius < position && position < this.position + this.radius
-            && this.activeRange.contains(range));
+    return (this.position - this.radius < position &&
+           position < this.position + this.radius &&
+           this.activeRange.contains(range));
   },
 
   //----------
   // Function: adjustRangeIfIntercept
   // Computes whether the given boundary (given as a position and its active range), perpendicular
   // to the trench, intercepts the trench or not. If it does, it returns an adjusted <Range> for
   // the trench. If not, it returns false.
   //
@@ -548,18 +549,19 @@ var Trenches = {
   // Activate all <Trench>es other than those projected by the current element.
   //
   // Parameters:
   //   element - (DOMElement) the DOM element of the Item being dragged or resized.
   activateOthersTrenches: function Trenches_activateOthersTrenches(element) {
     this.trenches.forEach(function(t) {
       if (t.el === element)
         return;
-      if (t.parentItem && (t.parentItem.isAFauxItem || t.parentItem.isDragging
-                                                    || t.parentItem.isDropTarget))
+      if (t.parentItem && (t.parentItem.isAFauxItem ||
+         t.parentItem.isDragging ||
+         t.parentItem.isDropTarget))
         return;
       t.active = true;
       t.calculateActiveRange();
       t.show(); // debug
     });
   },
 
   // ---------
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -724,18 +724,18 @@ var UIManager = {
       if (startPos.x == box.left)
         stationaryCorner += "left";
       else
         stationaryCorner += "right";
 
       dragOutInfo.snap(stationaryCorner, false, false); // null for ui, which we don't use anyway.
 
       box = item.getBounds();
-      if (box.width > minMinSize && box.height > minMinSize
-          && (box.width > minSize || box.height > minSize))
+      if (box.width > minMinSize && box.height > minMinSize &&
+         (box.width > minSize || box.height > minSize))
         item.setOpacity(1);
       else
         item.setOpacity(0.7);
 
       e.preventDefault();
     }
 
     function collapse() {
@@ -785,17 +785,17 @@ var UIManager = {
 
   // ----------
   // Function: _resize
   // Update the TabView UI contents in response to a window size change.
   // Won't do anything if it doesn't deem the resize necessary.
   // Parameters:
   //   force - true to update even when "unnecessary"; default false
   _resize: function(force) {
-    if (typeof(force) == "undefined")
+    if (typeof force == "undefined")
       force = false;
 
     // If TabView isn't focused and is not showing, don't perform a resize.
     // This resize really slows things down.
     if (!force && !this._isTabViewVisible())
       return;
 
     var oldPageBounds = new Rect(this._pageBounds);