Merge mozilla-central into services-central
authorGregory Szorc <gps@mozilla.com>
Mon, 25 Jun 2012 13:40:04 -0700
changeset 102970 6cb0f670716839a09bbe8f925424dc3be1f48dae
parent 102969 4af0c62e30a7ead77c1e41bd5043396211a3d7fa (current diff)
parent 102847 5c07a681371d46d1bc86af397b6d712fdd870e2b (diff)
child 102971 7b97f42c3a591c2e50aff2d1360dfee63534db1d
push id191
push userlsblakk@mozilla.com
push dateFri, 05 Oct 2012 17:12:53 +0000
treeherdermozilla-release@ddb22ac6c03b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone16.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
Merge mozilla-central into services-central
browser/installer/package-manifest.in
browser/themes/gnomestripe/identity-icons-https-mixed.png
browser/themes/pinstripe/identity-icons-https-mixed.png
browser/themes/winstripe/identity-icons-https-mixed.png
config/autoconf.mk.in
configure.in
content/base/src/nsGenericElement.cpp
js/xpconnect/src/XPCThreadContext.cpp
mobile/android/themes/core/images/reader-dropdown-arrow.png
testing/xpcshell/xpcshell.ini
--- a/accessible/public/nsIAccessibilityService.h
+++ b/accessible/public/nsIAccessibilityService.h
@@ -44,43 +44,16 @@ public:
    /**
    * Adds/remove ATK root accessible for gtk+ native window to/from children
    * of the application accessible.
    */
   virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
   virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible) = 0;
 
   /**
-   * Notification used to update the accessible tree when new content is
-   * inserted.
-   */
-  virtual void ContentRangeInserted(nsIPresShell* aPresShell,
-                                    nsIContent* aContainer,
-                                    nsIContent* aStartChild,
-                                    nsIContent* aEndChild) = 0;
-
-  /**
-   * Notification used to update the accessible tree when content is removed.
-   */
-  virtual void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
-                              nsIContent* aChild) = 0;
-
-  /**
-   * Notify accessibility that anchor jump has been accomplished to the given
-   * target. Used by layout.
-   */
-  virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget) = 0;
-
-  /**
-   * Notify the accessibility service that the given presshell is
-   * being destroyed.
-   */
-  virtual void PresShellDestroyed(nsIPresShell *aPresShell) = 0;
-
-  /**
    * Fire accessible event of the given type for the given target.
    *
    * @param aEvent   [in] accessible event type
    * @param aTarget  [in] target of accessible event
    */
   virtual void FireAccessibleEvent(PRUint32 aEvent, Accessible* aTarget) = 0;
 };
 
--- a/accessible/src/base/Logging.cpp
+++ b/accessible/src/base/Logging.cpp
@@ -275,16 +275,19 @@ LogShellLoadType(nsIDocShell* aDocShell)
       printf("stop content; ");
       break;
     case LOAD_STOP_CONTENT_AND_REPLACE:
       printf("stop content and replace; ");
       break;
     case LOAD_PUSHSTATE:
       printf("load pushstate; ");
       break;
+    case LOAD_REPLACE_BYPASS_CACHE:
+      printf("replace bypass cache; ");
+      break;
     case LOAD_ERROR_PAGE:
       printf("error page;");
       break;
     default:
       printf("unknown");
   }
 }
 
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -117,26 +117,35 @@ public:
     CreateTextLeafAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<Accessible>
     CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<Accessible>
     CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<Accessible>
     CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
 
+  /**
+   * Adds/remove ATK root accessible for gtk+ native window to/from children
+   * of the application accessible.
+   */
   virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible);
   virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible);
 
-  virtual void ContentRangeInserted(nsIPresShell* aPresShell,
-                                    nsIContent* aContainer,
-                                    nsIContent* aStartChild,
-                                    nsIContent* aEndChild);
+  /**
+   * Notification used to update the accessible tree when new content is
+   * inserted.
+   */
+  void ContentRangeInserted(nsIPresShell* aPresShell, nsIContent* aContainer,
+                            nsIContent* aStartChild, nsIContent* aEndChild);
 
-  virtual void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
-                              nsIContent* aChild);
+  /**
+   * Notification used to update the accessible tree when content is removed.
+   */
+  void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
+                      nsIContent* aChild);
 
   virtual void UpdateText(nsIPresShell* aPresShell, nsIContent* aContent);
 
   /**
    * Update XUL:tree accessible tree when treeview is changed.
    */
   void TreeViewChanged(nsIPresShell* aPresShell, nsIContent* aContent,
                        nsITreeView* aView);
@@ -148,19 +157,27 @@ public:
                                 nsIContent* aHTMLListItemContent,
                                 bool aHasBullet);
 
   /**
    * Update the image map.
    */
   void UpdateImageMap(nsImageFrame* aImageFrame);
 
-  virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget);
+  /**
+   * Notify accessibility that anchor jump has been accomplished to the given
+   * target. Used by layout.
+   */
+  void NotifyOfAnchorJumpTo(nsIContent *aTarget);
 
-  virtual void PresShellDestroyed(nsIPresShell* aPresShell);
+  /**
+   * Notify the accessibility service that the given presshell is
+   * being destroyed.
+   */
+  void PresShellDestroyed(nsIPresShell* aPresShell);
 
   /**
    * Notify that presshell is activated.
    */
   virtual void PresShellActivated(nsIPresShell* aPresShell);
 
   /**
    * Recreate an accessible for the given content node in the presshell.
--- a/accessible/src/generic/ARIAGridAccessible.cpp
+++ b/accessible/src/generic/ARIAGridAccessible.cpp
@@ -85,91 +85,16 @@ ARIAGridAccessible::CellAt(PRUint32 aRow
 { 
   Accessible* row = GetRowAt(aRowIndex);
   if (!row)
     return nsnull;
 
   return GetCellInRowAt(row, aColumnIndex);
 }
 
-NS_IMETHODIMP
-ARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
-                                     PRInt32* aColumnIndex)
-{
-  NS_ENSURE_ARG_POINTER(aColumnIndex);
-  *aColumnIndex = -1;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  NS_ENSURE_ARG(aCellIndex >= 0);
-
-  PRInt32 rowCount = 0;
-  GetRowCount(&rowCount);
-
-  PRInt32 colsCount = 0;
-  GetColumnCount(&colsCount);
-
-  NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
-
-  *aColumnIndex = aCellIndex % colsCount;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ARIAGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex)
-{
-  NS_ENSURE_ARG_POINTER(aRowIndex);
-  *aRowIndex = -1;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  NS_ENSURE_ARG(aCellIndex >= 0);
-
-  PRInt32 rowCount = 0;
-  GetRowCount(&rowCount);
-
-  PRInt32 colsCount = 0;
-  GetColumnCount(&colsCount);
-
-  NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
-
-  *aRowIndex = aCellIndex / colsCount;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ARIAGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
-                                             PRInt32* aRowIndex,
-                                             PRInt32* aColumnIndex)
-{
-  NS_ENSURE_ARG_POINTER(aRowIndex);
-  *aRowIndex = -1;
-  NS_ENSURE_ARG_POINTER(aColumnIndex);
-  *aColumnIndex = -1;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  NS_ENSURE_ARG(aCellIndex >= 0);
-
-  PRInt32 rowCount = 0;
-  GetRowCount(&rowCount);
-
-  PRInt32 colsCount = 0;
-  GetColumnCount(&colsCount);
-
-  NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
-
-  *aColumnIndex = aCellIndex % colsCount;
-  *aRowIndex = aCellIndex / colsCount;
-  return NS_OK;
-}
-
 bool
 ARIAGridAccessible::IsColSelected(PRUint32 aColIdx)
 {
   AccIterator rowIter(this, filters::GetRow);
   Accessible* row = rowIter.Next();
   if (!row)
     return false;
 
@@ -243,19 +168,45 @@ ARIAGridAccessible::SelectedCellCount()
   }
 
   return count;
 }
 
 PRUint32
 ARIAGridAccessible::SelectedColCount()
 {
-  PRUint32 colCount = 0;
-  GetSelectedColumnsArray(&colCount);
-  return colCount;
+  PRUint32 colCount = ColCount();
+  if (!colCount)
+    return 0;
+
+  AccIterator rowIter(this, filters::GetRow);
+  Accessible* row = rowIter.Next();
+  if (!row)
+    return 0;
+
+  nsTArray<bool> isColSelArray(colCount);
+  isColSelArray.AppendElements(colCount);
+  memset(isColSelArray.Elements(), true, colCount * sizeof(bool));
+
+  PRUint32 selColCount = colCount;
+  do {
+    if (nsAccUtils::IsARIASelected(row))
+      continue;
+
+    AccIterator cellIter(row, filters::GetCell);
+    Accessible* cell = nsnull;
+    for (PRUint32 colIdx = 0;
+         (cell = cellIter.Next()) && colIdx < colCount; colIdx++)
+      if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
+        isColSelArray[colIdx] = false;
+        selColCount--;
+      }
+  } while ((row = rowIter.Next()));
+
+  return selColCount;
 }
 
 PRUint32
 ARIAGridAccessible::SelectedRowCount()
 {
   PRUint32 count = 0;
 
   AccIterator rowIter(this, filters::GetRow);
@@ -320,102 +271,82 @@ ARIAGridAccessible::GetSelectedCells(nsI
         selCells->AppendElement(static_cast<nsIAccessible *>(cell), false);
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-ARIAGridAccessible::GetSelectedCellIndices(PRUint32* aCellsCount,
-                                           PRInt32** aCells)
+void
+ARIAGridAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
 {
-  NS_ENSURE_ARG_POINTER(aCellsCount);
-  *aCellsCount = 0;
-  NS_ENSURE_ARG_POINTER(aCells);
-  *aCells = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  PRInt32 rowCount = 0;
-  GetRowCount(&rowCount);
-
-  PRInt32 colCount = 0;
-  GetColumnCount(&colCount);
-
-  nsTArray<PRInt32> selCells(rowCount * colCount);
+  PRUint32 rowCount = RowCount(), colCount = ColCount();
 
   AccIterator rowIter(this, filters::GetRow);
-
   Accessible* row = nsnull;
-  for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
+  for (PRUint32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
     if (nsAccUtils::IsARIASelected(row)) {
-      for (PRInt32 colIdx = 0; colIdx < colCount; colIdx++)
-        selCells.AppendElement(rowIdx * colCount + colIdx);
+      for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
+        aCells->AppendElement(rowIdx * colCount + colIdx);
 
       continue;
     }
 
     AccIterator cellIter(row, filters::GetCell);
     Accessible* cell = nsnull;
-
-    for (PRInt32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
+    for (PRUint32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
       if (nsAccUtils::IsARIASelected(cell))
-        selCells.AppendElement(rowIdx * colCount + colIdx);
+        aCells->AppendElement(rowIdx * colCount + colIdx);
     }
   }
-
-  PRUint32 selCellsCount = selCells.Length();
-  if (!selCellsCount)
-    return NS_OK;
-
-  *aCells = static_cast<PRInt32*>(
-    nsMemory::Clone(selCells.Elements(), selCellsCount * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(*aCells, NS_ERROR_OUT_OF_MEMORY);
-
-  *aCellsCount = selCellsCount;
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-ARIAGridAccessible::GetSelectedColumnIndices(PRUint32* aColumnCount,
-                                             PRInt32** aColumns)
+void
+ARIAGridAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
 {
-  NS_ENSURE_ARG_POINTER(aColumns);
+  PRUint32 colCount = ColCount();
+  if (!colCount)
+    return;
+
+  AccIterator rowIter(this, filters::GetRow);
+  Accessible* row = rowIter.Next();
+  if (!row)
+    return;
+
+  nsTArray<bool> isColSelArray(colCount);
+  isColSelArray.AppendElements(colCount);
+  memset(isColSelArray.Elements(), true, colCount * sizeof(bool));
 
-  return GetSelectedColumnsArray(aColumnCount, aColumns);
+  do {
+    if (nsAccUtils::IsARIASelected(row))
+      continue;
+
+    AccIterator cellIter(row, filters::GetCell);
+    Accessible* cell = nsnull;
+    for (PRUint32 colIdx = 0;
+         (cell = cellIter.Next()) && colIdx < colCount; colIdx++)
+      if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
+        isColSelArray[colIdx] = false;
+      }
+  } while ((row = rowIter.Next()));
+
+  for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
+    if (isColSelArray[colIdx])
+      aCols->AppendElement(colIdx);
 }
 
-NS_IMETHODIMP
-ARIAGridAccessible::GetSelectedRowIndices(PRUint32* aRowCount,
-                                          PRInt32** aRows)
+void
+ARIAGridAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
 {
-  NS_ENSURE_ARG_POINTER(aRowCount);
-  *aRowCount = 0;
-  NS_ENSURE_ARG_POINTER(aRows);
-  *aRows = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  PRInt32 rowCount = 0;
-  GetRowCount(&rowCount);
-  if (!rowCount)
-    return NS_OK;
-
-  nsTArray<PRInt32> selRows(rowCount);
-
   AccIterator rowIter(this, filters::GetRow);
-
   Accessible* row = nsnull;
-  for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
+  for (PRUint32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
     if (nsAccUtils::IsARIASelected(row)) {
-      selRows.AppendElement(rowIdx);
+      aRows->AppendElement(rowIdx);
       continue;
     }
 
     AccIterator cellIter(row, filters::GetCell);
     Accessible* cell = cellIter.Next();
     if (!cell)
       continue;
 
@@ -423,29 +354,18 @@ ARIAGridAccessible::GetSelectedRowIndice
     do {
       if (!nsAccUtils::IsARIASelected(cell)) {
         isRowSelected = false;
         break;
       }
     } while ((cell = cellIter.Next()));
 
     if (isRowSelected)
-      selRows.AppendElement(rowIdx);
+      aRows->AppendElement(rowIdx);
   }
-
-  PRUint32 selrowCount = selRows.Length();
-  if (!selrowCount)
-    return NS_OK;
-
-  *aRows = static_cast<PRInt32*>(
-    nsMemory::Clone(selRows.Elements(), selrowCount * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(*aRows, NS_ERROR_OUT_OF_MEMORY);
-
-  *aRowCount = selrowCount;
-  return NS_OK;
 }
 
 void
 ARIAGridAccessible::SelectRow(PRUint32 aRowIdx)
 {
   AccIterator rowIter(this, filters::GetRow);
 
   Accessible* row = nsnull;
@@ -610,84 +530,16 @@ ARIAGridAccessible::SetARIASelected(Acce
         }
       }
     }
   }
 
   return NS_OK;
 }
 
-nsresult
-ARIAGridAccessible::GetSelectedColumnsArray(PRUint32* aColumnCount,
-                                            PRInt32** aColumns)
-{
-  NS_ENSURE_ARG_POINTER(aColumnCount);
-  *aColumnCount = 0;
-  if (aColumns)
-    *aColumns = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  AccIterator rowIter(this, filters::GetRow);
-  Accessible* row = rowIter.Next();
-  if (!row)
-    return NS_OK;
-
-  PRInt32 colCount = 0;
-  GetColumnCount(&colCount);
-  if (!colCount)
-    return NS_OK;
-
-  PRInt32 selColCount = colCount;
-
-  nsTArray<bool> isColSelArray(selColCount);
-  isColSelArray.AppendElements(selColCount);
-  for (PRInt32 i = 0; i < selColCount; i++)
-    isColSelArray[i] = true;
-
-  do {
-    if (nsAccUtils::IsARIASelected(row))
-      continue;
-
-    PRInt32 colIdx = 0;
-
-    AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
-    for (colIdx = 0; (cell = cellIter.Next()); colIdx++) {
-      if (isColSelArray.SafeElementAt(colIdx, false) &&
-          !nsAccUtils::IsARIASelected(cell)) {
-        isColSelArray[colIdx] = false;
-        selColCount--;
-      }
-    }
-  } while ((row = rowIter.Next()));
-
-  if (!selColCount)
-    return NS_OK;
-
-  if (!aColumns) {
-    *aColumnCount = selColCount;
-    return NS_OK;
-  }
-
-  *aColumns = static_cast<PRInt32*>(
-    nsMemory::Alloc(selColCount * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(*aColumns, NS_ERROR_OUT_OF_MEMORY);
-
-  *aColumnCount = selColCount;
-  for (PRInt32 colIdx = 0, idx = 0; colIdx < colCount; colIdx++) {
-    if (isColSelArray[colIdx])
-      (*aColumns)[idx++] = colIdx;
-  }
-
-  return NS_OK;
-}
-
-
 ////////////////////////////////////////////////////////////////////////////////
 // ARIAGridCellAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor
 
--- a/accessible/src/generic/ARIAGridAccessible.h
+++ b/accessible/src/generic/ARIAGridAccessible.h
@@ -43,16 +43,19 @@ public:
   virtual PRUint32 RowCount();
   virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
   virtual bool IsColSelected(PRUint32 aColIdx);
   virtual bool IsRowSelected(PRUint32 aRowIdx);
   virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
   virtual PRUint32 SelectedCellCount();
   virtual PRUint32 SelectedColCount();
   virtual PRUint32 SelectedRowCount();
+  virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
+  virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
+  virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
   virtual void SelectCol(PRUint32 aColIdx);
   virtual void SelectRow(PRUint32 aRowIdx);
   virtual void UnselectCol(PRUint32 aColIdx);
   virtual void UnselectRow(PRUint32 aRowIdx);
 
 protected:
   /**
    * Return true if the given row index is valid.
@@ -79,22 +82,16 @@ protected:
    *
    * @param  aAccessible  [in] accessible
    * @param  aIsSelected  [in] new value of aria-selected attribute
    * @param  aNotify      [in, optional] specifies if DOM should be notified
    *                       about attribute change (used internally).
    */
   nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
                            bool aNotify = true);
-
-  /**
-   * Helper method for GetSelectedColumnCount and GetSelectedColumns.
-   */
-  nsresult GetSelectedColumnsArray(PRUint32 *acolumnCount,
-                                   PRInt32 **aColumns = nsnull);
 };
 
 
 /**
  * Accessible for ARIA gridcell and rowheader/columnheader.
  */
 class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
                                public nsIAccessibleTableCell
--- a/accessible/src/generic/TableAccessible.h
+++ b/accessible/src/generic/TableAccessible.h
@@ -52,28 +52,35 @@ public:
    * Return the index of the cell at the given row and column.
    */
   virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx)
     { return ColCount() * aRowIdx + aColIdx; }
 
   /**
    * Return the column index of the cell with the given index.
    */
-  virtual PRInt32 ColIndexAt(PRUint32 aCellIdx) { return -1; }
+  virtual PRInt32 ColIndexAt(PRUint32 aCellIdx) 
+    { return aCellIdx % ColCount(); }
 
   /**
    * Return the row index of the cell with the given index.
    */
-  virtual PRInt32 RowIndexAt(PRUint32 aCellIdx) { return -1; }
+  virtual PRInt32 RowIndexAt(PRUint32 aCellIdx) 
+    { return aCellIdx / ColCount(); }
 
   /**
    * Get the row and column indices for the cell at the given index.
    */
   virtual void RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
-                                  PRInt32* aColIdx) {}
+                                  PRInt32* aColIdx) 
+    { 
+      PRUint32 colCount = ColCount();
+      *aRowIdx = aCellIdx / colCount;
+      *aColIdx = aCellIdx % colCount;
+    }
 
   /**
    * Return the number of columns occupied by the cell at the given row and
    * column indices.
    */
   virtual PRUint32 ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return 1; }
 
   /**
@@ -125,24 +132,29 @@ public:
   virtual PRUint32 SelectedRowCount() { return 0; }
 
   /**
    * Get the set of selected cells.
    */
   virtual void SelectedCells(nsTArray<Accessible*>* aCells) {}
 
   /**
+   * Get the set of selected cell indices.
+   */
+  virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells) = 0;
+
+  /**
    * Get the set of selected column indices.
    */
-  virtual void SelectedColIndices(nsTArray<PRUint32>* aCols) {}
+  virtual void SelectedColIndices(nsTArray<PRUint32>* aCols) = 0;
 
   /**
    * Get the set of selected row indices.
    */
-  virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows) {}
+  virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows) = 0;
 
   /**
    * Select the given column unselecting any other selected columns.
    */
   virtual void SelectCol(PRUint32 aColIdx) {}
 
   /**
    * Select the given row unselecting all other previously selected rows.
--- a/accessible/src/html/HTMLTableAccessible.cpp
+++ b/accessible/src/html/HTMLTableAccessible.cpp
@@ -655,168 +655,62 @@ HTMLTableAccessible::GetSelectedCells(ns
       }
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-HTMLTableAccessible::GetSelectedCellIndices(PRUint32* aNumCells,
-                                            PRInt32** aCells)
+void
+HTMLTableAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
 {
-  NS_ENSURE_ARG_POINTER(aNumCells);
-  *aNumCells = 0;
-  NS_ENSURE_ARG_POINTER(aCells);
-  *aCells = nsnull;
+  nsITableLayout *tableLayout = GetTableLayout();
+  if (!tableLayout)
+    return;
 
-  PRInt32 rowCount = 0;
-  nsresult rv = GetRowCount(&rowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32 columnCount = 0;
-  rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsITableLayout *tableLayout = GetTableLayout();
-  NS_ENSURE_STATE(tableLayout);
+  PRUint32 rowCount = RowCount(), colCount = ColCount();
 
   nsCOMPtr<nsIDOMElement> domElement;
   PRInt32 startRowIndex = 0, startColIndex = 0,
     rowSpan, colSpan, actualRowSpan, actualColSpan;
   bool isSelected = false;
 
-  PRInt32 cellsCount = columnCount * rowCount;
-  nsAutoArrayPtr<bool> states(new bool[cellsCount]);
-  NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
+  for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
+    for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++) {
+      nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
+                                               *getter_AddRefs(domElement),
+                                               startRowIndex, startColIndex,
+                                               rowSpan, colSpan,
+                                               actualRowSpan, actualColSpan,
+                                               isSelected);
 
-  PRInt32 rowIndex, index;
-  for (rowIndex = 0, index = 0; rowIndex < rowCount; rowIndex++) {
-    PRInt32 columnIndex;
-    for (columnIndex = 0; columnIndex < columnCount; columnIndex++, index++) {
-      rv = tableLayout->GetCellDataAt(rowIndex, columnIndex,
-                                      *getter_AddRefs(domElement),
-                                      startRowIndex, startColIndex,
-                                      rowSpan, colSpan,
-                                      actualRowSpan, actualColSpan,
-                                      isSelected);
-
-      if (NS_SUCCEEDED(rv) && startRowIndex == rowIndex &&
-          startColIndex == columnIndex && isSelected) {
-        states[index] = true;
-        (*aNumCells)++;
-      } else {
-        states[index] = false;
-      }
+      if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx &&
+          startColIndex == colIdx && isSelected)
+        aCells->AppendElement(CellIndexAt(rowIdx, colIdx));
     }
   }
-
-  PRInt32 *cellsArray =
-    static_cast<PRInt32*>(nsMemory::Alloc((*aNumCells) * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(cellsArray, NS_ERROR_OUT_OF_MEMORY);
-
-  PRInt32 curr = 0;
-  for (rowIndex = 0, index = 0; rowIndex < rowCount; rowIndex++) {
-    PRInt32 columnIndex;
-    for (columnIndex = 0; columnIndex < columnCount; columnIndex++, index++) {
-      if (states[index]) {
-        PRInt32 cellIndex = -1;
-        GetCellIndexAt(rowIndex, columnIndex, &cellIndex);
-        cellsArray[curr++] = cellIndex;
-      }
-    }
-  }
-
-  *aCells = cellsArray;
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-HTMLTableAccessible::GetSelectedColumnIndices(PRUint32* aNumColumns,
-                                              PRInt32** aColumns)
+void
+HTMLTableAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
 {
-  nsresult rv = NS_OK;
-
-  PRInt32 columnCount;
-  rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool *states = new bool[columnCount];
-  NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
-
-  *aNumColumns = 0;
-  PRInt32 index;
-  for (index = 0; index < columnCount; index++) {
-    rv = IsColumnSelected(index, &states[index]);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (states[index]) {
-      (*aNumColumns)++;
-    }
-  }
-
-  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
-  if (!outArray) {
-    delete []states;
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  PRInt32 curr = 0;
-  for (index = 0; index < columnCount; index++) {
-    if (states[index]) {
-      outArray[curr++] = index;
-    }
-  }
-
-  delete []states;
-  *aColumns = outArray;
-  return rv;
+  PRUint32 colCount = ColCount();
+  for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
+    if (IsColSelected(colIdx))
+      aCols->AppendElement(colIdx);
 }
 
-NS_IMETHODIMP
-HTMLTableAccessible::GetSelectedRowIndices(PRUint32* aNumRows,
-                                           PRInt32** aRows)
+void
+HTMLTableAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
 {
-  nsresult rv = NS_OK;
-
-  PRInt32 rowCount;
-  rv = GetRowCount(&rowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool *states = new bool[rowCount];
-  NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
-
-  *aNumRows = 0;
-  PRInt32 index;
-  for (index = 0; index < rowCount; index++) {
-    rv = IsRowSelected(index, &states[index]);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (states[index]) {
-      (*aNumRows)++;
-    }
-  }
-
-  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
-  if (!outArray) {
-    delete []states;
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  PRInt32 curr = 0;
-  for (index = 0; index < rowCount; index++) {
-    if (states[index]) {
-      outArray[curr++] = index;
-    }
-  }
-
-  delete []states;
-  *aRows = outArray;
-  return rv;
+  PRUint32 rowCount = RowCount();
+  for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
+    if (IsRowSelected(rowIdx))
+      aRows->AppendElement(rowIdx);
 }
 
 Accessible*
 HTMLTableAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
 { 
   nsCOMPtr<nsIDOMElement> cellElement;
   GetCellAt(aRowIndex, aColumnIndex, *getter_AddRefs(cellElement));
   if (!cellElement)
@@ -838,70 +732,48 @@ HTMLTableAccessible::CellIndexAt(PRUint3
 {
   nsITableLayout* tableLayout = GetTableLayout();
 
   PRInt32 index = -1;
   tableLayout->GetIndexByRowAndColumn(aRowIdx, aColIdx, &index);
   return index;
 }
 
-NS_IMETHODIMP
-HTMLTableAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32* aColumn)
+PRInt32
+HTMLTableAccessible::ColIndexAt(PRUint32 aCellIdx)
 {
-  NS_ENSURE_ARG_POINTER(aColumn);
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
+  nsITableLayout* tableLayout = GetTableLayout();
+  if (!tableLayout) 
+    return -1;
 
-  nsITableLayout *tableLayout = GetTableLayout();
-  NS_ENSURE_STATE(tableLayout);
-
-  PRInt32 row;
-  nsresult rv = tableLayout->GetRowAndColumnByIndex(aIndex, &row, aColumn);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return (row == -1 || *aColumn == -1) ? NS_ERROR_INVALID_ARG : NS_OK;
+  PRInt32 rowIdx = -1, colIdx = -1;
+  tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
+  return colIdx;
 }
 
-NS_IMETHODIMP
-HTMLTableAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32* aRow)
+PRInt32
+HTMLTableAccessible::RowIndexAt(PRUint32 aCellIdx)
 {
-  NS_ENSURE_ARG_POINTER(aRow);
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
+  nsITableLayout* tableLayout = GetTableLayout();
+  if (!tableLayout) 
+    return -1;
 
-  nsITableLayout *tableLayout = GetTableLayout();
-  NS_ENSURE_STATE(tableLayout);
-
-  PRInt32 column;
-  nsresult rv = tableLayout->GetRowAndColumnByIndex(aIndex, aRow, &column);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return (*aRow == -1 || column == -1) ? NS_ERROR_INVALID_ARG : NS_OK;
+  PRInt32 rowIdx = -1, colIdx = -1;
+  tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
+  return rowIdx;
 }
 
-NS_IMETHODIMP
-HTMLTableAccessible::GetRowAndColumnIndicesAt(PRInt32 aIndex,
-                                              PRInt32* aRowIdx,
-                                              PRInt32* aColumnIdx)
+void
+HTMLTableAccessible::RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
+                                        PRInt32* aColIdx)
 {
-  NS_ENSURE_ARG_POINTER(aRowIdx);
-  *aRowIdx = -1;
-  NS_ENSURE_ARG_POINTER(aColumnIdx);
-  *aColumnIdx = -1;
+  nsITableLayout* tableLayout = GetTableLayout();
 
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  nsITableLayout* tableLayout = GetTableLayout();
   if (tableLayout)
-    tableLayout->GetRowAndColumnByIndex(aIndex, aRowIdx, aColumnIdx);
-
-  return (*aRowIdx == -1 || *aColumnIdx == -1) ? NS_ERROR_INVALID_ARG : NS_OK;
+    tableLayout->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
 }
 
 PRUint32
 HTMLTableAccessible::ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx)
 {
   nsITableLayout* tableLayout = GetTableLayout();
   if (!tableLayout)
     return 0;
--- a/accessible/src/html/HTMLTableAccessible.h
+++ b/accessible/src/html/HTMLTableAccessible.h
@@ -99,24 +99,31 @@ public:
 
   // TableAccessible
   virtual Accessible* Caption();
   virtual void Summary(nsString& aSummary);
   virtual PRUint32 ColCount();
   virtual PRUint32 RowCount();
   virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
   virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx);
+  virtual PRInt32 ColIndexAt(PRUint32 aCellIdx);
+  virtual PRInt32 RowIndexAt(PRUint32 aCellIdx);
+  virtual void RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
+                                  PRInt32* aColIdx);
   virtual PRUint32 ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx);
   virtual PRUint32 RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx);
   virtual bool IsColSelected(PRUint32 aColIdx);
   virtual bool IsRowSelected(PRUint32 aRowIdx);
   virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
   virtual PRUint32 SelectedCellCount();
   virtual PRUint32 SelectedColCount();
   virtual PRUint32 SelectedRowCount();
+  virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
+  virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
+  virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
   virtual void SelectCol(PRUint32 aColIdx);
   virtual void SelectRow(PRUint32 aRowIdx);
   virtual void UnselectCol(PRUint32 aColIdx);
   virtual void UnselectRow(PRUint32 aRowIdx);
   virtual bool IsProbablyLayoutTable();
 
   // nsAccessNode
   virtual void Shutdown();
--- a/accessible/src/xpcom/xpcAccessibleTable.cpp
+++ b/accessible/src/xpcom/xpcAccessibleTable.cpp
@@ -4,16 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "xpcAccessibleTable.h"
 
 #include "Accessible.h"
 #include "TableAccessible.h"
 
+static const PRUint32 XPC_TABLE_DEFAULT_SIZE = 40;
+
 nsresult
 xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
 {
   NS_ENSURE_ARG_POINTER(aCaption);
   *aCaption = nsnull;
   if (!mTable)
     return NS_ERROR_FAILURE;
 
@@ -237,16 +239,148 @@ xpcAccessibleTable::GetSelectedRowCount(
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   *aSelectedRowCount = mTable->SelectedRowCount();
   return NS_OK;
 }
 
 nsresult
+xpcAccessibleTable::GetSelectedCellIndices(PRUint32* aCellsArraySize,
+                                           PRInt32** aCellsArray)
+{
+  NS_ENSURE_ARG_POINTER(aCellsArraySize);
+  *aCellsArraySize = 0;
+
+  NS_ENSURE_ARG_POINTER(aCellsArray);
+  *aCellsArray = 0;
+
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  nsAutoTArray<PRUint32, XPC_TABLE_DEFAULT_SIZE> cellsArray;
+  mTable->SelectedCellIndices(&cellsArray);
+
+  *aCellsArraySize = cellsArray.Length();
+  *aCellsArray = static_cast<PRInt32*>
+    (moz_xmalloc(*aCellsArraySize * sizeof(PRInt32)));
+  memcpy(*aCellsArray, cellsArray.Elements(),
+    *aCellsArraySize * sizeof(PRInt32));
+
+  return NS_OK;
+}
+
+nsresult
+xpcAccessibleTable::GetSelectedColumnIndices(PRUint32* aColsArraySize,
+                                             PRInt32** aColsArray)
+{
+  NS_ENSURE_ARG_POINTER(aColsArraySize);
+  *aColsArraySize = 0;
+
+  NS_ENSURE_ARG_POINTER(aColsArray);
+  *aColsArray = 0;
+
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  nsAutoTArray<PRUint32, XPC_TABLE_DEFAULT_SIZE> colsArray;
+  mTable->SelectedColIndices(&colsArray);
+
+  *aColsArraySize = colsArray.Length();
+  *aColsArray = static_cast<PRInt32*>
+    (moz_xmalloc(*aColsArraySize * sizeof(PRInt32)));
+  memcpy(*aColsArray, colsArray.Elements(),
+    *aColsArraySize * sizeof(PRInt32));
+
+  return NS_OK;
+}
+
+nsresult
+xpcAccessibleTable::GetSelectedRowIndices(PRUint32* aRowsArraySize,
+                                          PRInt32** aRowsArray)
+{
+  NS_ENSURE_ARG_POINTER(aRowsArraySize);
+  *aRowsArraySize = 0;
+
+  NS_ENSURE_ARG_POINTER(aRowsArray);
+  *aRowsArray = 0;
+
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  nsAutoTArray<PRUint32, XPC_TABLE_DEFAULT_SIZE> rowsArray;
+  mTable->SelectedRowIndices(&rowsArray);
+
+  *aRowsArraySize = rowsArray.Length();
+  *aRowsArray = static_cast<PRInt32*>
+    (moz_xmalloc(*aRowsArraySize * sizeof(PRInt32)));
+  memcpy(*aRowsArray, rowsArray.Elements(),
+    *aRowsArraySize * sizeof(PRInt32));
+
+  return NS_OK;
+}
+
+nsresult 
+xpcAccessibleTable::GetColumnIndexAt(PRInt32 aCellIdx, PRInt32* aColIdx)
+{
+  NS_ENSURE_ARG_POINTER(aColIdx);
+  *aColIdx = -1;
+
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  if (aCellIdx < 0 
+      || static_cast<PRUint32>(aCellIdx) 
+      >= mTable->RowCount() * mTable->ColCount())
+    return NS_ERROR_INVALID_ARG;
+
+  *aColIdx = mTable->ColIndexAt(aCellIdx);
+  return NS_OK;
+}
+
+nsresult 
+xpcAccessibleTable::GetRowIndexAt(PRInt32 aCellIdx, PRInt32* aRowIdx)
+{
+  NS_ENSURE_ARG_POINTER(aRowIdx);
+  *aRowIdx = -1;
+
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  if (aCellIdx < 0 
+      || static_cast<PRUint32>(aCellIdx) 
+      >= mTable->RowCount() * mTable->ColCount())
+    return NS_ERROR_INVALID_ARG;
+
+  *aRowIdx = mTable->RowIndexAt(aCellIdx);
+  return NS_OK;
+}
+
+nsresult
+xpcAccessibleTable::GetRowAndColumnIndicesAt(PRInt32 aCellIdx, PRInt32* aRowIdx,
+                                             PRInt32* aColIdx)
+{
+  NS_ENSURE_ARG_POINTER(aRowIdx);
+  *aRowIdx = -1;
+  NS_ENSURE_ARG_POINTER(aColIdx);
+  *aColIdx = -1;
+
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  if (aCellIdx < 0 
+      || static_cast<PRUint32>(aCellIdx) 
+      >= mTable->RowCount() * mTable->ColCount())
+    return NS_ERROR_INVALID_ARG;
+
+  mTable->RowAndColIndicesAt(aCellIdx, aRowIdx, aColIdx);
+  return NS_OK;  
+}
+
+nsresult
 xpcAccessibleTable::GetSummary(nsAString& aSummary)
 {
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   nsAutoString summary;
   mTable->Summary(summary);
   aSummary.Assign(summary);
@@ -293,29 +427,29 @@ xpcAccessibleTable::SelectRow(PRInt32 aR
 }
 
 nsresult
 xpcAccessibleTable::UnselectColumn(PRInt32 aColIdx)
 {
   if (!mTable)
     return NS_ERROR_FAILURE;
 
-  if (aColIdx < 0 || aColIdx >= mTable->ColCount())
+  if (aColIdx < 0 || static_cast<PRUint32>(aColIdx) >= mTable->ColCount())
     return NS_ERROR_INVALID_ARG;
 
   mTable->UnselectCol(aColIdx);
   return NS_OK;
 }
 
 nsresult
 xpcAccessibleTable::UnselectRow(PRInt32 aRowIdx)
 {
   if (!mTable)
     return NS_ERROR_FAILURE;
 
-  if (aRowIdx < 0 || aRowIdx >= mTable->RowCount())
+  if (aRowIdx < 0 || static_cast<PRUint32>(aRowIdx) >= mTable->RowCount())
     return NS_ERROR_INVALID_ARG;
 
   mTable->UnselectRow(aRowIdx);
   return NS_OK;
 }
 
 
--- a/accessible/src/xpcom/xpcAccessibleTable.h
+++ b/accessible/src/xpcom/xpcAccessibleTable.h
@@ -25,28 +25,38 @@ public:
   nsresult GetCaption(nsIAccessible** aCaption);
   nsresult GetSummary(nsAString& aSummary);
   nsresult GetColumnCount(PRInt32* aColumnCount);
   nsresult GetRowCount(PRInt32* aRowCount);
   nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
                      nsIAccessible** aCell);
   nsresult GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
                           PRInt32* aCellIndex);
+  nsresult GetColumnIndexAt(PRInt32 aCellIndex, PRInt32* aColumnIndex);
+  nsresult GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex);
+  nsresult GetRowAndColumnIndicesAt(PRInt32 aCellIndex, PRInt32* aRowIndex,
+                                    PRInt32* aColumnIndex);
   nsresult GetColumnExtentAt(PRInt32 row, PRInt32 column,
                              PRInt32* aColumnExtent);
   nsresult GetRowExtentAt(PRInt32 row, PRInt32 column,
                           PRInt32* aRowExtent);
   nsresult GetColumnDescription(PRInt32 aColIdx, nsAString& aDescription);
   nsresult GetRowDescription(PRInt32 aRowIdx, nsAString& aDescription);
   nsresult IsColumnSelected(PRInt32 aColIdx, bool* _retval);
   nsresult IsRowSelected(PRInt32 aRowIdx, bool* _retval);
   nsresult IsCellSelected(PRInt32 aRowIdx, PRInt32 aColIdx, bool* _retval);
   nsresult GetSelectedCellCount(PRUint32* aSelectedCellCount);
   nsresult GetSelectedColumnCount(PRUint32* aSelectedColumnCount);
   nsresult GetSelectedRowCount(PRUint32* aSelectedRowCount);
+  nsresult GetSelectedCellIndices(PRUint32* aCellsArraySize,
+                                  PRInt32** aCellsArray);
+  nsresult GetSelectedColumnIndices(PRUint32* aColsArraySize,
+                                    PRInt32** aColsArray);
+  nsresult GetSelectedRowIndices(PRUint32* aRowsArraySize,
+                                 PRInt32** aRowsArray);
   nsresult SelectColumn(PRInt32 aColIdx);
   nsresult SelectRow(PRInt32 aRowIdx);
   nsresult UnselectColumn(PRInt32 aColIdx);
   nsresult UnselectRow(PRInt32 aRowIdx);
   nsresult IsProbablyForLayout(bool* aIsForLayout);
 
 protected:
   mozilla::a11y::TableAccessible* mTable;
@@ -60,19 +70,22 @@ protected:
   NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32* aColumnCount) \
     { return xpcAccessibleTable::GetColumnCount(aColumnCount); } \
   NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32* aRowCount) \
     { return xpcAccessibleTable::GetRowCount(aRowCount); } \
   NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible** _retval NS_OUTPARAM) \
     { return xpcAccessibleTable::GetCellAt(rowIndex, columnIndex, _retval); } \
   NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM) \
     { return xpcAccessibleTable::GetCellIndexAt(rowIndex, columnIndex, _retval); } \
-  NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
-  NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
-  NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM); \
+  NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM) \
+    { return xpcAccessibleTable::GetColumnIndexAt(cellIndex, _retval); } \
+  NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM) \
+    { return xpcAccessibleTable::GetRowIndexAt(cellIndex, _retval); } \
+  NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM) \
+    { return xpcAccessibleTable::GetRowAndColumnIndicesAt(cellIndex, rowIndex, columnIndex); } \
   NS_SCRIPTABLE NS_IMETHOD GetColumnExtentAt(PRInt32 row, PRInt32 column, PRInt32* _retval NS_OUTPARAM) \
     { return xpcAccessibleTable::GetColumnExtentAt(row, column, _retval); } \
   NS_SCRIPTABLE NS_IMETHOD GetRowExtentAt(PRInt32 row, PRInt32 column, PRInt32* _retval NS_OUTPARAM) \
     { return xpcAccessibleTable::GetRowExtentAt(row, column, _retval); } \
   NS_SCRIPTABLE NS_IMETHOD GetColumnDescription(PRInt32 columnIndex, nsAString& _retval NS_OUTPARAM) \
     { return xpcAccessibleTable::GetColumnDescription(columnIndex, _retval); } \
   NS_SCRIPTABLE NS_IMETHOD GetRowDescription(PRInt32 rowIndex, nsAString& _retval NS_OUTPARAM) \
     { return xpcAccessibleTable::GetRowDescription(rowIndex, _retval); } \
@@ -84,19 +97,25 @@ protected:
     { return xpcAccessibleTable::IsCellSelected(rowIdx, colIdx, _retval); } \
   NS_SCRIPTABLE NS_IMETHOD GetSelectedCellCount(PRUint32* aSelectedCellCount) \
     { return xpcAccessibleTable::GetSelectedCellCount(aSelectedCellCount); } \
   NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnCount(PRUint32* aSelectedColumnCount) \
     { return xpcAccessibleTable::GetSelectedColumnCount(aSelectedColumnCount); } \
   NS_SCRIPTABLE NS_IMETHOD GetSelectedRowCount(PRUint32* aSelectedRowCount) \
     { return xpcAccessibleTable::GetSelectedRowCount(aSelectedRowCount); } \
   NS_SCRIPTABLE NS_IMETHOD GetSelectedCells(nsIArray * *aSelectedCells); \
-  NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32 *cellsArraySize NS_OUTPARAM, PRInt32 **cellsArray NS_OUTPARAM); \
-  NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
-  NS_SCRIPTABLE NS_IMETHOD GetSelectedRowIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
+  NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32* cellsArraySize NS_OUTPARAM, \
+                                                  PRInt32** cellsArray NS_OUTPARAM) \
+    { return xpcAccessibleTable::GetSelectedCellIndices(cellsArraySize, cellsArray); } \
+  NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32* colsArraySize NS_OUTPARAM, \
+                                                    PRInt32** colsArray NS_OUTPARAM) \
+    { return xpcAccessibleTable::GetSelectedColumnIndices(colsArraySize, colsArray); } \
+  NS_SCRIPTABLE NS_IMETHOD GetSelectedRowIndices(PRUint32* rowsArraySize NS_OUTPARAM, \
+                                                 PRInt32** rowsArray NS_OUTPARAM) \
+    { return xpcAccessibleTable::GetSelectedRowIndices(rowsArraySize, rowsArray); } \
   NS_SCRIPTABLE NS_IMETHOD SelectRow(PRInt32 aRowIdx) \
     { return xpcAccessibleTable::SelectRow(aRowIdx); } \
   NS_SCRIPTABLE NS_IMETHOD SelectColumn(PRInt32 aColIdx) \
     { return xpcAccessibleTable::SelectColumn(aColIdx); } \
   NS_SCRIPTABLE NS_IMETHOD UnselectColumn(PRInt32 aColIdx) \
     { return xpcAccessibleTable::UnselectColumn(aColIdx); } \
   NS_IMETHOD UnselectRow(PRInt32 aRowIdx) \
     { return xpcAccessibleTable::UnselectRow(aRowIdx); } \
--- a/accessible/src/xul/XULListboxAccessible.cpp
+++ b/accessible/src/xul/XULListboxAccessible.cpp
@@ -261,66 +261,16 @@ XULListboxAccessible::CellAt(PRUint32 aR
     return nsnull;
 
   Accessible* row = mDoc->GetAccessible(itemContent);
   NS_ENSURE_TRUE(row, nsnull);
 
   return row->GetChildAt(aColumnIndex);
 }
 
-NS_IMETHODIMP
-XULListboxAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32* aColumn)
-{
-  NS_ENSURE_ARG_POINTER(aColumn);
-  *aColumn = -1;
-
-  PRInt32 columnCount = 0;
-  nsresult rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aColumn = aIndex % columnCount;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-XULListboxAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32* aRow)
-{
-  NS_ENSURE_ARG_POINTER(aRow);
-  *aRow = -1;
-
-  PRInt32 columnCount = 0;
-  nsresult rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aRow = aIndex / columnCount;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-XULListboxAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
-                                               PRInt32* aRowIndex,
-                                               PRInt32* aColumnIndex)
-{
-  NS_ENSURE_ARG_POINTER(aRowIndex);
-  *aRowIndex = -1;
-  NS_ENSURE_ARG_POINTER(aColumnIndex);
-  *aColumnIndex = -1;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  PRInt32 columnCount = 0;
-  nsresult rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aColumnIndex = aCellIndex % columnCount;
-  *aRowIndex = aCellIndex / columnCount;
-  return NS_OK;
-}
-
 bool
 XULListboxAccessible::IsColSelected(PRUint32 aColIdx)
 {
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
     do_QueryInterface(mContent);
   NS_ASSERTION(control,
                "Doesn't implement nsIDOMXULMultiSelectControlElement.");
 
@@ -449,161 +399,101 @@ XULListboxAccessible::GetSelectedCells(n
       }
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-XULListboxAccessible::GetSelectedCellIndices(PRUint32* aNumCells,
-                                             PRInt32** aCells)
+void
+XULListboxAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
 {
-  NS_ENSURE_ARG_POINTER(aNumCells);
-  *aNumCells = 0;
-  NS_ENSURE_ARG_POINTER(aCells);
-  *aCells = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
     do_QueryInterface(mContent);
   NS_ASSERTION(control,
                "Doesn't implement nsIDOMXULMultiSelectControlElement.");
 
   nsCOMPtr<nsIDOMNodeList> selectedItems;
   control->GetSelectedItems(getter_AddRefs(selectedItems));
   if (!selectedItems)
-    return NS_OK;
+    return;
 
   PRUint32 selectedItemsCount = 0;
   nsresult rv = selectedItems->GetLength(&selectedItemsCount);
-  NS_ENSURE_SUCCESS(rv, rv);
+  NS_ASSERTION(NS_SUCCEEDED(rv), "GetLength() Shouldn't fail!");
 
-  PRInt32 columnCount = 0;
-  rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRUint32 cellsCount = selectedItemsCount * columnCount;
+  PRUint32 colCount = ColCount();
+  aCells->SetCapacity(selectedItemsCount * colCount);
+  aCells->AppendElements(selectedItemsCount * colCount);
 
-  PRInt32 *cellsIdxArray =
-    static_cast<PRInt32*>(nsMemory::Alloc((cellsCount) * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(cellsIdxArray, NS_ERROR_OUT_OF_MEMORY);
+  for (PRUint32 selItemsIdx = 0, cellsIdx = 0;
+       selItemsIdx < selectedItemsCount; selItemsIdx++) {
 
-  PRUint32 index = 0, cellsIdx = 0;
-  for (; index < selectedItemsCount; index++) {
     nsCOMPtr<nsIDOMNode> itemNode;
-    selectedItems->Item(index, getter_AddRefs(itemNode));
+    selectedItems->Item(selItemsIdx, getter_AddRefs(itemNode));
     nsCOMPtr<nsIDOMXULSelectControlItemElement> item =
       do_QueryInterface(itemNode);
 
     if (item) {
       PRInt32 itemIdx = -1;
       control->GetIndexOfItem(item, &itemIdx);
-      if (itemIdx != -1) {
-        PRInt32 colIdx = 0;
-        for (; colIdx < columnCount; colIdx++)
-          cellsIdxArray[cellsIdx++] = itemIdx * columnCount + colIdx;
-      }
+      if (itemIdx >= 0)
+        for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++, cellsIdx++)
+          aCells->ElementAt(cellsIdx) = itemIdx * colCount + colIdx;
     }
   }
-
-  *aNumCells = cellsCount;
-  *aCells = cellsIdxArray;
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-XULListboxAccessible::GetSelectedColumnIndices(PRUint32* aNumColumns,
-                                               PRInt32** aColumns)
+void
+XULListboxAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
 {
-  NS_ENSURE_ARG_POINTER(aNumColumns);
-  *aNumColumns = 0;
-  NS_ENSURE_ARG_POINTER(aColumns);
-  *aColumns = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  PRUint32 columnCount = 0;
-  nsresult rv = GetSelectedColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
+  PRUint32 selColCount = SelectedColCount();
+  aCols->SetCapacity(selColCount);
 
-  if (!columnCount)
-    return NS_OK;
-
-  PRInt32 *colsIdxArray =
-    static_cast<PRInt32*>(nsMemory::Alloc((columnCount) * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(colsIdxArray, NS_ERROR_OUT_OF_MEMORY);
-
-  PRUint32 colIdx = 0;
-  for (; colIdx < columnCount; colIdx++)
-    colsIdxArray[colIdx] = colIdx;
-
-  *aNumColumns = columnCount;
-  *aColumns = colsIdxArray;
-
-  return NS_OK;
+  for (PRUint32 colIdx = 0; colIdx < selColCount; colIdx++)
+    aCols->AppendElement(colIdx);
 }
 
-NS_IMETHODIMP
-XULListboxAccessible::GetSelectedRowIndices(PRUint32* aNumRows,
-                                            PRInt32** aRows)
+void
+XULListboxAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
 {
-  NS_ENSURE_ARG_POINTER(aNumRows);
-  *aNumRows = 0;
-  NS_ENSURE_ARG_POINTER(aRows);
-  *aRows = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
     do_QueryInterface(mContent);
   NS_ASSERTION(control,
                "Doesn't implement nsIDOMXULMultiSelectControlElement.");
 
   nsCOMPtr<nsIDOMNodeList> selectedItems;
   control->GetSelectedItems(getter_AddRefs(selectedItems));
   if (!selectedItems)
-    return NS_OK;
+    return;
 
-  PRUint32 selectedItemsCount = 0;
-  nsresult rv = selectedItems->GetLength(&selectedItemsCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!selectedItemsCount)
-    return NS_OK;
+  PRUint32 rowCount = 0;
+  nsresult rv = selectedItems->GetLength(&rowCount);
+  NS_ASSERTION(NS_SUCCEEDED(rv), "GetLength() Shouldn't fail!");
 
-  PRInt32 *rowsIdxArray =
-    static_cast<PRInt32*>(nsMemory::Alloc((selectedItemsCount) * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(rowsIdxArray, NS_ERROR_OUT_OF_MEMORY);
+  if (!rowCount)
+    return;
 
-  PRUint32 index = 0;
-  for (; index < selectedItemsCount; index++) {
+  aRows->SetCapacity(rowCount);
+  aRows->AppendElements(rowCount);
+
+  for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
     nsCOMPtr<nsIDOMNode> itemNode;
-    selectedItems->Item(index, getter_AddRefs(itemNode));
+    selectedItems->Item(rowIdx, getter_AddRefs(itemNode));
     nsCOMPtr<nsIDOMXULSelectControlItemElement> item =
       do_QueryInterface(itemNode);
 
     if (item) {
       PRInt32 itemIdx = -1;
       control->GetIndexOfItem(item, &itemIdx);
-      if (itemIdx != -1)
-        rowsIdxArray[index] = itemIdx;
+      if (itemIdx >= 0)
+        aRows->ElementAt(rowIdx) = itemIdx;
     }
   }
-
-  *aNumRows = selectedItemsCount;
-  *aRows = rowsIdxArray;
-
-  return NS_OK;
 }
 
 void
 XULListboxAccessible::SelectRow(PRUint32 aRowIdx)
 {
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
     do_QueryInterface(mContent);
   NS_ASSERTION(control,
--- a/accessible/src/xul/XULListboxAccessible.h
+++ b/accessible/src/xul/XULListboxAccessible.h
@@ -77,16 +77,19 @@ public:
   virtual PRUint32 RowCount();
   virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
   virtual bool IsColSelected(PRUint32 aColIdx);
   virtual bool IsRowSelected(PRUint32 aRowIdx);
   virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
   virtual PRUint32 SelectedCellCount();
   virtual PRUint32 SelectedColCount();
   virtual PRUint32 SelectedRowCount();
+  virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
+  virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
+  virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
   virtual void SelectRow(PRUint32 aRowIdx);
   virtual void UnselectRow(PRUint32 aRowIdx);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // Accessible
   virtual void Value(nsString& aValue);
--- a/accessible/src/xul/XULTreeGridAccessible.cpp
+++ b/accessible/src/xul/XULTreeGridAccessible.cpp
@@ -124,146 +124,46 @@ XULTreeGridAccessible::GetSelectedCells(
       }
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-XULTreeGridAccessible::GetSelectedCellIndices(PRUint32* aCellsCount,
-                                              PRInt32** aCells)
+void
+XULTreeGridAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
 {
-  NS_ENSURE_ARG_POINTER(aCellsCount);
-  *aCellsCount = 0;
-  NS_ENSURE_ARG_POINTER(aCells);
-  *aCells = nsnull;
-
-  if (!mTreeView)
-    return NS_OK;
-
-  PRInt32 selectedrowCount = 0;
-  nsresult rv = GetSelectionCount(&selectedrowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32 columnCount = 0;
-  rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
+  PRUint32 colCount = ColCount(), rowCount = RowCount();
 
-  PRInt32 selectedCellCount = selectedrowCount * columnCount;
-  PRInt32* outArray = static_cast<PRInt32*>(
-    nsMemory::Alloc(selectedCellCount * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
-
-  nsCOMPtr<nsITreeSelection> selection;
-  rv = mTreeView->GetSelection(getter_AddRefs(selection));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32 rowCount = 0;
-  rv = GetRowCount(&rowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool isSelected;
-  for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowCount; rowIdx++) {
-    selection->IsSelected(rowIdx, &isSelected);
-    if (isSelected) {
-      for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++)
-        outArray[arrayIdx++] = rowIdx * columnCount + colIdx;
-    }
-  }
-
-  *aCellsCount = selectedCellCount;
-  *aCells = outArray;
-  return NS_OK;
+  for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
+    if (IsRowSelected(rowIdx))
+      for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
+        aCells->AppendElement(rowIdx * colCount + colIdx);
 }
 
-NS_IMETHODIMP
-XULTreeGridAccessible::GetSelectedColumnIndices(PRUint32* acolumnCount,
-                                                PRInt32** aColumns)
+void
+XULTreeGridAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
 {
-  NS_ENSURE_ARG_POINTER(acolumnCount);
-  *acolumnCount = 0;
-  NS_ENSURE_ARG_POINTER(aColumns);
-  *aColumns = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  // If all the row has been selected, then all the columns are selected.
-  // Because we can't select a column alone.
-
-  PRInt32 rowCount = 0;
-  nsresult rv = GetRowCount(&rowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
+  if (RowCount() != SelectedRowCount())
+    return;
 
-  PRInt32 selectedrowCount = 0;
-  rv = GetSelectionCount(&selectedrowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (rowCount != selectedrowCount)
-    return NS_OK;
-
-  PRInt32 columnCount = 0;
-  rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32* outArray = static_cast<PRInt32*>(
-    nsMemory::Alloc(columnCount * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
-
-  for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++)
-    outArray[colIdx] = colIdx;
-
-  *acolumnCount = columnCount;
-  *aColumns = outArray;
-  return NS_OK;
+  PRUint32 colCount = ColCount();
+  aCols->SetCapacity(colCount);
+  for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
+    aCols->AppendElement(colIdx);
 }
 
-NS_IMETHODIMP
-XULTreeGridAccessible::GetSelectedRowIndices(PRUint32* arowCount,
-                                             PRInt32** aRows)
+void
+XULTreeGridAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
 {
-  NS_ENSURE_ARG_POINTER(arowCount);
-  *arowCount = 0;
-  NS_ENSURE_ARG_POINTER(aRows);
-  *aRows = nsnull;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  if (!mTreeView)
-    return NS_OK;
-
-  PRInt32 selectedrowCount = 0;
-  nsresult rv = GetSelectionCount(&selectedrowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32* outArray = static_cast<PRInt32*>(
-    nsMemory::Alloc(selectedrowCount * sizeof(PRInt32)));
-  NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
-
-  nsCOMPtr<nsITreeSelection> selection;
-  rv = mTreeView->GetSelection(getter_AddRefs(selection));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32 rowCount = 0;
-  rv = GetRowCount(&rowCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool isSelected;
-  for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowCount; rowIdx++) {
-    selection->IsSelected(rowIdx, &isSelected);
-    if (isSelected)
-      outArray[arrayIdx++] = rowIdx;
-  }
-
-  *arowCount = selectedrowCount;
-  *aRows = outArray;
-  return NS_OK;
+  PRUint32 rowCount = RowCount();
+  for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
+    if (IsRowSelected(rowIdx))
+      aRows->AppendElement(rowIdx);
 }
 
 Accessible*
 XULTreeGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
 { 
   Accessible* row = GetTreeItemAccessible(aRowIndex);
   if (!row)
     return nsnull;
@@ -275,67 +175,16 @@ XULTreeGridAccessible::CellAt(PRUint32 a
 
   nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(row);
   if (!rowAcc)
     return nsnull;
 
   return rowAcc->GetCellAccessible(column);
 }
 
-NS_IMETHODIMP
-XULTreeGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
-                                        PRInt32* aColumnIndex)
-{
-  NS_ENSURE_ARG_POINTER(aColumnIndex);
-  *aColumnIndex = -1;
-
-  PRInt32 columnCount = 0;
-  nsresult rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aColumnIndex = aCellIndex % columnCount;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-XULTreeGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex)
-{
-  NS_ENSURE_ARG_POINTER(aRowIndex);
-  *aRowIndex = -1;
-
-  PRInt32 columnCount;
-  nsresult rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aRowIndex = aCellIndex / columnCount;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-XULTreeGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
-                                                PRInt32* aRowIndex,
-                                                PRInt32* aColumnIndex)
-{
-  NS_ENSURE_ARG_POINTER(aRowIndex);
-  *aRowIndex = -1;
-  NS_ENSURE_ARG_POINTER(aColumnIndex);
-  *aColumnIndex = -1;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  PRInt32 columnCount = 0;
-  nsresult rv = GetColumnCount(&columnCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aColumnIndex = aCellIndex % columnCount;
-  *aRowIndex = aCellIndex / columnCount;
-  return NS_OK;
-}
-
 void
 XULTreeGridAccessible::ColDescription(PRUint32 aColIdx, nsString& aDescription)
 {
   aDescription.Truncate();
 
   nsCOMPtr<nsIAccessible> treeColumns;
   Accessible::GetFirstChild(getter_AddRefs(treeColumns));
   if (treeColumns) {
--- a/accessible/src/xul/XULTreeGridAccessible.h
+++ b/accessible/src/xul/XULTreeGridAccessible.h
@@ -36,16 +36,19 @@ public:
   virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
   virtual void ColDescription(PRUint32 aColIdx, nsString& aDescription);
   virtual bool IsColSelected(PRUint32 aColIdx);
   virtual bool IsRowSelected(PRUint32 aRowIdx);
   virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
   virtual PRUint32 SelectedCellCount();
   virtual PRUint32 SelectedColCount();
   virtual PRUint32 SelectedRowCount();
+  virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
+  virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
+  virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
   virtual void SelectRow(PRUint32 aRowIdx);
   virtual void UnselectRow(PRUint32 aRowIdx);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // Accessible
   virtual TableAccessible* AsTable() { return this; }
--- a/b2g/components/DirectoryProvider.js
+++ b/b2g/components/DirectoryProvider.js
@@ -17,24 +17,23 @@ function DirectoryProvider() {
 
 DirectoryProvider.prototype = {
   classID: Components.ID("{9181eb7c-6f87-11e1-90b1-4f59d80dd2e5}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider]),
 
   getFile: function dp_getFile(prop, persistent) {
 #ifdef MOZ_WIDGET_GONK
-    let localProps = ["cachePDir", "webappsDir", "PrefD"];
+    let localProps = ["cachePDir", "webappsDir", "PrefD", "indexedDBPDir"];
     if (localProps.indexOf(prop) != -1) {
       prop.persistent = true;
       let file = Cc["@mozilla.org/file/local;1"]
                    .createInstance(Ci.nsILocalFile)
       file.initWithPath(LOCAL_DIR);
       return file;
     }
 #endif
 
     return null;
   }
 };
 
 const NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]);
-
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1339191265000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1340295852000">
   <emItems>
       <emItem  blockID="i58" id="webmaster@buzzzzvideos.info">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i86" id="{45147e67-4020-47e2-8f7a-55464fb535aa}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
@@ -22,18 +22,20 @@
                     </versionRange>
                   </emItem>
       <emItem  blockID="i43" id="supportaccessplugin@gmail.com">
                         </emItem>
       <emItem  blockID="i82" id="{8f42fb8b-b6f6-45de-81c0-d6d39f54f971}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
-      <emItem  blockID="i47" id="youtube@youtube2.com">
-                        </emItem>
+      <emItem  blockID="i107" os="WINNT" id="{ABDE892B-13A8-4d1b-88E6-365A6E755758}">
+                        <versionRange  minVersion="0" maxVersion="15.0.4" severity="1">
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i88" id="anttoolbar@ant.com">
                         <versionRange  minVersion="2.4.6.4" maxVersion="2.4.6.4" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
                         <versionRange  minVersion="2.2" maxVersion="2.2">
                     </versionRange>
                   </emItem>
@@ -67,16 +69,20 @@
       <emItem  blockID="i39" id="{c2d64ff7-0ab8-4263-89c9-ea3b0f8f050c}">
                         <versionRange  minVersion="0.1" maxVersion="4.3.1.00" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i92" id="play5@vide04flash.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i108" id="{28bfb930-7620-11e1-b0c4-0800200c9a66}">
+                        <versionRange  minVersion="0" maxVersion="*">
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i105" id="{95ff02bc-ffc6-45f0-a5c8-619b8226a9de}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i93" id="{68b8676b-99a5-46d1-b390-22411d8bcd61}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
@@ -223,23 +229,18 @@
                               <versionRange  minVersion="3.7a1pre" maxVersion="*" />
                           </targetApplication>
                     </versionRange>
                   </emItem>
       <emItem  blockID="i55" id="youtube@youtube7.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
-      <emItem  blockID="i87" os="WINNT" id="afurladvisor@anchorfree.com">
-                        <versionRange  minVersion="0" maxVersion="*">
-                      <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
-                              <versionRange  minVersion="13.0a1" maxVersion="*" />
-                          </targetApplication>
-                    </versionRange>
-                  </emItem>
+      <emItem  blockID="i47" id="youtube@youtube2.com">
+                        </emItem>
       <emItem  blockID="i22" id="ShopperReports@ShopperReports.com">
                         <versionRange  minVersion="3.1.22.0" maxVersion="3.1.22.0">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i2" id="fdm_ffext@freedownloadmanager.org">
                         <versionRange  minVersion="1.0" maxVersion="1.3.1">
                       <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="3.0a1" maxVersion="*" />
@@ -317,16 +318,20 @@
       <emItem  blockID="i96" id="youtubeee@youtuber3.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i77" id="{fa277cfc-1d75-4949-a1f9-4ac8e41b2dfd}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i106" os="WINNT" id="{97E22097-9A2F-45b1-8DAF-36AD648C7EF4}">
+                        <versionRange  minVersion="0" maxVersion="15.0.4" severity="1">
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i11" id="yslow@yahoo-inc.com">
                         <versionRange  minVersion="2.0.5" maxVersion="2.0.5">
                       <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="3.5.7" maxVersion="*" />
                           </targetApplication>
                     </versionRange>
                   </emItem>
       <emItem  blockID="i52" id="ff-ext@youtube">
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1021,16 +1021,17 @@ pref("services.sync.prefs.sync.xpinstall
 
 // Disable the error console
 pref("devtools.errorconsole.enabled", false);
 
 // Developer toolbar and GCLI preferences
 pref("devtools.toolbar.enabled", false);
 pref("devtools.toolbar.visible", false);
 pref("devtools.gcli.allowSet", false);
+pref("devtools.commands.dir", "");
 
 // Enable the Inspector
 pref("devtools.inspector.enabled", true);
 pref("devtools.inspector.htmlHeight", 112);
 pref("devtools.inspector.htmlPanelOpen", false);
 pref("devtools.inspector.sidebarOpen", false);
 pref("devtools.inspector.activeSidebar", "ruleview");
 pref("devtools.inspector.highlighterShowVeil", true);
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -182,19 +182,16 @@ var StarUI = {
     this._element("editBookmarkPanelRemoveButton").label = label;
 
     // unset the unstarred state, if set
     this._element("editBookmarkPanelStarIcon").removeAttribute("unstarred");
 
     this._itemId = aItemId !== undefined ? aItemId : this._itemId;
     this.beginBatch();
 
-    // Consume dismiss clicks, see bug 400924
-    this.panel.popupBoxObject
-        .setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
     this.panel.openPopup(aAnchorElement, aPosition);
 
     gEditItemOverlay.initPanel(this._itemId,
                                { hiddenRows: ["description", "location",
                                               "loadInSidebar", "keyword"] });
   },
 
   panelShown:
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -579,14 +579,14 @@ vbox[anonid=browserContainer][responsive
 }
 
 stack[anonid=browserStack][responsivemode] {
   -moz-transition-duration: 200ms;
   -moz-transition-timing-function: linear;
 }
 
 stack[anonid=browserStack][responsivemode] {
-  -moz-transition-properties: min-width, max-width, min-height, max-height;
+  -moz-transition-property: min-width, max-width, min-height, max-height;
 }
 
 stack[anonid=browserStack][responsivemode][notransition] {
   -moz-transition: none;
 }
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1395,17 +1395,17 @@ var gBrowserInit = {
       document.getElementById("menu_devToolbar").hidden = false;
       document.getElementById("Tools:DevToolbar").removeAttribute("disabled");
 #ifdef MENUBAR_CAN_AUTOHIDE
       document.getElementById("appmenu_devToolbar").hidden = false;
 #endif
 
       // Show the toolbar if it was previously visible
       if (gPrefService.getBoolPref("devtools.toolbar.visible")) {
-        this.DeveloperToolbar.show();
+        DeveloperToolbar.show();
       }
     }
 
     // Enable Inspector?
     let enabled = gPrefService.getBoolPref("devtools.inspector.enabled");
     if (enabled) {
       document.getElementById("menu_pageinspect").hidden = false;
       document.getElementById("Tools:Inspect").removeAttribute("disabled");
@@ -6702,20 +6702,16 @@ var gIdentityHandler = {
     if (this._mode == this.IDENTITY_MODE_CHROMEUI ||
         gURLBar.getAttribute("pageproxystate") != "valid")
       return;
 
     // Make sure that the display:none style we set in xul is removed now that
     // the popup is actually needed
     this._identityPopup.hidden = false;
 
-    // Tell the popup to consume dismiss clicks, to avoid bug 395314
-    this._identityPopup.popupBoxObject
-        .setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
-
     // Update the popup strings
     this.setPopupMessages(this._identityBox.className);
 
     // Add the "open" attribute to the identity box for styling
     this._identityBox.setAttribute("open", "true");
     var self = this;
     this._identityPopup.addEventListener("popuphidden", function onPopupHidden(e) {
       e.currentTarget.removeEventListener("popuphidden", onPopupHidden, false);
@@ -7140,16 +7136,19 @@ let gPrivateBrowsingUI = {
   },
 
   /**
    * These accessors are used to support per-window Private Browsing mode.
    * For now the getter returns nsIPrivateBrowsingService.privateBrowsingEnabled,
    * and the setter should only be used in tests.
    */
   get privateWindow() {
+    if (!gBrowser)
+      return false;
+
     return gBrowser.docShell.QueryInterface(Ci.nsILoadContext)
                             .usePrivateBrowsing;
   }
 };
 
 
 /**
  * Switch to a tab that has a given URI, and focusses its browser window.
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -132,16 +132,17 @@
       <description/>
     </panel>
 
     <panel id="editBookmarkPanel"
            type="arrow"
            footertype="promobox"
            orient="vertical"
            ignorekeys="true"
+           consumeoutsideclicks="true"
            hidden="true"
            onpopupshown="StarUI.panelShown(event);"
            aria-labelledby="editBookmarkPanelTitle">
       <row id="editBookmarkPanelHeader" align="center" hidden="true">
         <vbox align="center">
           <image id="editBookmarkPanelStarIcon"/>
         </vbox>
         <vbox>
@@ -254,16 +255,17 @@
            orient="vertical"
            role="alert"/>
 
     <!-- Popup for site identity information -->
     <panel id="identity-popup"
            type="arrow"
            hidden="true"
            noautofocus="true"
+           consumeoutsideclicks="true"
            onpopupshown="gIdentityHandler.onPopupShown(event);"
            level="top">
       <hbox id="identity-popup-container" align="top">
         <image id="identity-popup-icon"/>
         <vbox id="identity-popup-content-box">
           <label id="identity-popup-connectedToLabel"
                  class="identity-popup-label"
                  value="&identity.connectedTo;"/>
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3046,23 +3046,23 @@
         <body><![CDATA[
           var numPinned = this.tabbrowser._numPinnedTabs;
           var doPosition = this.getAttribute("overflow") == "true" &&
                            numPinned > 0;
 
           if (doPosition) {
             this.setAttribute("positionpinnedtabs", "true");
 
-            let scrollButtonWidth = this.mTabstrip._scrollButtonDown.scrollWidth;
+            let scrollButtonWidth = this.mTabstrip._scrollButtonDown.getBoundingClientRect().width;
             let paddingStart = this.mTabstrip.scrollboxPaddingStart;
             let width = 0;
 
             for (let i = numPinned - 1; i >= 0; i--) {
               let tab = this.childNodes[i];
-              width += tab.scrollWidth;
+              width += tab.getBoundingClientRect().width;
               tab.style.MozMarginStart = - (width + scrollButtonWidth + paddingStart) + "px";
             }
 
             this.style.MozMarginStart = width + paddingStart + "px";
 
           } else {
             this.removeAttribute("positionpinnedtabs");
 
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -147,16 +147,17 @@ endif
                  browser_bug647886.js \
                  browser_bug655584.js \
                  browser_bug664672.js \
                  browser_bug710878.js \
                  browser_bug719271.js \
                  browser_bug735471.js \
                  browser_bug743421.js \
                  browser_bug749738.js \
+                 browser_bug763468.js \
                  browser_canonizeURL.js \
                  browser_customize.js \
                  browser_findbarClose.js \
                  browser_homeDrop.js \
                  browser_keywordBookmarklets.js \
                  browser_contextSearchTabPosition.js \
                  browser_ctrlTab.js \
                  browser_customize_popupNotification.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug763468.js
@@ -0,0 +1,76 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This test makes sure that opening a new tab in private browsing mode opens about:privatebrowsing
+
+// initialization
+const pb = Cc["@mozilla.org/privatebrowsing;1"].
+           getService(Ci.nsIPrivateBrowsingService);
+
+const PREF = "browser.newtab.url";
+
+function test() {
+  let newTabUrl = Services.prefs.getCharPref(PREF) || "about:blank";
+
+  waitForExplicitFinish();
+  // check whether the mode that we start off with is normal or not
+  ok(!pb.privateBrowsingEnabled, "private browsing is disabled");
+
+  // Open a new tab page in normal mode
+  openNewTab(function () {
+    // Check the new tab opened while in normal mode
+    is(gBrowser.selectedBrowser.currentURI.spec, newTabUrl,
+       "URL of NewTab should be browser.newtab.url in Normal mode");
+
+    // enter private browsing mode
+    togglePrivateBrowsing(function () {
+      ok(pb.privateBrowsingEnabled, "private browsing is enabled");
+    
+      // Open a new tab page in private browsing mode
+      openNewTab(function () {
+        // Check the new tab opened while in private browsing mode
+        is(gBrowser.selectedBrowser.currentURI.spec, "about:privatebrowsing",
+           "URL of NewTab should be about:privatebrowsing in PB mode");
+
+        // exit private browsing mode
+        togglePrivateBrowsing(function () {
+          ok(!pb.privateBrowsingEnabled, "private browsing is disabled");
+          
+          // Open a new tab page in normal mode to check if
+          // returning from pb mode restores everything as it should
+          openNewTab(function () {
+            // Check the new tab opened while in normal mode
+            is(gBrowser.selectedBrowser.currentURI.spec, newTabUrl, 
+               "URL of NewTab should be browser.newtab.url in Normal mode");
+            gBrowser.removeTab(gBrowser.selectedTab);
+            gBrowser.removeTab(gBrowser.selectedTab);
+            finish();
+          });
+        });
+      });
+    });
+  });
+}
+
+function togglePrivateBrowsing(aCallback) {
+  let topic = "private-browsing-transition-complete";
+
+  Services.obs.addObserver(function observe() {
+    Services.obs.removeObserver(observe, topic);
+    executeSoon(aCallback);
+  }, topic, false);
+
+  pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
+}
+
+function openNewTab(aCallback) {
+  // Open a new tab
+  BrowserOpenTab();
+  
+  let browser = gBrowser.selectedBrowser;
+  browser.addEventListener("load", function onLoad() {
+    browser.removeEventListener("load", onLoad, true);
+    executeSoon(aCallback);
+  }, true);
+}
--- a/browser/base/content/test/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/browser_tabMatchesInAwesomebar.js
@@ -242,17 +242,17 @@ function ensure_opentabs_match_db(aCallb
     let browserWin = winEnum.getNext();
     // skip closed-but-not-destroyed windows
     if (browserWin.closed)
       continue;
 
     for (let i = 0; i < browserWin.gBrowser.tabContainer.childElementCount; i++) {
       let browser = browserWin.gBrowser.getBrowserAtIndex(i);
       let url = browser.currentURI.spec;
-      if (url == "about:blank")
+      if (browserWin.isBlankPageURL(url))
         continue;
       if (!(url in tabs))
         tabs[url] = 1;
       else
         tabs[url]++;
     }
   }
 
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -4,29 +4,36 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // Services = object with smart getters for common XPCOM services
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
   const PREF = "browser.newtab.url";
+  const TOPIC = "private-browsing-transition-complete";
 
   function getNewTabPageURL() {
-    return Services.prefs.getCharPref(PREF) || "about:blank";
+    if (("gPrivateBrowsingUI" in window) && gPrivateBrowsingUI.privateWindow)
+      return "about:privatebrowsing";
+    else
+      return Services.prefs.getCharPref(PREF) || "about:blank";
   }
 
   function update() {
     BROWSER_NEW_TAB_URL = getNewTabPageURL();
   }
 
   Services.prefs.addObserver(PREF, update, false);
+  Services.obs.addObserver(update, TOPIC, false);
+
   addEventListener("unload", function onUnload() {
     removeEventListener("unload", onUnload);
     Services.prefs.removeObserver(PREF, update);
+    Services.obs.removeObserver(update, TOPIC);
   });
 
   return getNewTabPageURL();
 });
 
 var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
 
 var gBidiUI = false;
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -297,20 +297,16 @@ const DownloadsPanel = {
   _openPopupIfDataReady: function DP_openPopupIfDataReady()
   {
     // We don't want to open the popup if we already displayed it, or if we are
     // still loading data.
     if (this._state != this.kStateShowing || DownloadsView.loading) {
       return;
     }
 
-    // Make sure that clicking outside the popup cannot reopen it accidentally.
-    this.panel.popupBoxObject.setConsumeRollupEvent(Ci.nsIPopupBoxObject
-                                                      .ROLLUP_CONSUME);
-
     // Ensure the anchor is visible.  If that is not possible, show the panel
     // anchored to the top area of the window, near the default anchor position.
     DownloadsButton.getAnchor(function DP_OPIDR_callback(aAnchor) {
       // At this point, if the window is minimized, opening the panel could fail
       // without any notification, and there would be no way to either open or
       // close the panel anymore.  To prevent this, check if the window is
       // minimized and in that case force the panel to the closed state.
       if (window.windowState == Ci.nsIDOMChromeWindow.STATE_MINIMIZED) {
--- a/browser/components/downloads/content/downloadsOverlay.xul
+++ b/browser/components/downloads/content/downloadsOverlay.xul
@@ -41,16 +41,17 @@
          readers, we use a label on the panel instead of the anchor because the
          panel can also be displayed without an anchor. -->
     <panel id="downloadsPanel"
            aria-label="&downloads.title;"
            role="group"
            type="arrow"
            orient="vertical"
            level="top"
+           consumeoutsideclicks="true"
            onpopupshown="DownloadsPanel.onPopupShown(event);"
            onpopuphidden="DownloadsPanel.onPopupHidden(event);">
       <!-- The following popup menu should be a child of the panel element,
            otherwise flickering may occur when the cursor is moved over the area
            of a disabled menu item that overlaps the panel.  See bug 492960. -->
       <menupopup id="downloadsContextMenu"
                  class="download-state">
         <menuitem command="downloadsCmd_pauseResume"
--- a/browser/components/downloads/test/browser/browser_basic_functionality.js
+++ b/browser/components/downloads/test/browser/browser_basic_functionality.js
@@ -31,18 +31,20 @@ function gen_test()
     // Populate the downloads database with the data required by this test.
     for (let yy in gen_addDownloadRows(DownloadData)) yield;
 
     // Open the user interface and wait for data to be fully loaded.
     for (let yy in gen_openPanel()) yield;
 
     // Test item data and count.  This also tests the ordering of the display.
     let richlistbox = document.getElementById("downloadsListBox");
+/* disabled for failing intermittently (bug 767828)
     is(richlistbox.children.length, DownloadData.length,
        "There is the correct number of richlistitems");
+*/
     for (let i = 0; i < richlistbox.children.length; i++) {
       let element = richlistbox.children[i];
       let dataItem = new DownloadsViewItemController(element).dataItem;
       is(dataItem.target, DownloadData[i].name, "Download names match up");
       is(dataItem.state, DownloadData[i].state, "Download states match up");
       is(dataItem.file, DownloadData[i].target, "Download targets match up");
       is(dataItem.uri, DownloadData[i].source, "Download sources match up");
     }
--- a/browser/components/migration/src/MigrationUtils.jsm
+++ b/browser/components/migration/src/MigrationUtils.jsm
@@ -261,27 +261,24 @@ let MigratorPrototype = {
       // from another profile.
       const BOOKMARKS = MigrationUtils.resourceTypes.BOOKMARKS;
       let migratingBookmarks = resources.some(function(r) r.type == BOOKMARKS);
       if (migratingBookmarks) {
         let browserGlue = Cc["@mozilla.org/browser/browserglue;1"].
                           getService(Ci.nsIObserver);
         browserGlue.observe(null, TOPIC_WILL_IMPORT_BOOKMARKS, "");
 
-        let bookmarksHTMLFile = Services.dirsvc.get("BMarks", Ci.nsIFile);
-        if (bookmarksHTMLFile.exists()) {
-          // Note doMigrate doesn't care about the success value of the
-          // callback.
-          BookmarkHTMLUtils.importFromURL(
-            NetUtil.newURI(bookmarksHTMLFile).spec, true, function(a) {
-              browserGlue.observe(null, TOPIC_DID_IMPORT_BOOKMARKS, "");
-              doMigrate();
-            });
-          return;
-        }
+        // Note doMigrate doesn't care about the success value of the
+        // callback.
+        BookmarkHTMLUtils.importFromURL(
+          "resource:///defaults/profile/bookmarks.html", true, function(a) {
+            browserGlue.observe(null, TOPIC_DID_IMPORT_BOOKMARKS, "");
+            doMigrate();
+          });
+        return;
       }
     }
     doMigrate();
   },
 
   /**
    * DO NOT OVERRIDE - After deCOMing migration, this code
    * won't be part of the migrator itself.
--- a/browser/components/tabview/ui.js
+++ b/browser/components/tabview/ui.js
@@ -245,19 +245,16 @@ let UI = {
       this._frameInitialized = true;
       this._save();
 
       // fire an iframe initialized event so everyone knows tab view is 
       // initialized.
       let event = document.createEvent("Events");
       event.initEvent("tabviewframeinitialized", true, false);
       dispatchEvent(event);
-
-      // XXX this can be removed when bug 731868 is fixed
-      event = null;
     } catch(e) {
       Utils.log(e);
     } finally {
       GroupItems.resumeArrange();
     }
   },
 
   // Function: uninit
--- a/browser/devtools/commandline/GcliCommands.jsm
+++ b/browser/devtools/commandline/GcliCommands.jsm
@@ -1,33 +1,143 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
-let EXPORTED_SYMBOLS = [ ];
+let EXPORTED_SYMBOLS = [ "GcliCommands" ];
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
 Cu.import("resource:///modules/devtools/gcli.jsm");
-Cu.import("resource:///modules/HUDService.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
+                                  "resource:///modules/HUDService.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
+                                  "resource://gre/modules/NetUtil.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "LayoutHelpers",
+                                  "resource:///modules/devtools/LayoutHelpers.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "console",
+                                  "resource:///modules/devtools/Console.jsm");
+
+let prefSvc = "@mozilla.org/preferences-service;1";
+XPCOMUtils.defineLazyGetter(this, "prefBranch", function() {
+  let prefService = Cc[prefSvc].getService(Ci.nsIPrefService);
+  return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
+});
 
 Cu.import("resource:///modules/devtools/GcliTiltCommands.jsm", {});
 
-XPCOMUtils.defineLazyGetter(this, "Services", function () {
-  var obj = {};
-  Cu.import("resource://gre/modules/Services.jsm", obj);
-  return obj.Services;
-});
-XPCOMUtils.defineLazyGetter(this, "LayoutHelpers", function () {
-  var obj = {};
-  Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", obj);
-  return obj.LayoutHelpers;
+/**
+ * A place to store the names of the commands that we have added as a result of
+ * calling refreshAutoCommands(). Used by refreshAutoCommands to remove the
+ * added commands.
+ */
+let commands = [];
+
+/**
+ * Exported API
+ */
+let GcliCommands = {
+  /**
+   * Called to look in a directory pointed at by the devtools.commands.dir pref
+   * for *.mozcmd files which are then loaded.
+   * @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
+   * we eval the script from the .mozcmd file. This should be a chrome window.
+   */
+  refreshAutoCommands: function GC_refreshAutoCommands(aSandboxPrincipal) {
+    // First get rid of the last set of commands
+    commands.forEach(function(name) {
+      gcli.removeCommand(name);
+    });
+
+    let dirName = prefBranch.getComplexValue("devtools.commands.dir",
+                                             Ci.nsISupportsString).data;
+    if (dirName == "") {
+      return;
+    }
+
+    let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+    dir.initWithPath(dirName);
+    if (!dir.exists() || !dir.isDirectory()) {
+      throw new Error('\'' + dirName + '\' is not a directory.');
+    }
+
+    let en = dir.directoryEntries.QueryInterface(Ci.nsIDirectoryEnumerator);
+
+    while (true) {
+      let file = en.nextFile;
+      if (!file) {
+        break;
+      }
+      if (file.leafName.match(/.*\.mozcmd$/) && file.isFile() && file.isReadable()) {
+        loadCommandFile(file, aSandboxPrincipal);
+      }
+    }
+  },
+};
+
+/**
+ * Load the commands from a single file
+ * @param nsIFile aFile The file containing the commands that we should read
+ * @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
+ * we eval the script from the .mozcmd file. This should be a chrome window.
+ */
+function loadCommandFile(aFile, aSandboxPrincipal) {
+  NetUtil.asyncFetch(aFile, function refresh_fetch(aStream, aStatus) {
+    if (!Components.isSuccessCode(aStatus)) {
+      console.error("NetUtil.asyncFetch(" + aFile.path + ",..) failed. Status=" + aStatus);
+      return;
+    }
+
+    let source = NetUtil.readInputStreamToString(aStream, aStream.available());
+    aStream.close();
+
+    let sandbox = new Cu.Sandbox(aSandboxPrincipal, {
+      sandboxPrototype: aSandboxPrincipal,
+      wantXrays: false,
+      sandboxName: aFile.path
+    });
+    let data = Cu.evalInSandbox(source, sandbox, "1.8", aFile.leafName, 1);
+
+    if (!Array.isArray(data)) {
+      console.error("Command file '" + aFile.leafName + "' does not have top level array.");
+      return;
+    }
+
+    data.forEach(function(commandSpec) {
+      gcli.addCommand(commandSpec);
+      commands.push(commandSpec.name);
+    });
+  }.bind(this));
+}
+
+/**
+ * 'cmd' command
+ */
+gcli.addCommand({
+  name: "cmd",
+  description: gcli.lookup("cmdDesc"),
 });
 
+/**
+ * 'cmd refresh' command
+ */
+gcli.addCommand({
+  name: "cmd refresh",
+  description: gcli.lookup("cmdRefreshDesc"),
+  exec: function Command_cmdRefresh(args, context) {
+    GcliCommands.refreshAutoCommands(context.environment.chromeDocument.defaultView);
+  }
+});
 
 /**
  * 'echo' command
  */
 gcli.addCommand({
   name: "echo",
   description: gcli.lookup("echoDesc"),
   params: [
--- a/browser/devtools/debugger/debugger-view.js
+++ b/browser/devtools/debugger/debugger-view.js
@@ -972,38 +972,26 @@ PropertiesView.prototype = {
     element.addProperties = this._addProperties.bind(this, element);
 
     // Setup the additional elements specific for a variable node.
     element.refresh(function() {
       let separatorLabel = document.createElement("label");
       let valueLabel = document.createElement("label");
       let title = element.getElementsByClassName("title")[0];
 
+      // Use attribute flags to specify the element type and tooltip text.
+      this._setAttributes(element, aName, aFlags);
+
       // Separator between the variable name and its value.
       separatorLabel.className = "plain";
       separatorLabel.setAttribute("value", ":");
 
       // The variable information (type, class and/or value).
       valueLabel.className = "value plain";
 
-      if (aFlags) {
-        // Use attribute flags to specify the element type and tooltip text.
-        let tooltip = [];
-
-        !aFlags.configurable ? element.setAttribute("non-configurable", "")
-                             : tooltip.push("configurable");
-        !aFlags.enumerable   ? element.setAttribute("non-enumerable", "")
-                             : tooltip.push("enumerable");
-        !aFlags.writable     ? element.setAttribute("non-writable", "")
-                             : tooltip.push("writable");
-
-        element.setAttribute("tooltiptext", tooltip.join(", "));
-      }
-      if (aName === "this") { element.setAttribute("self", ""); }
-
       // Handle the click event when pressing the element value label.
       valueLabel.addEventListener("click", this._activateElementInputMode.bind({
         scope: this,
         element: element,
         valueLabel: valueLabel
       }));
 
       // Maintain the symbolic name of the variable.
@@ -1025,16 +1013,46 @@ PropertiesView.prototype = {
       });
     }.bind(this));
 
     // Return the element for later use if necessary.
     return element;
   },
 
   /**
+   * Sets a variable's configurable, enumerable or writable attributes.
+   *
+   * @param object aVar
+   *        The object to set the attributes on.
+   * @param object aName
+   *        The varialbe name.
+   * @param object aFlags
+   *        Contains configurable, enumerable or writable flags.
+   */
+  _setAttributes: function DVP_setAttributes(aVar, aName, aFlags) {
+    if (aFlags) {
+      if (!aFlags.configurable) {
+        aVar.setAttribute("non-configurable", "");
+      }
+      if (!aFlags.enumerable) {
+        aVar.setAttribute("non-enumerable", "");
+      }
+      if (!aFlags.writable) {
+        aVar.setAttribute("non-writable", "");
+      }
+    }
+    if (aName === "this") {
+      aVar.setAttribute("self", "");
+    }
+    if (aName === "__proto__ ") {
+      aVar.setAttribute("proto", "");
+    }
+  },
+
+  /**
    * Sets the specific grip for a variable.
    * The grip should contain the value or the type & class, as defined in the
    * remote debugger protocol. For convenience, undefined and null are
    * both considered types.
    *
    * @param object aVar
    *        The parent variable element.
    * @param object aGrip
@@ -1204,16 +1222,19 @@ PropertiesView.prototype = {
 
     // Setup the additional elements specific for a variable node.
     element.refresh(function(pKey, pGrip) {
       let title = element.getElementsByClassName("title")[0];
       let nameLabel = title.getElementsByClassName("name")[0];
       let separatorLabel = document.createElement("label");
       let valueLabel = document.createElement("label");
 
+      // Use attribute flags to specify the element type and tooltip text.
+      this._setAttributes(element, pKey, aFlags);
+
       if ("undefined" !== typeof pKey) {
         // Use a key element to specify the property name.
         nameLabel.className = "key plain";
         nameLabel.setAttribute("value", pKey.trim());
         title.appendChild(nameLabel);
       }
       if ("undefined" !== typeof pGrip) {
         // Separator between the variable name and its value.
@@ -1223,31 +1244,16 @@ PropertiesView.prototype = {
         // Use a value element to specify the property value.
         valueLabel.className = "value plain";
         this._applyGrip(valueLabel, pGrip);
 
         title.appendChild(separatorLabel);
         title.appendChild(valueLabel);
       }
 
-      if (aFlags) {
-        // Use attribute flags to specify the element type and tooltip text.
-        let tooltip = [];
-
-        !aFlags.configurable ? element.setAttribute("non-configurable", "")
-                             : tooltip.push("configurable");
-        !aFlags.enumerable   ? element.setAttribute("non-enumerable", "")
-                             : tooltip.push("enumerable");
-        !aFlags.writable     ? element.setAttribute("non-writable", "")
-                             : tooltip.push("writable");
-
-        element.setAttribute("tooltiptext", tooltip.join(", "));
-      }
-      if (pKey === "__proto__ ") { element.setAttribute("proto", ""); }
-
       // Handle the click event when pressing the element value label.
       valueLabel.addEventListener("click", this._activateElementInputMode.bind({
         scope: this,
         element: element,
         valueLabel: valueLabel
       }));
 
       // Maintain the symbolic name of the property.
@@ -1493,16 +1499,17 @@ PropertiesView.prototype = {
     details.className = "details";
 
     // Add the click event handler for the title, or arrow and name.
     if (aClass === "scope") {
       title.addEventListener("click", function() { element.toggle(); }, false);
     } else {
       arrow.addEventListener("click", function() { element.toggle(); }, false);
       name.addEventListener("click", function() { element.toggle(); }, false);
+      name.addEventListener("mouseover", function() { element.updateTooltip(name); }, false);
     }
 
     title.appendChild(arrow);
     title.appendChild(name);
 
     element.appendChild(title);
     element.appendChild(details);
 
@@ -1724,16 +1731,62 @@ PropertiesView.prototype = {
           element.showArrow();
         } else {
           element.hideArrow();
         }
       }
     });
 
     /**
+     * Creates a tooltip for the element displaying certain attributes.
+     *
+     * @param object aAnchor
+     *        The element which will anchor the tooltip.
+     */
+    element.updateTooltip = function DVP_element_updateTooltip(aAnchor) {
+      let tooltip = document.getElementById("element-tooltip");
+      if (tooltip) {
+        document.documentElement.removeChild(tooltip);
+      }
+
+      tooltip = document.createElement("tooltip");
+      tooltip.id = "element-tooltip";
+
+      let configurableLabel = document.createElement("label");
+      configurableLabel.id = "configurableLabel";
+      configurableLabel.setAttribute("value", "configurable");
+
+      let enumerableLabel = document.createElement("label");
+      enumerableLabel.id = "enumerableLabel";
+      enumerableLabel.setAttribute("value", "enumerable");
+
+      let writableLabel = document.createElement("label");
+      writableLabel.id = "writableLabel";
+      writableLabel.setAttribute("value", "writable");
+
+      tooltip.setAttribute("orient", "horizontal")
+      tooltip.appendChild(configurableLabel);
+      tooltip.appendChild(enumerableLabel);
+      tooltip.appendChild(writableLabel);
+
+      if (element.hasAttribute("non-configurable")) {
+        configurableLabel.setAttribute("non-configurable", "");
+      }
+      if (element.hasAttribute("non-enumerable")) {
+        enumerableLabel.setAttribute("non-enumerable", "");
+      }
+      if (element.hasAttribute("non-writable")) {
+        writableLabel.setAttribute("non-writable", "");
+      }
+
+      document.documentElement.appendChild(tooltip);
+      aAnchor.setAttribute("tooltip", tooltip.id);
+    };
+
+    /**
      * Generic function refreshing the internal state of the element when
      * it's modified (e.g. a child detail, variable, property is added).
      *
      * @param function aFunction
      *        The function logic used to modify the internal state.
      * @param array aArguments
      *        Optional arguments array to be applied to aFunction.
      */
--- a/browser/devtools/layoutview/LayoutView.jsm
+++ b/browser/devtools/layoutview/LayoutView.jsm
@@ -289,17 +289,22 @@ LayoutView.prototype = {
     if (!node || !this.documentReady) return;
 
     // First, we update the first part of the layout view, with
     // the size of the element.
 
     let clientRect = node.getBoundingClientRect();
     let width = Math.round(clientRect.width);
     let height = Math.round(clientRect.height);
-    this.doc.querySelector("#element-size").textContent =  width + "x" + height;
+
+    let elt = this.doc.querySelector("#element-size");
+    let newLabel = width + "x" + height;
+    if (elt.textContent != newLabel) {
+      elt.textContent = newLabel;
+    }
 
     // If the view is closed, no need to do anything more.
     if (!this.isOpen) return;
 
     // We compute and update the values of margins & co.
     let style = this.browser.contentWindow.getComputedStyle(node);;
 
     for (let i in this.map) {
--- a/browser/devtools/layoutview/view.css
+++ b/browser/devtools/layoutview/view.css
@@ -14,16 +14,17 @@ body {
 }
 
 #header {
   -moz-box-sizing: border-box;
   font: 12px/16px monospace;
   width: 100%;
   padding: 6px 9px;
   display: -moz-box;
+  vertical-align: top;
 }
 
 body[dir=rtl] > #header {
   -moz-box-direction: reverse;
 }
 
 #header > span {
   display: -moz-box;
--- a/browser/devtools/responsivedesign/responsivedesign.jsm
+++ b/browser/devtools/responsivedesign/responsivedesign.jsm
@@ -23,20 +23,20 @@ let ResponsiveUIManager = {
    * Check if the a tab is in a responsive mode.
    * Leave the responsive mode if active,
    * active the responsive mode if not active.
    *
    * @param aWindow the main window.
    * @param aTab the tab targeted.
    */
   toggle: function(aWindow, aTab) {
-    if (aTab.responsiveUI) {
-      aTab.responsiveUI.close();
+    if (aTab.__responsiveUI) {
+      aTab.__responsiveUI.close();
     } else {
-      aTab.responsiveUI = new ResponsiveUI(aWindow, aTab);
+      aTab.__responsiveUI = new ResponsiveUI(aWindow, aTab);
     }
   },
 }
 
 let presets = [
   // Phones
   {key: "320x480", width: 320, height: 480},    // iPhone, B2G, with <meta viewport>
   {key: "360x640", width: 360, height: 640},    // Android 4, phones, with <meta viewport>
@@ -164,17 +164,17 @@ ResponsiveUI.prototype = {
     this.container.removeChild(this.toolbar);
     this.stack.removeChild(this.resizer);
     this.stack.removeChild(this.resizeBar);
 
     // Unset the responsive mode.
     this.container.removeAttribute("responsivemode");
     this.stack.removeAttribute("responsivemode");
 
-    delete this.tab.responsiveUI;
+    delete this.tab.__responsiveUI;
   },
 
   /**
    * Retrieve a preset from its key.
    *
    * @param aKey preset's key.
    * @returns the index of the preset, -1 if not found.
    */
--- a/browser/devtools/responsivedesign/test/browser_responsivecomputedview.js
+++ b/browser/devtools/responsivedesign/test/browser_responsivecomputedview.js
@@ -37,17 +37,17 @@ function test() {
   }
 
   function startTest() {
     document.getElementById("Tools:ResponsiveUI").doCommand();
     executeSoon(onUIOpen);
   }
 
   function onUIOpen() {
-    instance = gBrowser.selectedTab.responsiveUI;
+    instance = gBrowser.selectedTab.__responsiveUI;
     ok(instance, "instance of the module is attached to the tab.");
 
     instance.stack.setAttribute("notransition", "true");
     registerCleanupFunction(function() {
       instance.stack.removeAttribute("notransition");
     });
 
     instance.setSize(500, 500);
--- a/browser/devtools/responsivedesign/test/browser_responsiveruleview.js
+++ b/browser/devtools/responsivedesign/test/browser_responsiveruleview.js
@@ -32,17 +32,17 @@ function test() {
   }
 
   function startTest() {
     document.getElementById("Tools:ResponsiveUI").doCommand();
     executeSoon(onUIOpen);
   }
 
   function onUIOpen() {
-    instance = gBrowser.selectedTab.responsiveUI;
+    instance = gBrowser.selectedTab.__responsiveUI;
     ok(instance, "instance of the module is attached to the tab.");
 
     instance.stack.setAttribute("notransition", "true");
     registerCleanupFunction(function() {
       instance.stack.removeAttribute("notransition");
     });
 
     instance.setSize(500, 500);
--- a/browser/devtools/responsivedesign/test/browser_responsiveui.js
+++ b/browser/devtools/responsivedesign/test/browser_responsiveui.js
@@ -23,17 +23,17 @@ function test() {
   function onUIOpen() {
     // Is it open?
     let container = gBrowser.getBrowserContainer();
     is(container.getAttribute("responsivemode"), "true", "In responsive mode.");
 
     // Menus are correctly updated?
     is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "true", "menus checked");
 
-    instance = gBrowser.selectedTab.responsiveUI;
+    instance = gBrowser.selectedTab.__responsiveUI;
     ok(instance, "instance of the module is attached to the tab.");
 
     instance.transitionsEnabled = false;
 
     testPresets();
   }
 
   function testPresets() {
--- a/browser/devtools/shared/DeveloperToolbar.jsm
+++ b/browser/devtools/shared/DeveloperToolbar.jsm
@@ -9,23 +9,24 @@ const EXPORTED_SYMBOLS = [ "DeveloperToo
 const NS_XHTML = "http://www.w3.org/1999/xhtml";
 
 const WEBCONSOLE_CONTENT_SCRIPT_URL =
   "chrome://browser/content/devtools/HUDService-content.js";
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
-XPCOMUtils.defineLazyGetter(this, "gcli", function() {
-  let obj = {};
-  Components.utils.import("resource:///modules/devtools/gcli.jsm", obj);
-  Components.utils.import("resource:///modules/devtools/GcliCommands.jsm", {});
-  return obj.gcli;
-});
+XPCOMUtils.defineLazyModuleGetter(this, "console",
+                                  "resource:///modules/devtools/Console.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "gcli",
+                                  "resource:///modules/devtools/gcli.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "GcliCommands",
+                                  "resource:///modules/devtools/GcliCommands.jsm");
 
 /**
  * A component to manage the global developer toolbar, which contains a GCLI
  * and buttons for various developer tools.
  * @param aChromeWindow The browser window to which this toolbar is attached
  * @param aToolbarElement See browser.xul:<toolbar id="developer-toolbar">
  */
 function DeveloperToolbar(aChromeWindow, aToolbarElement)
@@ -38,16 +39,23 @@ function DeveloperToolbar(aChromeWindow,
 
   this._lastState = NOTIFICATIONS.HIDE;
   this._pendingShowCallback = undefined;
   this._pendingHide = false;
   this._errorsCount = {};
   this._webConsoleButton = this._doc
                            .getElementById("developer-toolbar-webconsole");
   this._webConsoleButtonLabel = this._webConsoleButton.label;
+
+  try {
+    GcliCommands.refreshAutoCommands(aChromeWindow);
+  }
+  catch (ex) {
+    console.error(ex);
+  }
 }
 
 /**
  * Inspector notifications dispatched through the nsIObserverService
  */
 const NOTIFICATIONS = {
   /** DeveloperToolbar.show() has been called, and we're working on it */
   LOAD: "developer-toolbar-load",
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -688,9 +688,10 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DL
 @BINPATH@/webapprt/chrome/webapprt.manifest
 @BINPATH@/webapprt/components/CommandLineHandler.js
 @BINPATH@/webapprt/components/ContentPermission.js
 @BINPATH@/webapprt/components/ContentPolicy.js
 @BINPATH@/webapprt/components/DirectoryProvider.js
 @BINPATH@/webapprt/components/components.manifest
 @BINPATH@/webapprt/defaults/preferences/prefs.js
 @BINPATH@/webapprt/modules/WebappRT.jsm
+@BINPATH@/webapprt/modules/WebappsHandler.jsm
 #endif
--- a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties
@@ -327,8 +327,18 @@ editManual2=Edit one of the resources th
 # 'resource' parameter to the 'edit' command, which is displayed in a dialog
 # when the user is using this command.
 editResourceDesc=URL to edit
 
 # LOCALIZATION NOTE (editLineToJumpToDesc) A very short string to describe the
 # 'line' parameter to the 'edit' command, which is displayed in a dialog
 # when the user is using this command.
 editLineToJumpToDesc=Line to jump to
+
+# LOCALIZATION NOTE (cmdDesc) A very short description of the 'cmd'
+# command. This string is designed to be shown in a menu alongside the command
+# name, which is why it should be as short as possible.
+cmdDesc=Manipulate the commands
+
+# LOCALIZATION NOTE (cmdRefreshDesc) A very short description of the 'cmd refresh'
+# command. This string is designed to be shown in a menu alongside the command
+# name, which is why it should be as short as possible.
+cmdRefreshDesc=Re-read mozcmd directory
--- a/browser/locales/en-US/webapprt/webapp.properties
+++ b/browser/locales/en-US/webapprt/webapp.properties
@@ -18,8 +18,17 @@ hideApplicationCmdMac.label=Hide %S
 
 # LOCALIZATION NOTE (geolocation.title): %S will be replaced with the name of
 # the webapp.
 geolocation.title=%S - Share Location
 geolocation.description=Do you want to share your location?
 geolocation.sharelocation=Share Location
 geolocation.dontshare=Don't Share
 geolocation.remember=Remember my choice
+
+# LOCALIZATION NOTE (webapps.install.title): %S will be replaced with the name
+# of the webapp being installed.
+webapps.install.title=Install %S
+# LOCALIZATION NOTE (webapps.install.description): %S will be replaced with the
+# name of the webapp being installed.
+webapps.install.description=Do you want to install %S?
+webapps.install.install=Install App
+webapps.install.dontinstall=Don't Install
--- a/browser/modules/WebappsInstaller.jsm
+++ b/browser/modules/WebappsInstaller.jsm
@@ -37,20 +37,20 @@ let WebappsInstaller = {
 #else
     return false;
 #endif
 
     try {
       shell.install();
     } catch (ex) {
       Cu.reportError("Error installing app: " + ex);
-      return false;
+      return null;
     }
 
-    return true;
+    return shell;
   }
 }
 
 /**
  * This function implements the common constructor for
  * the Windows, Mac and Linux native app shells. It reads and parses
  * the data from the app manifest and stores it in the NativeApp
  * object. It's meant to be called as NativeApp.call(this, aData)
@@ -102,36 +102,40 @@ function NativeApp(aData) {
   if (app.manifest.description) {
     let firstLine = app.manifest.description.split("\n")[0];
     shortDesc = firstLine.length <= 256
                 ? firstLine
                 : firstLine.substr(0, 253) + "...";
   }
   this.shortDescription = sanitize(shortDesc);
 
+  this.appcacheDefined = (app.manifest.appcache_path != undefined);
+
   this.manifest = app.manifest;
 
-  this.profileFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
+  // The app registry is the Firefox profile from which the app
+  // was installed.
+  this.registryFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
 
   this.webappJson = {
-    "registryDir": this.profileFolder.path,
+    "registryDir": this.registryFolder.path,
     "app": app
   };
 
-  this.processFolder = Services.dirsvc.get("CurProcD", Ci.nsIFile);
+  this.runtimeFolder = Services.dirsvc.get("GreD", Ci.nsIFile);
 }
 
 #ifdef XP_WIN
 /*************************************
  * Windows app installer
  *
  * The Windows installation process will generate the following files:
  *
- * ${FolderName} = app-origin;protocol;port
- *                 e.g.: subdomain.example.com;http;-1
+ * ${FolderName} = protocol;app-origin[;port]
+ *                 e.g.: subdomain.example.com;http;85
  *
  * %APPDATA%/${FolderName}
  *   - webapp.ini
  *   - webapp.json
  *   - ${AppName}.exe
  *   - ${AppName}.lnk
  *   / uninstall
  *     - webapp-uninstaller.exe
@@ -165,16 +169,17 @@ WinNativeApp.prototype = {
     this._removeInstallation();
 
     try {
       this._createDirectoryStructure();
       this._copyPrebuiltFiles();
       this._createConfigFiles();
       this._createShortcutFiles();
       this._writeSystemKeys();
+      this._createAppProfile();
     } catch (ex) {
       this._removeInstallation();
       throw(ex);
     }
 
     getIconForApp(this, function() {});
   },
 
@@ -186,18 +191,18 @@ WinNativeApp.prototype = {
     let filenameRE = new RegExp("[<>:\"/\\\\|\\?\\*]", "gi");
 
     this.appNameAsFilename = this.appNameAsFilename.replace(filenameRE, "");
     if (this.appNameAsFilename == "") {
       this.appNameAsFilename = "webapp";
     }
 
     // The ${InstallDir} format is as follows:
-    //  host of the app origin + ";" +
     //  protocol
+    //  + ";" + host of the app origin
     //  + ";" + port (only if port is not default)
     this.installDir = Services.dirsvc.get("AppData", Ci.nsIFile);
     let installDirLeaf = this.launchURI.scheme
                        + ";"
                        + this.launchURI.host;
     if (this.launchURI.port != -1) {
       installDirLeaf += ";" + this.launchURI.port;
     }
@@ -276,24 +281,38 @@ WinNativeApp.prototype = {
    * Creates the main directory structure.
    */
   _createDirectoryStructure: function() {
     this.installDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
     this.uninstallDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
   },
 
   /**
+   * Creates the profile to be used for this app.
+   */
+  _createAppProfile: function() {
+    if (!this.appcacheDefined)
+      return;
+
+    let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
+                    .getService(Ci.nsIToolkitProfileService);
+
+    this.appProfile = profSvc.createDefaultProfileForApp(this.installDir.leafName,
+                                                         null, null);
+  },
+
+  /**
    * Copy the pre-built files into their destination folders.
    */
   _copyPrebuiltFiles: function() {
-    let webapprt = this.processFolder.clone();
+    let webapprt = this.runtimeFolder.clone();
     webapprt.append("webapprt-stub.exe");
     webapprt.copyTo(this.installDir, this.appNameAsFilename + ".exe");
 
-    let uninstaller = this.processFolder.clone();
+    let uninstaller = this.runtimeFolder.clone();
     uninstaller.append("webapp-uninstaller.exe");
     uninstaller.copyTo(this.uninstallDir, this.uninstallerFile.leafName);
   },
 
   /**
    * Creates the configuration files into their destination folders.
    */
   _createConfigFiles: function() {
@@ -308,17 +327,17 @@ WinNativeApp.prototype = {
 
     let factory = Cc["@mozilla.org/xpcom/ini-processor-factory;1"]
                     .getService(Ci.nsIINIParserFactory);
 
     let writer = factory.createINIParser(webappINI).QueryInterface(Ci.nsIINIParserWriter);
     writer.setString("Webapp", "Name", this.appName);
     writer.setString("Webapp", "Profile", this.installDir.leafName);
     writer.setString("Webapp", "Executable", this.appNameAsFilename);
-    writer.setString("WebappRT", "InstallDir", this.processFolder.path);
+    writer.setString("WebappRT", "InstallDir", this.runtimeFolder.path);
     writer.writeFile(null, Ci.nsIINIParserWriter.WRITE_UTF16);
 
     // ${UninstallDir}/shortcuts_log.ini
     let shortcutLogsINI = this.uninstallDir.clone().QueryInterface(Ci.nsILocalFile);
     shortcutLogsINI.append("shortcuts_log.ini");
 
     writer = factory.createINIParser(shortcutLogsINI).QueryInterface(Ci.nsIINIParserWriter);
     writer.setString("STARTMENU", "Shortcut0", this.appNameAsFilename + ".lnk");
@@ -490,16 +509,17 @@ MacNativeApp.prototype = {
   },
 
   install: function() {
     this._removeInstallation(true);
     try {
       this._createDirectoryStructure();
       this._copyPrebuiltFiles();
       this._createConfigFiles();
+      this._createAppProfile();
     } catch (ex) {
       this._removeInstallation(false);
       throw(ex);
     }
 
     getIconForApp(this, this._moveToApplicationsFolder);
   },
 
@@ -528,18 +548,29 @@ MacNativeApp.prototype = {
     if (!this.appProfileDir.exists())
       this.appProfileDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
 
     this.contentsDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
     this.macOSDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
     this.resourcesDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
   },
 
+  _createAppProfile: function() {
+    if (!this.appcacheDefined)
+      return;
+
+    let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
+                    .getService(Ci.nsIToolkitProfileService);
+
+    this.appProfile = profSvc.createDefaultProfileForApp(this.appProfileDir.leafName,
+                                                         null, null);
+  },
+
   _copyPrebuiltFiles: function() {
-    let webapprt = this.processFolder.clone();
+    let webapprt = this.runtimeFolder.clone();
     webapprt.append("webapprt-stub");
     webapprt.copyTo(this.macOSDir, "webapprt");
   },
 
   _createConfigFiles: function() {
     // ${ProfileDir}/webapp.json
     let configJson = this.appProfileDir.clone();
     configJson.append("webapp.json");
@@ -690,16 +721,17 @@ LinuxNativeApp.prototype = {
 
   install: function() {
     this._removeInstallation();
 
     try {
       this._createDirectoryStructure();
       this._copyPrebuiltFiles();
       this._createConfigFiles();
+      this._createAppProfile();
     } catch (ex) {
       this._removeInstallation();
       throw(ex);
     }
 
     getIconForApp(this, function() {});
   },
 
@@ -714,38 +746,49 @@ LinuxNativeApp.prototype = {
     }
   },
 
   _createDirectoryStructure: function() {
     this.installDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
   },
 
   _copyPrebuiltFiles: function() {
-    let webapprtPre = this.processFolder.clone();
+    let webapprtPre = this.runtimeFolder.clone();
     webapprtPre.append(this.webapprt.leafName);
     webapprtPre.copyTo(this.installDir, this.webapprt.leafName);
   },
 
+  _createAppProfile: function() {
+    if (!this.appcacheDefined)
+      return;
+
+    let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
+                    .getService(Ci.nsIToolkitProfileService);
+
+    return profSvc.createDefaultProfileForApp(this.installDir.leafName,
+                                              null, null);
+  },
+
   _createConfigFiles: function() {
     // ${InstallDir}/webapp.json
     let configJson = this.installDir.clone();
     configJson.append("webapp.json");
     writeToFile(configJson, JSON.stringify(this.webappJson), function() {});
 
     // ${InstallDir}/webapp.ini
     let webappINI = this.installDir.clone();
     webappINI.append("webapp.ini");
 
     let factory = Cc["@mozilla.org/xpcom/ini-processor-factory;1"]
                     .getService(Ci.nsIINIParserFactory);
 
     let writer = factory.createINIParser(webappINI).QueryInterface(Ci.nsIINIParserWriter);
     writer.setString("Webapp", "Name", this.appName);
     writer.setString("Webapp", "Profile", this.uniqueName);
-    writer.setString("WebappRT", "InstallDir", this.processFolder.path);
+    writer.setString("WebappRT", "InstallDir", this.runtimeFolder.path);
     writer.writeFile();
 
     // $XDG_DATA_HOME/applications/owa-<webappuniquename>.desktop
     this.desktopINI.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0755);
 
     writer = factory.createINIParser(this.desktopINI).QueryInterface(Ci.nsIINIParserWriter);
     writer.setString("Desktop Entry", "Name", this.appName);
     writer.setString("Desktop Entry", "Comment", this.shortDescription);
--- a/browser/modules/webappsUI.jsm
+++ b/browser/modules/webappsUI.jsm
@@ -104,18 +104,24 @@ let webappsUI = {
 
   doInstall: function(aData, aBrowser, aWindow) {
     let bundle = aWindow.gNavigatorBundle;
 
     let mainAction = {
       label: bundle.getString("webapps.install"),
       accessKey: bundle.getString("webapps.install.accesskey"),
       callback: function(notification) {
-        if (WebappsInstaller.install(aData)) {
-          DOMApplicationRegistry.confirmInstall(aData);
+        let app = WebappsInstaller.install(aData);
+        if (app) {
+          let localDir = null;
+          if (app.appcacheDefined && app.appProfile) {
+            localDir = app.appProfile.localDir;
+          }
+
+          DOMApplicationRegistry.confirmInstall(aData, false, localDir);
         } else {
           DOMApplicationRegistry.denyInstall(aData);
         }
       }
     };
 
     let requestingURI = aWindow.makeURI(aData.from);
     let manifest = new DOMApplicationManifest(aData.app.manifest, aData.app.origin);
--- a/browser/themes/gnomestripe/browser.css
+++ b/browser/themes/gnomestripe/browser.css
@@ -1004,20 +1004,16 @@ toolbar[iconsize="small"] #feed-button {
 .verifiedDomain > #page-proxy-favicon[pageproxystate="valid"] {
   list-style-image: url(chrome://browser/skin/identity-icons-https.png);
 }
 
 .verifiedIdentity > #page-proxy-favicon[pageproxystate="valid"] {
   list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
 }
 
-.mixedContent > #page-proxy-favicon[pageproxystate="valid"] {
-  list-style-image: url(chrome://browser/skin/identity-icons-https-mixed.png);
-}
-
 #identity-box:hover > #page-proxy-favicon {
   -moz-image-region: rect(0, 32px, 16px, 16px);
 }
 
 #identity-box:hover:active > #page-proxy-favicon,
 #identity-box[open=true] > #page-proxy-favicon {
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
--- a/browser/themes/gnomestripe/devtools/debugger.css
+++ b/browser/themes/gnomestripe/devtools/debugger.css
@@ -163,16 +163,26 @@
   content: " ";
   display: inline-block;
   width: 16px;
   height: 16px;
   background: url("chrome://browser/skin/identity-icons-https.png") no-repeat;
   opacity: 0.5;
 }
 
+#element-tooltip > label {
+  margin: 0 2px 0 2px;
+}
+
+#element-tooltip > label[non-enumerable],
+#element-tooltip > label[non-configurable],
+#element-tooltip > label[non-writable]{
+  text-decoration: line-through;
+}
+
 /**
  * Property values colors
  */
 
 .token-undefined {
   -moz-padding-start: 6px;
   color: #bbb;
 }
deleted file mode 100644
index 23890a82faf4d3590c8bbf834a210915545afb4d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/gnomestripe/jar.mn
+++ b/browser/themes/gnomestripe/jar.mn
@@ -21,17 +21,16 @@ browser.jar:
 * skin/classic/browser/engineManager.css              (engineManager.css)
   skin/classic/browser/Geolocation-16.png
   skin/classic/browser/Geolocation-64.png
   skin/classic/browser/Go-arrow.png
   skin/classic/browser/identity.png
   skin/classic/browser/identity-icons-generic.png
   skin/classic/browser/identity-icons-https.png
   skin/classic/browser/identity-icons-https-ev.png
-  skin/classic/browser/identity-icons-https-mixed.png
   skin/classic/browser/Info.png
   skin/classic/browser/KUI-close.png
   skin/classic/browser/monitor.png
   skin/classic/browser/monitor_16-10.png
 * skin/classic/browser/pageInfo.css
   skin/classic/browser/pageInfo.png
   skin/classic/browser/page-livemarks.png
   skin/classic/browser/Privacy-16.png
--- a/browser/themes/pinstripe/browser.css
+++ b/browser/themes/pinstripe/browser.css
@@ -1061,20 +1061,16 @@ toolbar[mode="icons"] #zoom-in-button {
 .verifiedDomain > #page-proxy-favicon[pageproxystate="valid"] {
   list-style-image: url(chrome://browser/skin/identity-icons-https.png);
 }
 
 .verifiedIdentity > #page-proxy-favicon[pageproxystate="valid"] {
   list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
 }
 
-.mixedContent > #page-proxy-favicon[pageproxystate="valid"] {
-  list-style-image: url(chrome://browser/skin/identity-icons-https-mixed.png);
-}
-
 #identity-box:hover:active > #page-proxy-favicon,
 #identity-box[open=true] > #page-proxy-favicon {
   -moz-image-region: rect(0, 32px, 16px, 16px);
 }
 
 #page-proxy-favicon[pageproxystate="invalid"] {
   opacity: 0.3;
 }
--- a/browser/themes/pinstripe/devtools/debugger.css
+++ b/browser/themes/pinstripe/devtools/debugger.css
@@ -165,16 +165,26 @@
   content: " ";
   display: inline-block;
   width: 16px;
   height: 16px;
   background: url("chrome://browser/skin/identity-icons-https.png") no-repeat;
   opacity: 0.5;
 }
 
+#element-tooltip > label {
+  margin: 0 2px 0 2px;
+}
+
+#element-tooltip > label[non-enumerable],
+#element-tooltip > label[non-configurable],
+#element-tooltip > label[non-writable]{
+  text-decoration: line-through;
+}
+
 /**
  * Property values colors
  */
 
 .token-undefined {
   -moz-padding-start: 6px;
   color: #bbb;
 }
deleted file mode 100644
index caf6097c40a068748063798fa116735d633d20e3..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/pinstripe/jar.mn
+++ b/browser/themes/pinstripe/jar.mn
@@ -27,17 +27,16 @@ browser.jar:
   skin/classic/browser/hud-style-expander-closed.png
   skin/classic/browser/hud-style-expander-open.png
   skin/classic/browser/hud-style-new-folder-plus-sign.png
   skin/classic/browser/hud-style-twisties.png
   skin/classic/browser/identity.png
   skin/classic/browser/identity-icons-generic.png
   skin/classic/browser/identity-icons-https.png
   skin/classic/browser/identity-icons-https-ev.png
-  skin/classic/browser/identity-icons-https-mixed.png
   skin/classic/browser/Info.png
   skin/classic/browser/KUI-background.png
   skin/classic/browser/KUI-close.png
   skin/classic/browser/menu-back.png
   skin/classic/browser/menu-forward.png
   skin/classic/browser/page-livemarks.png
   skin/classic/browser/pageInfo.css
   skin/classic/browser/Privacy-16.png
--- a/browser/themes/winstripe/browser.css
+++ b/browser/themes/winstripe/browser.css
@@ -703,17 +703,18 @@ toolbar[mode=full] .toolbarbutton-1 > .t
   -moz-transition-duration: 150ms;
 }
 
 @navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-icon,
 @navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
   padding: 3px 7px;
 }
 
-@navbarLargeIcons@ .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button) > .toolbarbutton-icon {
+@navbarLargeIcons@ .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button) > .toolbarbutton-icon,
+@navbarLargeIcons@ .toolbarbutton-1[type=menu] > .toolbarbutton-text /* hack for add-ons that forcefully display the label */ {
   -moz-padding-end: 17px;
 }
 
 @navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menu-dropmarker {
   -moz-margin-start: -15px;
 }
 
 @navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
@@ -1440,20 +1441,16 @@ html|*.urlbar-input:-moz-lwtheme:-moz-pl
 .verifiedDomain > #page-proxy-favicon[pageproxystate="valid"] {
   list-style-image: url(chrome://browser/skin/identity-icons-https.png);
 }
 
 .verifiedIdentity > #page-proxy-favicon[pageproxystate="valid"] {
   list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
 }
 
-.mixedContent > #page-proxy-favicon[pageproxystate="valid"] {
-  list-style-image: url(chrome://browser/skin/identity-icons-https-mixed.png);
-}
-
 #identity-box:hover > #page-proxy-favicon {
   -moz-image-region: rect(0, 32px, 16px, 16px);
 }
 
 #identity-box:hover:active > #page-proxy-favicon,
 #identity-box[open=true] > #page-proxy-favicon {
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
--- a/browser/themes/winstripe/devtools/debugger.css
+++ b/browser/themes/winstripe/devtools/debugger.css
@@ -163,16 +163,26 @@
   content: " ";
   display: inline-block;
   width: 16px;
   height: 16px;
   background: url("chrome://browser/skin/identity-icons-https.png") no-repeat;
   opacity: 0.5;
 }
 
+#element-tooltip > label {
+  margin: 0 2px 0 2px;
+}
+
+#element-tooltip > label[non-enumerable],
+#element-tooltip > label[non-configurable],
+#element-tooltip > label[non-writable]{
+  text-decoration: line-through;
+}
+
 /**
  * Property values colors
  */
 
 .token-undefined {
   -moz-padding-start: 6px;
   color: #bbb;
 }
deleted file mode 100644
index 23890a82faf4d3590c8bbf834a210915545afb4d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/winstripe/jar.mn
+++ b/browser/themes/winstripe/jar.mn
@@ -27,17 +27,16 @@ browser.jar:
         skin/classic/browser/Geolocation-64.png
         skin/classic/browser/webapps-16.png
         skin/classic/browser/webapps-64.png
         skin/classic/browser/Info.png                                (Info.png)
         skin/classic/browser/identity.png                            (identity.png)
         skin/classic/browser/identity-icons-generic.png
         skin/classic/browser/identity-icons-https.png
         skin/classic/browser/identity-icons-https-ev.png
-        skin/classic/browser/identity-icons-https-mixed.png
         skin/classic/browser/keyhole-forward-mask.svg
         skin/classic/browser/KUI-background.png
         skin/classic/browser/KUI-close.png
         skin/classic/browser/pageInfo.css
         skin/classic/browser/pageInfo.png                            (pageInfo.png)
         skin/classic/browser/page-livemarks.png                      (feeds/feedIcon16.png)
         skin/classic/browser/livemark-folder.png                     (livemark-folder.png)
         skin/classic/browser/Privacy-16.png
@@ -225,17 +224,16 @@ browser.jar:
         skin/classic/aero/browser/Geolocation-64.png
         skin/classic/aero/browser/webapps-16.png
         skin/classic/aero/browser/webapps-64.png
         skin/classic/aero/browser/Info.png                           (Info-aero.png)
         skin/classic/aero/browser/identity.png                       (identity-aero.png)
         skin/classic/aero/browser/identity-icons-generic.png
         skin/classic/aero/browser/identity-icons-https.png
         skin/classic/aero/browser/identity-icons-https-ev.png
-        skin/classic/aero/browser/identity-icons-https-mixed.png
         skin/classic/aero/browser/keyhole-forward-mask.svg
         skin/classic/aero/browser/KUI-background.png
         skin/classic/aero/browser/KUI-close.png
         skin/classic/aero/browser/pageInfo.css
         skin/classic/aero/browser/pageInfo.png                       (pageInfo-aero.png)
         skin/classic/aero/browser/page-livemarks.png                 (feeds/feedIcon16-aero.png)
         skin/classic/aero/browser/livemark-folder.png                (livemark-folder-aero.png)
         skin/classic/aero/browser/Privacy-16.png                     (Privacy-16-aero.png)
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -93,16 +93,17 @@ case "$target" in
         if test -d "$android_platform" ; then
             AC_MSG_RESULT([$android_platform])
         else
             AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
         fi
     fi
 
     dnl set up compilers
+    TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
     AS="$android_toolchain"/bin/"$android_tool_prefix"-as
     CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
     CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
     CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
     LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
     AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
     RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
     STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
--- a/build/mobile/sutagent/android/DoCommand.java
+++ b/build/mobile/sutagent/android/DoCommand.java
@@ -100,17 +100,17 @@ public class DoCommand {
 
     String    currentDir = "/";
     String    sErrorPrefix = "##AGENT-WARNING## ";
     boolean bTraceOn = false;
 
     String ffxProvider = "org.mozilla.ffxcp";
     String fenProvider = "org.mozilla.fencp";
 
-    private final String prgVersion = "SUTAgentAndroid Version 1.08";
+    private final String prgVersion = "SUTAgentAndroid Version 1.09";
 
     public enum Command
         {
         RUN ("run"),
         EXEC ("exec"),
         EXECCWD ("execcwd"),
         ENVRUN ("envrun"),
         KILL ("kill"),
@@ -157,16 +157,17 @@ public class DoCommand {
         QUIT ("quit"),
         EXIT ("exit"),
         HELP ("help"),
         FTPG ("ftpg"),
         FTPP ("ftpp"),
         INST ("inst"),
         UPDT ("updt"),
         UNINST ("uninst"),
+        UNINSTALL ("uninstall"),
         TEST ("test"),
         DBG ("dbg"),
         TRACE ("trace"),
         VER ("ver"),
         TZGET ("tzget"),
         TZSET ("tzset"),
         ADB ("adb"),
         CHMOD ("chmod"),
@@ -351,19 +352,26 @@ public class DoCommand {
                 if (Argc >= 2)
                     strReturn = InstallApp(Argv[1], cmdOut);
                 else
                     strReturn = sErrorPrefix + "Wrong number of arguments for inst command!";
                 break;
 
             case UNINST:
                 if (Argc >= 2)
-                    strReturn = UnInstallApp(Argv[1], cmdOut);
+                    strReturn = UnInstallApp(Argv[1], cmdOut, true);
                 else
-                    strReturn = sErrorPrefix + "Wrong number of arguments for inst command!";
+                    strReturn = sErrorPrefix + "Wrong number of arguments for uninst command!";
+                break;
+
+            case UNINSTALL:
+                if (Argc >= 2)
+                    strReturn = UnInstallApp(Argv[1], cmdOut, false);
+                else
+                    strReturn = sErrorPrefix + "Wrong number of arguments for uninstall command!";
                 break;
 
             case ALRT:
                 if (Argc > 1)
                     {
                     if (Argv[1].contentEquals("on"))
                         {
                         String sTitle = "Agent Alert";
@@ -3110,23 +3118,27 @@ private void CancelNotification()
         theArgs[0] = "su";
         theArgs[1] = "-c";
         // as a security measure, ICS and later resets LD_LIBRARY_PATH. reset
         // it here when executing the command
         theArgs[2] = "LD_LIBRARY_PATH=/vendor/lib:/system/lib " + cmdString;
         return theArgs;
         }
 
-    public String UnInstallApp(String sApp, OutputStream out)
+    public String UnInstallApp(String sApp, OutputStream out, boolean reboot)
         {
         String sRet = "";
 
         try
             {
-            pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";reboot;exit"));
+            if (reboot == true) {
+                pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";reboot;exit"));
+            } else {
+                pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";exit"));
+            }
 
             RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
             outThrd.start();
             try {
                 outThrd.join(60000);
                 int nRet = pProc.exitValue();
                 sRet = "\nuninst complete [" + nRet + "]";
                 }
@@ -3757,17 +3769,18 @@ private void CancelNotification()
             "mems                         - dump memory stats\n" +
             "ls                           - print directory\n" +
             "tmpd                         - print temp directory\n" +
             "ping [hostname/ipaddr]       - ping a network device\n" +
             "unzp zipfile destdir         - unzip the zipfile into the destination dir\n" +
             "zip zipfile src              - zip the source file/dir into zipfile\n" +
             "rebt                         - reboot device\n" +
             "inst /path/filename.apk      - install the referenced apk file\n" +
-            "uninst packagename           - uninstall the referenced package\n" +
+            "uninst packagename           - uninstall the referenced package and reboot\n" +
+            "uninstall packagename        - uninstall the referenced package without a reboot\n" +
             "updt pkgname pkgfile         - unpdate the referenced package\n" +
             "clok                         - the current device time expressed as the" +
             "                               number of millisecs since epoch\n" +
             "settime date time            - sets the device date and time\n" +
             "                               (YYYY/MM/DD HH:MM:SS)\n" +
             "tzset timezone               - sets the device timezone format is\n" +
             "                               GMTxhh:mm x = +/- or a recognized Olsen string\n" +
             "tzget                        - returns the current timezone set on the device\n" +
index 6e2c29365d412863dd306008cbd15e6bcd47ce79..b9ffd6124060606a373c7ce5ee53d911582298ae
GIT binary patch
literal 65536
zc%1Fsc|26>{{ZkaXU3i)Yh_E67SlO13=@$nx=Kka+U{U5jG1Z1SVP$&QKY1<NLu73
zl1jU-Rw`}!cBS>UTxD%{i{Ff?P^fRO-%H;=K5wt{nmOk@^PJ~7^LZY}AI}FOt;RqQ
z1Vs?iRRozNdW#H15CS6E5ZRA!(2uXgj@OP;h_?9sdQSL5L<0S|^*dR@&$uc800000
z00000000000000000000000000000000000000000Pz1uA9-W_()yA0Zfk*cyVX6b
ztyWa4{T90{A}w4kV(B6DMfAz^U^9O+d$SQ{&9n!!Vp=@ygXwBhPwEuvQA#dlC51z&
z#n<7rcsl?900000000000000000000000000000000000_;1M)#s95Q13`G+Ts;Ak
zAIRkEc`*3_EH9P^BY=q@{s@9%zPJIVFHM|FQcxK-lh5^Hv6*^Pge*^{r=AlpfaT8$
zWdyLe99$Dq7nhP(88n?6%3`w_dUKe902ap^H^N4W&k$8~=P><wTt0&zqG#KA9X%Ui
zfDf0?3J4)$>bNR4SW;Ml8O-qKv6*BKuD>jbAez0MM0;tzq<aGqgemY~@R*E%0EUMj
zMbujaQPzx@-oG6i`l%YC%Ala2AhJ8d)7V=W($P5rg4mKKktU&v$UrO#mBXS4{A?mh
zKv9xjyn-91C@nW8?$@|CiUfj`6w;sV#&k3kF*-)Y%_$g_YKpsQDB@jrF(Z5=X3$aB
z0BuRPIDWXeQ^*&c#8zZ=?FT^$A+AV5uoVgDiWSJYXS)n1B_qh$MJEdN(+1x*igCD*
zn{-v^t6D%_z}vO7Hu+|=w)vGqYg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~pHWWceD--zUi9@X`H
zv2~1xt(r2^5z3Flugm(uizb^o-6u0t<wJ&_DGG-==;G5DZUQrB@?%E1h9j8mm}#!c
k37=Z`^|@!S>i+6GoHooom2R4grj+yw5*T)6+RA|c4Ust7rvLx|
--- a/build/pgo/server-locations.txt
+++ b/build/pgo/server-locations.txt
@@ -30,19 +30,20 @@
 # elevated privileges; the default is no privileges.
 #
 # "nocert" makes sense only for https:// hosts and means there is not
 # any certificate automatically generated for this host.
 #
 # "cert=nickname" tells the pgo server to use a particular certificate
 # for this host. The certificate is referenced by its nickname that must
 # not contain any spaces. The certificate  key files (PKCS12 modules)
-# for custom certification are loaded from build/pgo/ssltunnel/certs
+# for custom certification are loaded from build/pgo/certs
 # directory. When new certificate is added to this dir pgo/ssltunnel
-# must be builded then.
+# must be built then. This is only necessary for cases where we really do
+# want specific certs.
 #
 # "redir=hostname" tells the pgo server is only used for https://
 # hosts while processing the CONNECT tunnel request. It responds
 # to the CONNECT with a 302 and redirection to the hostname instead
 # of connecting to the real back end and replying with a 200. This
 # mode exists primarily to ensure we don't allow a proxy to do that.
 #
 
@@ -156,8 +157,45 @@ https://www.bank2.com:443           priv
 #
 https://redirproxy.example.com:443          privileged,redir=test1.example.com
 
 # Host used for IndexedDB Quota testing
 http://bug704464-1.example.com:80        privileged
 http://bug704464-2.example.com:80        privileged
 http://bug704464-3.example.com:80        privileged
 http://bug702292.example.com:80          privileged
+
+# W3C hosts.
+# See http://www.w3.org/wiki/Testing/Requirements#The_Web_test_server_must_be_available_through_different_domain_names
+http://w3c-test.org:80
+http://w3c-test.org:81
+http://w3c-test.org:82
+http://w3c-test.org:83
+http://www.w3c-test.org:80
+http://www.w3c-test.org:81
+http://www.w3c-test.org:82
+http://www.w3c-test.org:83
+http://www1.w3c-test.org:80
+http://www1.w3c-test.org:81
+http://www1.w3c-test.org:82
+http://www1.w3c-test.org:83
+http://www2.w3c-test.org:80
+http://www2.w3c-test.org:81
+http://www2.w3c-test.org:82
+http://www2.w3c-test.org:83
+# http://天気の良い日.w3c-test.org
+http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:80
+http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:81
+http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:82
+http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:83
+# http://élève.w3c-test.org
+http://xn--lve-6lad.w3c-test.org:80
+http://xn--lve-6lad.w3c-test.org:81
+http://xn--lve-6lad.w3c-test.org:82
+http://xn--lve-6lad.w3c-test.org:83
+# HTTPS versions of the above
+https://w3c-test.org:443
+https://www.w3c-test.org:443
+https://www1.w3c-test.org:443
+https://www2.w3c-test.org:443
+https://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:443
+https://xn--lve-6lad.w3c-test.org:443
+http://test.w3.org:80
old mode 100644
new mode 100755
--- a/build/unix/build-clang/build-clang.py
+++ b/build/unix/build-clang/build-clang.py
@@ -8,16 +8,17 @@ moz_version = "moz0"
 
 ##############################################
 
 import os
 import os.path
 import shutil
 import tarfile
 import subprocess
+import platform
 
 def check_run(args):
     r = subprocess.call(args)
     assert r == 0
 
 def run_in(path, args):
     d = os.getcwd()
     os.chdir(path)
@@ -41,18 +42,17 @@ def with_env(env, f):
     old_env = os.environ.copy()
     os.environ.update(env)
     f()
     os.environ.clear()
     os.environ.update(old_env)
 
 def build_tar_package(tar, name, base, directory):
     name = os.path.realpath(name)
-    run_in(base, [tar, "-cjf", name, "--mtime=2012-01-01", "--owner=root",
-                  directory])
+    run_in(base, [tar, "-cjf", name, directory])
 
 def svn_co(url, directory, revision):
     check_run(["svn", "co", "-r", revision, url, directory])
 
 # The directories end up in the debug info, so the easy way of getting
 # a reproducible build is to run it in a know absolute directory.
 # We use a directory in /builds/slave because the mozilla infrastructure
 # cleans it up automatically.
@@ -69,47 +69,68 @@ def build_one_stage(env, stage_dir, is_s
     def f():
         build_one_stage_aux(stage_dir, is_stage_one)
     with_env(env, f)
 
 def build_one_stage_aux(stage_dir, is_stage_one):
     os.mkdir(stage_dir)
 
     build_dir = stage_dir + "/build"
-    inst_dir = stage_dir + "/inst"
+    inst_dir = stage_dir + "/clang"
 
     configure_opts = ["--enable-optimized",
                       "--prefix=%s" % inst_dir,
                       "--with-gcc-toolchain=/tools/gcc-4.5-0moz3"]
     if is_stage_one:
         configure_opts.append("--with-optimize-option=-O0")
 
     build_package(llvm_source_dir, build_dir, configure_opts)
 
+isDarwin = platform.system() == "Darwin"
+
 if not os.path.exists(source_dir):
     os.makedirs(source_dir)
     svn_co("http://llvm.org/svn/llvm-project/llvm/trunk",
            llvm_source_dir, llvm_revision)
     svn_co("http://llvm.org/svn/llvm-project/cfe/trunk",
            clang_source_dir, llvm_revision)
     svn_co("http://llvm.org/svn/llvm-project/compiler-rt/trunk",
            compiler_rt_source_dir, llvm_revision)
     os.symlink("../../clang", llvm_source_dir + "/tools/clang")
     os.symlink("../../compiler-rt", llvm_source_dir + "/projects/compiler-rt")
-    patch("old-ld-hack.patch", 1, llvm_source_dir)
-    patch("compiler-rt-gnu89-inline.patch", 0, compiler_rt_source_dir)
+    if isDarwin:
+        patch("clang-no-ios.patch", 0, clang_source_dir)
+        patch("compiler-rt-no-ios.patch", 0, compiler_rt_source_dir)
+    else:
+        patch("old-ld-hack.patch", 1, llvm_source_dir)
+        patch("compiler-rt-gnu89-inline.patch", 0, compiler_rt_source_dir)
 
 if os.path.exists(build_dir):
     shutil.rmtree(build_dir)
 os.makedirs(build_dir)
 
 stage1_dir = build_dir + '/stage1'
 stage1_inst_dir = stage1_dir + '/clang'
-build_one_stage({"CC"  : "/tools/gcc-4.5-0moz3/bin/gcc -static-libgcc",
-                 "CXX" : "/tools/gcc-4.5-0moz3/bin/g++ -static-libgcc -static-libstdc++"},
+
+if isDarwin:
+    extra_cflags = ""
+    extra_cxxflags = ""
+    cc = "/usr/bin/clang"
+    cxx = "/usr/bin/clang++"
+else:
+    extra_cflags = "-static-libgcc"
+    extra_cxxflags = "-static-libgcc -static-libstdc++"
+    cc = "/tools/gcc-4.5-0moz3/bin/gcc %s" % extra_cflags
+    cxx = "/tools/gcc-4.5-0moz3/bin/g++ %s" % extra_cxxflags
+
+build_one_stage({"CC"  : cc,
+                 "CXX" : cxx },
                 stage1_dir, True)
 
+if not isDarwin:
+    extra_cflags += " -fgnu89-inline"
+
 stage2_dir = build_dir + '/stage2'
-build_one_stage({"CC"  : stage1_inst_dir + "/bin/clang -static-libgcc -fgnu89-inline",
-                 "CXX" : stage1_inst_dir + "/bin/clang++ -static-libgcc -static-libstdc++"},
+build_one_stage({"CC"  : stage1_inst_dir + "/bin/clang %s" % extra_cflags,
+                 "CXX" : stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
                 stage2_dir, False)
 
-build_tar_package("/bin/tar", "clang.tar.bz2", stage3_dir, "clang")
+build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
new file mode 100644
--- /dev/null
+++ b/build/unix/build-clang/clang-no-ios.patch
@@ -0,0 +1,15 @@
+Index: runtime/compiler-rt/Makefile
+===================================================================
+--- runtime/compiler-rt/Makefile	(revision 157958)
++++ runtime/compiler-rt/Makefile	(working copy)
+@@ -74,8 +74,8 @@
+ ifeq ($(OS),Darwin)
+ RuntimeDirs += darwin
+ RuntimeLibrary.darwin.Configs := \
+-	eprintf 10.4 osx ios cc_kext \
+-	asan_osx profile_osx profile_ios
++	eprintf 10.4 osx  \
++	asan_osx profile_osx
+ endif
+ 
+ # On Linux, include a library which has all the runtime functions.
new file mode 100644
--- /dev/null
+++ b/build/unix/build-clang/compiler-rt-no-ios.patch
@@ -0,0 +1,29 @@
+Index: make/platform/clang_darwin.mk
+===================================================================
+--- make/platform/clang_darwin.mk	(revision 157958)
++++ make/platform/clang_darwin.mk	(working copy)
+@@ -47,7 +47,7 @@
+ # Configuration for targetting iOS, for some ARMv6 functions, which must be
+ # in the same linkage unit, and for a couple of other functions that didn't
+ # make it into libSystem.
+-Configs += ios
++#Configs += ios
+ UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv6 armv7,ios)
+ 
+ # Configuration for targetting OSX. These functions may not be in libSystem
+@@ -56,13 +56,13 @@
+ UniversalArchs.osx := $(call CheckArches,i386 x86_64,osx)
+ 
+ # Configuration for use with kernel/kexts.
+-Configs += cc_kext
++#Configs += cc_kext
+ UniversalArchs.cc_kext := $(call CheckArches,armv6 armv7 i386 x86_64,cc_kext)
+ 
+ # Configurations which define the profiling support functions.
+ Configs += profile_osx
+ UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64,profile_osx)
+-Configs += profile_ios
++#Configs += profile_ios
+ UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv6 armv7,profile_ios)
+ 
+ # Configurations which define the ASAN support functions.
new file mode 100644
--- /dev/null
+++ b/build/unix/build-clang/setup.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+rm -rf clang
+tar -xjf clang.tar.bz2
--- a/build/unix/stdc++compat/stdc++compat.cpp
+++ b/build/unix/stdc++compat/stdc++compat.cpp
@@ -21,32 +21,37 @@
 namespace std {
 #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 9)
     /* Instantiate these templates to avoid GLIBCXX_3.4.9 symbol versions */
     template ostream& ostream::_M_insert(double);
     template ostream& ostream::_M_insert(long);
     template ostream& ostream::_M_insert(unsigned long);
     template ostream& ostream::_M_insert(long long);
     template ostream& ostream::_M_insert(unsigned long long);
+    template ostream& ostream::_M_insert(bool);
     template ostream& ostream::_M_insert(const void*);
     template ostream& __ostream_insert(ostream&, const char*, streamsize);
     template istream& istream::_M_extract(double&);
+    template istream& istream::_M_extract(float&);
+    template istream& istream::_M_extract(unsigned int&);
+    template istream& istream::_M_extract(unsigned long&);
 #endif
 #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
     /* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
      * depending on optimization level */
     template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&);
 #ifdef _GLIBCXX_USE_WCHAR_T
     template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
 #endif /* _GLIBCXX_USE_WCHAR_T */
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
     template string::basic_string(string&&);
     template string& string::operator=(string&&);
     template wstring::basic_string(wstring&&);
     template wstring& wstring::operator=(wstring&&);
+    template string& string::assign(string&&);
     template wstring& wstring::assign(wstring&&);
 #endif /* __GXX_EXPERIMENTAL_CXX0X__ */
 #endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
 }
 
 namespace std __attribute__((visibility("default"))) {
 #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
     /* Hack to avoid GLIBCXX_3.4.14 symbol versions */
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -132,16 +132,17 @@ MOZ_MEDIA = @MOZ_MEDIA@
 MOZ_VORBIS = @MOZ_VORBIS@
 MOZ_TREMOR = @MOZ_TREMOR@
 MOZ_NO_THEORA_ASM = @MOZ_NO_THEORA_ASM@
 MOZ_OPUS = @MOZ_OPUS@
 MOZ_WEBM = @MOZ_WEBM@
 MOZ_MEDIA_PLUGINS = @MOZ_MEDIA_PLUGINS@
 MOZ_OMX_PLUGIN = @MOZ_OMX_PLUGIN@
 MOZ_GSTREAMER = @MOZ_GSTREAMER@
+MOZ_VP8 = @MOZ_VP8@
 MOZ_VP8_ERROR_CONCEALMENT = @MOZ_VP8_ERROR_CONCEALMENT@
 MOZ_VP8_ENCODER = @MOZ_VP8_ENCODER@
 VPX_AS = @VPX_AS@
 VPX_ASFLAGS = @VPX_ASFLAGS@
 VPX_DASH_C_FLAG = @VPX_DASH_C_FLAG@
 VPX_AS_CONVERSION = @VPX_AS_CONVERSION@
 VPX_ASM_SUFFIX = @VPX_ASM_SUFFIX@
 VPX_X86_ASM = @VPX_X86_ASM@
@@ -165,16 +166,17 @@ MOZ_DIRECTX_SDK_PATH = @MOZ_DIRECTX_SDK_
 MOZ_DIRECTX_SDK_CPU_SUFFIX = @MOZ_DIRECTX_SDK_CPU_SUFFIX@
 MOZ_D3DX9_VERSION = @MOZ_D3DX9_VERSION@
 MOZ_D3DX9_CAB = @MOZ_D3DX9_CAB@
 MOZ_D3DCOMPILER_CAB = @MOZ_D3DCOMPILER_CAB@
 MOZ_D3DX9_DLL = @MOZ_D3DX9_DLL@
 MOZ_D3DCOMPILER_DLL = @MOZ_D3DCOMPILER_DLL@
 MOZ_GL_PROVIDER = @MOZ_GL_PROVIDER@
 MOZ_GL_DEFAULT_PROVIDER = @MOZ_GL_DEFAULT_PROVIDER@
+MOZ_WEBRTC = @MOZ_WEBRTC@
 
 
 JAVA=@JAVA@
 JAVAC=@JAVAC@
 JAR=@JAR@
 
 TAR=@TAR@
 
@@ -350,16 +352,17 @@ ASM_SUFFIX	= @ASM_SUFFIX@
 IMPORT_LIB_SUFFIX = @IMPORT_LIB_SUFFIX@
 LIBS_DESC_SUFFIX = @LIBS_DESC_SUFFIX@
 USE_N32		= @USE_N32@
 HAVE_64BIT_OS	= @HAVE_64BIT_OS@
 
 CC		    = @CC@
 CXX		    = @CXX@
 CPP       = @CPP@
+TOOLCHAIN_PREFIX = @TOOLCHAIN_PREFIX@
 
 CC_VERSION	= @CC_VERSION@
 CXX_VERSION	= @CXX_VERSION@
 
 GNU_AS		= @GNU_AS@
 GNU_LD		= @GNU_LD@
 GNU_CC		= @GNU_CC@
 GNU_CXX		= @GNU_CXX@
--- a/config/config.mk
+++ b/config/config.mk
@@ -51,16 +51,18 @@ check-variable = $(if $(filter-out 0 1,$
 core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
 core_realpath = $(if $(realpath $(1)),$(realpath $(1)),$(call core_abspath,$(1)))
 
 nullstr :=
 space :=$(nullstr) # EOL
 
 core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
 
+RM = rm -f
+
 # LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
 LIBXUL_DIST ?= $(DIST)
 
 # FINAL_TARGET specifies the location into which we copy end-user-shipped
 # build products (typelibs, components, chrome).
 #
 # If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
 # If DIST_SUBDIR is set, the files will be shipped to $(DIST)/$(DIST_SUBDIR)
@@ -729,18 +731,18 @@ ifdef TIERS
 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
 endif
 
 OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
 
 CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
 
-EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$(basename $(@F)).pp --target $@)
-EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$(basename $(@F)).pp)
+EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp --target $@)
+EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp)
 EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
 EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
 EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
 EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
 EXPAND_MKSHLIB_ARGS = --uselist
 ifdef SYMBOL_ORDER
 EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
 endif
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -281,17 +281,17 @@ HOST_CMOBJS = $(addprefix host_,$(HOST_C
 HOST_CMMOBJS = $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
 ifndef HOST_OBJS
 _HOST_OBJS = $(HOST_COBJS) $(HOST_CCOBJS) $(HOST_CPPOBJS) $(HOST_CMOBJS) $(HOST_CMMOBJS)
 HOST_OBJS = $(strip $(_HOST_OBJS))
 endif
 
 ifndef MOZ_AUTO_DEPS
 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
-MDDEPFILES		= $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
+MDDEPFILES		= $(addprefix $(MDDEPDIR)/,$(OBJS:=.pp))
 ifndef NO_GEN_XPT
 MDDEPFILES		+= $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
 endif
 endif
 endif
 
 ALL_TRASH = \
 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
@@ -628,17 +628,20 @@ include $(topsrcdir)/config/makefiles/ta
 
 ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
 $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
 endif
 
 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
 
 # Dependencies which, if modified, should cause everything to rebuild
-GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
+GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
+ifndef NO_MAKEFILE_RULE
+GLOBAL_DEPS += Makefile.in
+endif
 
 ##############################################
 include $(topsrcdir)/config/makefiles/target_libs.mk
 
 ##############################################
 ifndef NO_PROFILE_GUIDED_OPTIMIZE
 ifdef MOZ_PROFILE_USE
 ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
@@ -1142,26 +1145,30 @@ endif
 	$(JAR) cf $@ -C $(_JAVA_DIR) .
 
 GARBAGE_DIRS += $(_JAVA_DIR)
 
 ###############################################################################
 # Update Makefiles
 ###############################################################################
 
+ifndef NO_MAKEFILE_RULE
 # Note: Passing depth to make-makefile is optional.
 #       It saves the script some work, though.
 Makefile: Makefile.in
 	@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH)
+endif
 
+ifndef NO_SUBMAKEFILES_RULE
 ifdef SUBMAKEFILES
 # VPATH does not work on some machines in this case, so add $(srcdir)
 $(SUBMAKEFILES): % : $(srcdir)/%.in
 	$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $@
 endif
+endif
 
 ifdef AUTOUPDATE_CONFIGURE
 $(topsrcdir)/configure: $(topsrcdir)/configure.in
 	(cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
 endif
 
 $(DEPTH)/config/autoconf.mk: $(topsrcdir)/config/autoconf.mk.in
 	cd $(DEPTH) && CONFIG_HEADERS= CONFIG_FILES=config/autoconf.mk ./config.status
--- a/config/system-headers
+++ b/config/system-headers
@@ -1054,8 +1054,10 @@ ogg/ogg.h
 ogg/os_types.h
 nestegg/nestegg.h
 cubeb/cubeb.h
 #endif
 gst/gst.h
 gst/app/gstappsink.h
 gst/app/gstappsrc.h
 gst/video/video.h
+sys/msg.h
+sys/ipc.h
--- a/configure.in
+++ b/configure.in
@@ -166,16 +166,17 @@ MOZ_ARG_WITH_STRING(gonk-toolchain-prefi
 
 if test -n "$gonkdir" ; then
     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
     android_source="$gonkdir"
     ANDROID_SOURCE="$android_source"
     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
 
     dnl set up compilers
+    TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
     AS="$gonk_toolchain_prefix"as
     CC="$gonk_toolchain_prefix"gcc
     CXX="$gonk_toolchain_prefix"g++
     CPP="$gonk_toolchain_prefix"cpp
     LD="$gonk_toolchain_prefix"ld
     AR="$gonk_toolchain_prefix"ar
     RANLIB="$gonk_toolchain_prefix"ranlib
     STRIP="$gonk_toolchain_prefix"strip
@@ -490,17 +491,17 @@ case "$target" in
 
         AC_LANG_CPLUSPLUS
         AC_TRY_COMPILE([#include <new.h>],
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
-        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
+        _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
         # Determine compiler version
         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
@@ -517,28 +518,32 @@ case "$target" in
             dnl Require VC8SP1 or newer.
             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
             if test "$_CC_RELEASE" -lt 50727 -o \
                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
             fi
 
             _CC_SUITE=8
+            _MSVS_VERSION=2005
             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
         elif test "$_CC_MAJOR_VERSION" = "15"; then
             _CC_SUITE=9
+            _MSVS_VERSION=2008
             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         elif test "$_CC_MAJOR_VERSION" = "16"; then
             _CC_SUITE=10
+            _MSVS_VERSION=2010
             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         elif test "$_CC_MAJOR_VERSION" = "17"; then
             _CC_SUITE=11
+            _MSVS_VERSION=2011
             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         else
             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
         fi
 
         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
 
@@ -562,17 +567,17 @@ case "$target" in
         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
         dnl not something else like "magnetic tape manipulation utility".
         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
         if test -z "$MSMT_TOOL"; then
           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
         fi
 
         changequote(,)
-        _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
+        _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
         changequote([,])
         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
         if test -z "$MSMANIFEST_TOOL_VERSION"; then
           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
         fi
 
         MSMANIFEST_TOOL=1
         unset MSMT_TOOL
@@ -4245,19 +4250,22 @@ MOZ_SYDNEYAUDIO=
 MOZ_SPEEX_RESAMPLER=1
 MOZ_CUBEB=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_MEDIA=
 MOZ_OPUS=1
 MOZ_WEBM=1
+MOZ_WEBRTC=
+MOZ_WEBRTC_SIGNALING=
 MOZ_MEDIA_PLUGINS=
 MOZ_MEDIA_NAVIGATOR=
 MOZ_OMX_PLUGIN=
+MOZ_VP8=
 MOZ_VP8_ERROR_CONCEALMENT=
 MOZ_VP8_ENCODER=
 VPX_AS=
 VPX_ASFLAGS=
 VPX_AS_DASH_C_FLAG=
 VPX_AS_CONVERSION=
 VPX_ASM_SUFFIX=
 VPX_X86_ASM=
@@ -5267,16 +5275,35 @@ MOZ_ARG_DISABLE_BOOL(printing,
     NS_PRINTING=1)
 
 if test "$NS_PRINTING"; then
     AC_DEFINE(NS_PRINTING)
     AC_DEFINE(NS_PRINT_PREVIEW)
 fi
 
 dnl ========================================================
+dnl = Enable WebRTC code
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(webrtc,
+[  --enable-webrtc        Enable support for WebRTC],
+    MOZ_WEBRTC=1,
+    MOZ_WEBRTC=)
+
+if test -n "$MOZ_WEBRTC"; then
+    AC_DEFINE(MOZ_WEBRTC)
+    MOZ_MEDIA=1
+    MOZ_RAW=1
+    MOZ_VP8=1
+    MOZ_VP8_ENCODER=1
+    MOZ_VP8_ERROR_CONCEALMENT=1
+fi
+
+AC_SUBST(MOZ_WEBRTC)
+
+dnl ========================================================
 dnl = Enable Raw Codecs
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(raw,
 [  --enable-raw           Enable support for RAW media],
     MOZ_RAW=1,
     MOZ_RAW=)
 
 if test -n "$MOZ_RAW"; then
@@ -5341,16 +5368,21 @@ MOZ_ARG_DISABLE_BOOL(opus,
 dnl ========================================================
 dnl = Disable VP8 decoder support
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(webm,
 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
     MOZ_WEBM=,
     MOZ_WEBM=1)
 
+if test -n "$MOZ_WEBM"; then
+    AC_DEFINE(MOZ_WEBM)
+    MOZ_VP8=1
+fi;
+
 dnl ========================================================
 dnl = Disable media plugin support
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(media-plugins,
 [  --enable-media-plugins  Enable support for media plugins],
     MOZ_MEDIA_PLUGINS=1,
     MOZ_MEDIA_PLUGINS=)
 
@@ -5392,18 +5424,18 @@ dnl system libvpx Support
 dnl ========================================================
 MOZ_ARG_WITH_BOOL(system-libvpx,
 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
     MOZ_NATIVE_LIBVPX=1)
 
 MOZ_LIBVPX_INCLUDES=
 MOZ_LIBVPX_LIBS=
 
-if test -n "$MOZ_WEBM"; then
-    AC_DEFINE(MOZ_WEBM)
+if test -n "$MOZ_VP8"; then
+    AC_DEFINE(MOZ_VP8)
     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
     fi
     if test -n "$MOZ_VP8_ENCODER" ; then
         AC_DEFINE(MOZ_VP8_ENCODER)
     fi
 
     if test -n "$MOZ_NATIVE_LIBVPX"; then
@@ -5420,29 +5452,31 @@ if test -n "$MOZ_WEBM"; then
          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
     fi
 fi
 
 AC_SUBST(MOZ_NATIVE_LIBVPX)
 AC_SUBST(MOZ_LIBVPX_INCLUDES)
 AC_SUBST(MOZ_LIBVPX_LIBS)
 
-if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
+if test "$MOZ_WEBM"; then
     MOZ_SYDNEYAUDIO=1
     MOZ_CUBEB=1
     MOZ_MEDIA=1
     case "$target_cpu" in
     arm*)
         MOZ_TREMOR=1
     ;;
     *)
         MOZ_VORBIS=1
     ;;
     esac
-
+fi
+
+if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
 
     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
     dnl We currently require gcc on all arm platforms.
     VPX_AS=$YASM
     VPX_ASM_SUFFIX=asm
     VPX_NEED_OBJ_INT_EXTRACT=
 
@@ -7724,17 +7758,17 @@ MOZ_ARG_DISABLE_BOOL(md,
      _cpp_md_flag=1
    fi
   dnl Default is to use -xM if using Sun Studio on Solaris
    if test "$SOLARIS_SUNPRO_CC"; then
      _cpp_md_flag=1
    fi])
 if test "$_cpp_md_flag"; then
   COMPILER_DEPEND=1
-  _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
+  _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
   if test "$SOLARIS_SUNPRO_CC"; then
     _DEPEND_CFLAGS=
   fi
 else
   COMPILER_DEPEND=
   dnl Don't override this for MSVC
   if test -z "$_WIN32_MSVC"; then
@@ -8294,16 +8328,17 @@ AC_SUBST(MOZ_ETW)
 AC_SUBST(MOZ_PROFILING)
 AC_SUBST(LIBICONV)
 AC_SUBST(MOZ_PLACES)
 AC_SUBST(MOZ_TOOLKIT_SEARCH)
 AC_SUBST(MOZ_FEEDS)
 AC_SUBST(NS_PRINTING)
 AC_SUBST(MOZ_WEBGL)
 AC_SUBST(MOZ_HELP_VIEWER)
+AC_SUBST(TOOLCHAIN_PREFIX)
 
 AC_SUBST(JAVA)
 AC_SUBST(JAVAC)
 AC_SUBST(JAR)
 
 AC_SUBST(MOZ_PROFILELOCKING)
 
 AC_SUBST(ENABLE_TESTS)
@@ -8438,17 +8473,16 @@ AC_SUBST(MAR_CHANNEL_ID)
 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
 AC_SUBST(MOZ_PROFILE_MIGRATOR)
 AC_SUBST(MOZ_EXTENSION_MANAGER)
 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
 AC_SUBST(MOZ_APP_UA_NAME)
 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
 AC_SUBST(MOZ_APP_VERSION)
 AC_SUBST(MOZ_APP_MAXVERSION)
-AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
 AC_SUBST(FIREFOX_VERSION)
 
 # We can't use the static application.ini data when building against
 # a libxul SDK.
 if test -n "$LIBXUL_SDK"; then
     MOZ_APP_STATIC_INI=
 fi
@@ -8595,16 +8629,17 @@ AC_SUBST(MOZ_WAVE)
 AC_SUBST(MOZ_VORBIS)
 AC_SUBST(MOZ_TREMOR)
 AC_SUBST(MOZ_OPUS)
 AC_SUBST(MOZ_WEBM)
 AC_SUBST(MOZ_MEDIA_PLUGINS)
 AC_SUBST(MOZ_OMX_PLUGIN)
 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
 AC_SUBST(MOZ_VP8_ENCODER)
+AC_SUBST(MOZ_VP8)
 AC_SUBST(MOZ_OGG)
 AC_SUBST(MOZ_ALSA_LIBS)
 AC_SUBST(MOZ_ALSA_CFLAGS)
 AC_SUBST(VPX_AS)
 AC_SUBST(VPX_ASFLAGS)
 AC_SUBST(VPX_DASH_C_FLAG)
 AC_SUBST(VPX_AS_CONVERSION)
 AC_SUBST(VPX_ASM_SUFFIX)
@@ -8872,16 +8907,62 @@ fi
 rm conftest.sh
 
 echo $MAKEFILES > unallmakefiles
 
 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
 
 AC_OUTPUT($MAKEFILES)
 
+# Generate Makefiles for WebRTC directly from .gyp files
+if test "${OS_TARGET}" = "WINNT"; then
+   if test "$HAVE_64BIT_OS"; then
+      OS_BITS=64
+   else
+      OS_BITS=32
+   fi
+   EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
+fi
+
+if test -n "$MOZ_WEBRTC"; then
+   AC_MSG_RESULT("generating WebRTC Makefiles...")
+
+   GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
+
+   $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+     $GYP_WEBRTC_OPTIONS \
+     --generator-output=${_objdir}/media/webrtc/trunk \
+     ${srcdir}/media/webrtc/trunk/peerconnection.gyp
+   if test "$?" != 0; then
+      AC_MSG_ERROR([failed to generate WebRTC Makefiles])
+   fi
+
+   # XXX disable until we land the tranche with signaling
+   if test -n "$MOZ_WEBRTC_SIGNALING"; then
+     AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
+     $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+       $GYP_WEBRTC_OPTIONS \
+       --generator-output=${_objdir}/media/webrtc/signaling \
+       ${srcdir}/media/webrtc/signaling/signaling.gyp
+     if test "$?" != 0; then
+        AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
+     fi
+   fi
+
+   AC_MSG_RESULT("generating gtest Makefiles...")
+   # Ok to pass some extra -D's that are ignored here
+   $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+     $GYP_WEBRTC_OPTIONS \
+     --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
+     ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
+   if test "$?" != 0; then
+      AC_MSG_ERROR([failed to generate gtest Makefiles])
+   fi
+fi
+
 # Populate the virtualenv
 AC_MSG_RESULT([Populating Python virtualenv])
 $MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET=  || exit 1
 
 # Generate a JSON config file for unittest harnesses etc to read
 # build configuration details from in a standardized way.
 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -260,9 +260,15 @@ NS_DEFINE_STATIC_IID_ACCESSOR(Element, N
 } // namespace mozilla
 
 inline mozilla::dom::Element* nsINode::AsElement()
 {
   MOZ_ASSERT(IsElement());
   return static_cast<mozilla::dom::Element*>(this);
 }
 
+inline const mozilla::dom::Element* nsINode::AsElement() const
+{
+  MOZ_ASSERT(IsElement());
+  return static_cast<const mozilla::dom::Element*>(this);
+}
+
 #endif // mozilla_dom_Element_h__
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -2041,17 +2041,19 @@ public:
    * @param aRoot           Root <input> or <textarea> element
    * @param aOutStartOffset Output start offset
    * @param aOutEndOffset   Output end offset
    */
   static void GetSelectionInTextControl(mozilla::Selection* aSelection,
                                         Element* aRoot,
                                         PRInt32& aOutStartOffset,
                                         PRInt32& aOutEndOffset);
-  
+
+  static nsIEditor* GetHTMLEditor(nsPresContext* aPresContext);
+
 private:
   static bool InitializeEventTable();
 
   static nsresult EnsureStringBundle(PropertiesFile aFile);
 
   static bool CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
                                 nsIPrincipal* aPrincipal);
 
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -246,16 +246,74 @@ public:
    * the term, i.e. not in an XHTML/XML document).
    */
   inline bool IsInHTMLDocument() const
   {
     return OwnerDoc()->IsHTML();
   }
 
   /**
+   * Get the namespace that this element's tag is defined in
+   * @return the namespace
+   */
+  inline PRInt32 GetNameSpaceID() const
+  {
+    return mNodeInfo->NamespaceID();
+  }
+
+  /**
+   * Get the NodeInfo for this element
+   * @return the nodes node info
+   */
+  inline nsINodeInfo* NodeInfo() const
+  {
+    return mNodeInfo;
+  }
+
+  inline bool IsInNamespace(PRInt32 aNamespace) const
+  {
+    return mNodeInfo->NamespaceID() == aNamespace;
+  }
+
+  inline bool IsHTML() const
+  {
+    return IsInNamespace(kNameSpaceID_XHTML);
+  }
+
+  inline bool IsHTML(nsIAtom* aTag) const
+  {
+    return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
+  }
+
+  inline bool IsSVG() const
+  {
+    return IsInNamespace(kNameSpaceID_SVG);
+  }
+
+  inline bool IsSVG(nsIAtom* aTag) const
+  {
+    return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
+  }
+
+  inline bool IsXUL() const
+  {
+    return IsInNamespace(kNameSpaceID_XUL);
+  }
+
+  inline bool IsMathML() const
+  {
+    return IsInNamespace(kNameSpaceID_MathML);
+  }
+
+  inline bool IsMathML(nsIAtom* aTag) const
+  {
+    return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
+  }
+
+  /**
    * Returns an atom holding the name of the attribute of type ID on
    * this content node (if applicable).  Returns null for non-element
    * content nodes.
    */
   virtual nsIAtom *GetIDAttributeName() const = 0;
 
   /**
    * Normalizes an attribute name and returns it as a nodeinfo if an attribute
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -368,16 +368,17 @@ public:
     return GetBoolFlag(NodeIsElement);
   }
 
   /**
    * Return this node as an Element.  Should only be used for nodes
    * for which IsElement() is true.  This is defined inline in Element.h.
    */
   mozilla::dom::Element* AsElement();
+  const mozilla::dom::Element* AsElement() const;
 
   /**
    * Return this node as nsIContent.  Should only be used for nodes for which
    * IsContent() is true.  This is defined inline in nsIContent.h.
    */
   nsIContent* AsContent();
 
   virtual nsIDOMNode* AsDOMNode() = 0;
@@ -472,84 +473,26 @@ public:
     return mNodeInfo->NodeName();
   }
   const nsString& LocalName() const
   {
     return mNodeInfo->LocalName();
   }
 
   /**
-   * Get the namespace that this element's tag is defined in
-   * @return the namespace
-   */
-  PRInt32 GetNameSpaceID() const
-  {
-    return mNodeInfo->NamespaceID();
-  }
-
-  /**
    * Get the tag for this element. This will always return a non-null atom
    * pointer (as implied by the naming of the method).  For elements this is
    * the non-namespaced tag, and for other nodes it's something like "#text",
    * "#comment", "#document", etc.
    */
   nsIAtom* Tag() const
   {
     return mNodeInfo->NameAtom();
   }
 
-  /**
-   * Get the NodeInfo for this element
-   * @return the nodes node info
-   */
-  nsINodeInfo* NodeInfo() const
-  {
-    return mNodeInfo;
-  }
-
-  bool IsInNamespace(PRInt32 aNamespace) const
-  {
-    return mNodeInfo->NamespaceID() == aNamespace;
-  }
-
-  bool IsHTML() const
-  {
-    return IsInNamespace(kNameSpaceID_XHTML);
-  }
-
-  bool IsHTML(nsIAtom* aTag) const
-  {
-    return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
-  }
-
-  bool IsSVG() const
-  {
-    return IsInNamespace(kNameSpaceID_SVG);
-  }
-
-  bool IsSVG(nsIAtom* aTag) const
-  {
-    return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
-  }
-
-  bool IsXUL() const
-  {
-    return IsInNamespace(kNameSpaceID_XUL);
-  }
-
-  bool IsMathML() const
-  {
-    return IsInNamespace(kNameSpaceID_MathML);
-  }
-
-  bool IsMathML(nsIAtom* aTag) const
-  {
-    return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
-  }
-
   nsINode*
   InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn)
   {
     return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
   }
   nsINode*
   ReplaceChild(nsINode *aNewChild, nsINode *aOldChild, nsresult *aReturn)
   {
@@ -1222,16 +1165,18 @@ public:
   /**
    * Returns true if 'this' is either document or element or
    * document fragment and aOther is a descendant in the same
    * anonymous tree.
    */
   bool Contains(const nsINode* aOther) const;
   nsresult Contains(nsIDOMNode* aOther, bool* aReturn);
 
+  bool UnoptimizableCCNode() const;
+
 private:
 
   nsIContent* GetNextNodeImpl(const nsINode* aRoot,
                               const bool aSkipChildren) const
   {
     // Can't use nsContentUtils::ContentIsDescendantOf here, since we
     // can't include it here.
 #ifdef DEBUG
--- a/content/base/src/Makefile.in
+++ b/content/base/src/Makefile.in
@@ -87,16 +87,17 @@ CPPSRCS		= \
 		nsFrameLoader.cpp \
 		nsFormData.cpp \
 		nsGenConImageContent.cpp \
 		nsGenericDOMDataNode.cpp \
 		nsGenericElement.cpp \
 		nsGkAtoms.cpp \
 		nsHTMLContentSerializer.cpp \
 		nsImageLoadingContent.cpp \
+		nsINode.cpp \
 		nsLineBreaker.cpp \
 		nsMappedAttributeElement.cpp \
 		nsMappedAttributes.cpp \
 		nsNameSpaceManager.cpp \
 		nsNoDataProtocolContentPolicy.cpp \
 		nsNodeInfo.cpp \
 		nsNodeInfoManager.cpp \
 		nsNodeIterator.cpp \
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -168,26 +168,27 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_
 #include "nsDOMTouchEvent.h"
 #include "nsIScriptElement.h"
 #include "nsIContentViewer.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsCCUncollectableMarker.h"
 #include "mozilla/Base64.h"
 #include "mozilla/Preferences.h"
 #include "nsDOMMutationObserver.h"
-
-#include "nsWrapperCacheInlines.h"
 #include "nsIDOMDocumentType.h"
 #include "nsCharSeparatedTokenizer.h"
-
 #include "nsICharsetDetector.h"
 #include "nsICharsetDetectionObserver.h"
 #include "nsIPlatformCharset.h"
+#include "nsIEditor.h"
+#include "nsIEditorDocShell.h"
 #include "mozilla/Attributes.h"
 
+#include "nsWrapperCacheInlines.h"
+
 extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end,
                                       const char** next, PRUnichar* result);
 extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end,
                                  int ns_aware, const char** colon);
 
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 using namespace mozilla::widget;
@@ -6245,16 +6246,22 @@ nsContentUtils::IsFocusedContent(const n
 bool
 nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
 {
   nsIDocument* doc = aContent->GetCurrentDoc();
   if (!doc) {
     return false;
   }
 
+  // If the subdocument lives in another process, the frame is
+  // tabbable.
+  if (nsEventStateManager::IsRemoteTarget(aContent)) {
+    return true;
+  }
+
   // XXXbz should this use OwnerDoc() for GetSubDocumentFor?
   // sXBL/XBL2 issue!
   nsIDocument* subDoc = doc->GetSubDocumentFor(aContent);
   if (!subDoc) {
     return false;
   }
 
   nsCOMPtr<nsISupports> container = subDoc->GetContainer();
@@ -6912,8 +6919,23 @@ nsContentUtils::GetSelectionInTextContro
       focusOffset = firstChild->Length();
     }
   }
 
   // Make sure aOutStartOffset <= aOutEndOffset.
   aOutStartOffset = NS_MIN(anchorOffset, focusOffset);
   aOutEndOffset = NS_MAX(anchorOffset, focusOffset);
 }
+
+nsIEditor*
+nsContentUtils::GetHTMLEditor(nsPresContext* aPresContext)
+{
+  nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
+  nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(container));
+  bool isEditable;
+  if (!editorDocShell ||
+      NS_FAILED(editorDocShell->GetEditable(&isEditable)) || !isEditable)
+    return nsnull;
+
+  nsCOMPtr<nsIEditor> editor;
+  editorDocShell->GetEditor(getter_AddRefs(editor));
+  return editor;
+}
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -1500,23 +1500,16 @@ nsFrameLoader::MaybeCreateDocShell()
       // handler from it and use that for our shell as well.
 
       parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
     }
 
     mDocShell->SetChromeEventHandler(chromeEventHandler);
   }
 
-  nsCOMPtr<nsIObserverService> os = services::GetObserverService();
-  if (OwnerIsBrowserFrame() && os) {
-    mDocShell->SetIsBrowserFrame(true);
-    os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
-                        "in-process-browser-frame-shown", NULL);
-  }
-
   // This is nasty, this code (the do_GetInterface(mDocShell) below)
   // *must* come *after* the above call to
   // mDocShell->SetChromeEventHandler() for the global window to get
   // the right chrome event handler.
 
   // Tell the window about the frame that hosts it.
   nsCOMPtr<nsIDOMElement> frame_element(do_QueryInterface(mOwnerContent));
   NS_ASSERTION(frame_element, "frame loader owner element not a DOM element!");
@@ -1533,16 +1526,32 @@ nsFrameLoader::MaybeCreateDocShell()
   if (NS_FAILED(base_win->Create()) || !win_private) {
     // Do not call Destroy() here. See bug 472312.
     NS_WARNING("Something wrong when creating the docshell for a frameloader!");
     return NS_ERROR_FAILURE;
   }
 
   EnsureMessageManager();
 
+  if (OwnerIsBrowserFrame()) {
+    mDocShell->SetIsBrowserFrame(true);
+
+    nsCOMPtr<nsIObserverService> os = services::GetObserverService();
+    if (os) {
+      os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
+                          "in-process-browser-frame-shown", NULL);
+    }
+
+    if (mMessageManager) {
+      mMessageManager->LoadFrameScript(
+        NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
+        /* allowDelayedLoad = */ true);
+    }
+  }
+
   return NS_OK;
 }
 
 void
 nsFrameLoader::GetURL(nsString& aURI)
 {
   aURI.Truncate();
 
@@ -1894,17 +1903,18 @@ nsFrameLoader::TryRemoteBrowser()
     return false;
   }
   if (NS_FAILED(window->GetChromeFlags(&chromeFlags))) {
     return false;
   }
 
   ContentParent* parent = ContentParent::GetNewOrUsed();
   NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
-  mRemoteBrowser = parent->CreateTab(chromeFlags);
+  mRemoteBrowser = parent->CreateTab(chromeFlags,
+                                     /* aIsBrowserFrame = */ OwnerIsBrowserFrame());
   if (mRemoteBrowser) {
     nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
     mRemoteBrowser->SetOwnerElement(element);
 
     nsCOMPtr<nsIDocShellTreeItem> rootItem;
     parentAsItem->GetRootTreeItem(getter_AddRefs(rootItem));
     nsCOMPtr<nsIDOMWindow> rootWin = do_GetInterface(rootItem);
     nsCOMPtr<nsIDOMChromeWindow> rootChromeWin = do_QueryInterface(rootWin);
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -130,1147 +130,16 @@ using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
 
 PRInt32 nsIContent::sTabFocusModel = eTabFocus_any;
 bool nsIContent::sTabFocusModelAppliesToXUL = false;
 PRUint32 nsMutationGuard::sMutationCount = 0;
 
-//----------------------------------------------------------------------
-
-nsINode::nsSlots::~nsSlots()
-{
-  if (mChildNodes) {
-    mChildNodes->DropReference();
-    NS_RELEASE(mChildNodes);
-  }
-
-  if (mWeakReference) {
-    mWeakReference->NoticeNodeDestruction();
-  }
-}
-
-void
-nsINode::nsSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
-{
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildNodes");
-  cb.NoteXPCOMChild(mChildNodes);
-}
-
-void
-nsINode::nsSlots::Unlink()
-{
-  if (mChildNodes) {
-    mChildNodes->DropReference();
-    NS_RELEASE(mChildNodes);
-  }
-}
-
-//----------------------------------------------------------------------
-
-nsINode::~nsINode()
-{
-  NS_ASSERTION(!HasSlots(), "nsNodeUtils::LastRelease was not called?");
-  NS_ASSERTION(mSubtreeRoot == this, "Didn't restore state properly?");
-}
-
-void*
-nsINode::GetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
-                     nsresult *aStatus) const
-{
-  return OwnerDoc()->PropertyTable(aCategory)->GetProperty(this, aPropertyName,
-                                                           aStatus);
-}
-
-nsresult
-nsINode::SetProperty(PRUint16 aCategory, nsIAtom *aPropertyName, void *aValue,
-                     NSPropertyDtorFunc aDtor, bool aTransfer,
-                     void **aOldValue)
-{
-  nsresult rv = OwnerDoc()->PropertyTable(aCategory)->SetProperty(this,
-                                                                  aPropertyName,
-                                                                  aValue, aDtor,
-                                                                  nsnull,
-                                                                  aTransfer,
-                                                                  aOldValue);
-  if (NS_SUCCEEDED(rv)) {
-    SetFlags(NODE_HAS_PROPERTIES);
-  }
-
-  return rv;
-}
-
-void
-nsINode::DeleteProperty(PRUint16 aCategory, nsIAtom *aPropertyName)
-{
-  OwnerDoc()->PropertyTable(aCategory)->DeleteProperty(this, aPropertyName);
-}
-
-void*
-nsINode::UnsetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
-                       nsresult *aStatus)
-{
-  return OwnerDoc()->PropertyTable(aCategory)->UnsetProperty(this,
-                                                             aPropertyName,
-                                                             aStatus);
-}
-
-nsINode::nsSlots*
-nsINode::CreateSlots()
-{
-  return new nsSlots();
-}
-
-bool
-nsINode::IsEditableInternal() const
-{
-  if (HasFlag(NODE_IS_EDITABLE)) {
-    // The node is in an editable contentEditable subtree.
-    return true;
-  }
-
-  nsIDocument *doc = GetCurrentDoc();
-
-  // Check if the node is in a document and the document is in designMode.
-  return doc && doc->HasFlag(NODE_IS_EDITABLE);
-}
-
-static nsIContent* GetEditorRootContent(nsIEditor* aEditor)
-{
-  nsCOMPtr<nsIDOMElement> rootElement;
-  aEditor->GetRootElement(getter_AddRefs(rootElement));
-  nsCOMPtr<nsIContent> rootContent(do_QueryInterface(rootElement));
-  return rootContent;
-}
-
-nsIContent*
-nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
-{
-  if (aEditor)
-    *aEditor = nsnull;
-  for (nsINode* node = this; node; node = node->GetNodeParent()) {
-    if (!node->IsElement() ||
-        !node->AsElement()->IsHTML())
-      continue;
-
-    nsCOMPtr<nsIEditor> editor;
-    static_cast<nsGenericHTMLElement*>(node)->
-        GetEditorInternal(getter_AddRefs(editor));
-    if (!editor)
-      continue;
-
-    nsIContent* rootContent = GetEditorRootContent(editor);
-    if (aEditor)
-      editor.swap(*aEditor);
-    return rootContent;
-  }
-  return nsnull;
-}
-
-static nsIEditor* GetHTMLEditor(nsPresContext* aPresContext)
-{
-  nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
-  nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(container));
-  bool isEditable;
-  if (!editorDocShell ||
-      NS_FAILED(editorDocShell->GetEditable(&isEditable)) || !isEditable)
-    return nsnull;
-
-  nsCOMPtr<nsIEditor> editor;
-  editorDocShell->GetEditor(getter_AddRefs(editor));
-  return editor;
-}
-
-static nsIContent* GetRootForContentSubtree(nsIContent* aContent)
-{
-  NS_ENSURE_TRUE(aContent, nsnull);
-  nsIContent* stop = aContent->GetBindingParent();
-  while (aContent) {
-    nsIContent* parent = aContent->GetParent();
-    if (parent == stop) {
-      break;
-    }
-    aContent = parent;
-  }
-  return aContent;
-}
-
-nsIContent*
-nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
-{
-  NS_ENSURE_TRUE(aPresShell, nsnull);
-
-  if (IsNodeOfType(eDOCUMENT))
-    return static_cast<nsIDocument*>(this)->GetRootElement();
-  if (!IsNodeOfType(eCONTENT))
-    return nsnull;
-
-  if (GetCurrentDoc() != aPresShell->GetDocument()) {
-    return nsnull;
-  }
-
-  if (static_cast<nsIContent*>(this)->HasIndependentSelection()) {
-    // This node should be a descendant of input/textarea editor.
-    nsIContent* content = GetTextEditorRootContent();
-    if (content)
-      return content;
-  }
-
-  nsPresContext* presContext = aPresShell->GetPresContext();
-  if (presContext) {
-    nsIEditor* editor = GetHTMLEditor(presContext);
-    if (editor) {
-      // This node is in HTML editor.
-      nsIDocument* doc = GetCurrentDoc();
-      if (!doc || doc->HasFlag(NODE_IS_EDITABLE) ||
-          !HasFlag(NODE_IS_EDITABLE)) {
-        nsIContent* editorRoot = GetEditorRootContent(editor);
-        NS_ENSURE_TRUE(editorRoot, nsnull);
-        return nsContentUtils::IsInSameAnonymousTree(this, editorRoot) ?
-                 editorRoot :
-                 GetRootForContentSubtree(static_cast<nsIContent*>(this));
-      }
-      // If the document isn't editable but this is editable, this is in
-      // contenteditable.  Use the editing host element for selection root.
-      return static_cast<nsIContent*>(this)->GetEditingHost();
-    }
-  }
-
-  nsRefPtr<nsFrameSelection> fs = aPresShell->FrameSelection();
-  nsIContent* content = fs->GetLimiter();
-  if (!content) {
-    content = fs->GetAncestorLimiter();
-    if (!content) {
-      nsIDocument* doc = aPresShell->GetDocument();
-      NS_ENSURE_TRUE(doc, nsnull);
-      content = doc->GetRootElement();
-      if (!content)
-        return nsnull;
-    }
-  }
-
-  // This node might be in another subtree, if so, we should find this subtree's
-  // root.  Otherwise, we can return the content simply.
-  NS_ENSURE_TRUE(content, nsnull);
-  return nsContentUtils::IsInSameAnonymousTree(this, content) ?
-           content : GetRootForContentSubtree(static_cast<nsIContent*>(this));
-}
-
-nsINodeList*
-nsINode::GetChildNodesList()
-{
-  nsSlots *slots = GetSlots();
-  if (!slots) {
-    return nsnull;
-  }
-
-  if (!slots->mChildNodes) {
-    slots->mChildNodes = new nsChildContentList(this);
-    if (slots->mChildNodes) {
-      NS_ADDREF(slots->mChildNodes);
-    }
-  }
-
-  return slots->mChildNodes;
-}
-
-#ifdef DEBUG
-void
-nsINode::CheckNotNativeAnonymous() const
-{
-  if (!IsNodeOfType(eCONTENT))
-    return;
-  nsIContent* content = static_cast<const nsIContent *>(this)->GetBindingParent();
-  while (content) {
-    if (content->IsRootOfNativeAnonymousSubtree()) {
-      NS_ERROR("Element not marked to be in native anonymous subtree!");
-      break;
-    }
-    content = content->GetBindingParent();
-  }
-}
-#endif
-
-nsresult
-nsINode::GetParentNode(nsIDOMNode** aParentNode)
-{
-  *aParentNode = nsnull;
-
-  nsINode *parent = GetNodeParent();
-
-  return parent ? CallQueryInterface(parent, aParentNode) : NS_OK;
-}
-
-nsresult
-nsINode::GetParentElement(nsIDOMElement** aParentElement)
-{
-  *aParentElement = nsnull;
-  nsINode* parent = GetElementParent();
-  return parent ? CallQueryInterface(parent, aParentElement) : NS_OK;
-}
-
-nsresult
-nsINode::GetChildNodes(nsIDOMNodeList** aChildNodes)
-{
-  *aChildNodes = GetChildNodesList();
-  if (!*aChildNodes) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  NS_ADDREF(*aChildNodes);
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetFirstChild(nsIDOMNode** aNode)
-{
-  nsIContent* child = GetFirstChild();
-  if (child) {
-    return CallQueryInterface(child, aNode);
-  }
-
-  *aNode = nsnull;
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetLastChild(nsIDOMNode** aNode)
-{
-  nsIContent* child = GetLastChild();
-  if (child) {
-    return CallQueryInterface(child, aNode);
-  }
-
-  *aNode = nsnull;
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetPreviousSibling(nsIDOMNode** aPrevSibling)
-{
-  *aPrevSibling = nsnull;
-
-  nsIContent *sibling = GetPreviousSibling();
-
-  return sibling ? CallQueryInterface(sibling, aPrevSibling) : NS_OK;
-}
-
-nsresult
-nsINode::GetNextSibling(nsIDOMNode** aNextSibling)
-{
-  *aNextSibling = nsnull;
-
-  nsIContent *sibling = GetNextSibling();
-
-  return sibling ? CallQueryInterface(sibling, aNextSibling) : NS_OK;
-}
-
-nsresult
-nsINode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
-{
-  *aOwnerDocument = nsnull;
-
-  nsIDocument *ownerDoc = GetOwnerDocument();
-
-  return ownerDoc ? CallQueryInterface(ownerDoc, aOwnerDocument) : NS_OK;
-}
-
-nsresult
-nsINode::RemoveChild(nsINode *aOldChild)
-{
-  if (!aOldChild) {
-    return NS_ERROR_NULL_POINTER;
-  }
-
-  if (IsNodeOfType(eDATA_NODE)) {
-    return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-  }
-
-  if (aOldChild && aOldChild->GetNodeParent() == this) {
-    nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, OwnerDoc());
-  }
-
-  PRInt32 index = IndexOf(aOldChild);
-  if (index == -1) {
-    // aOldChild isn't one of our children.
-    return NS_ERROR_DOM_NOT_FOUND_ERR;
-  }
-
-  RemoveChildAt(index, true);
-  return NS_OK;
-}
-
-nsresult
-nsINode::ReplaceOrInsertBefore(bool aReplace, nsIDOMNode* aNewChild,
-                               nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
-{
-  nsCOMPtr<nsINode> newChild = do_QueryInterface(aNewChild);
-
-  nsresult rv;
-  nsCOMPtr<nsINode> refChild;
-  if (aRefChild) {
-      refChild = do_QueryInterface(aRefChild, &rv);
-      NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  rv = ReplaceOrInsertBefore(aReplace, newChild, refChild);
-  if (NS_SUCCEEDED(rv)) {
-    NS_ADDREF(*aReturn = aReplace ? aRefChild : aNewChild);
-  }
-
-  return rv;
-}
-
-nsresult
-nsINode::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
-{
-  nsCOMPtr<nsIContent> oldChild = do_QueryInterface(aOldChild);
-  nsresult rv = RemoveChild(oldChild);
-  if (NS_SUCCEEDED(rv)) {
-    NS_ADDREF(*aReturn = aOldChild);
-  }
-  return rv;
-}
-
-nsresult
-nsINode::Normalize()
-{
-  // First collect list of nodes to be removed
-  nsAutoTArray<nsCOMPtr<nsIContent>, 50> nodes;
-
-  bool canMerge = false;
-  for (nsIContent* node = this->GetFirstChild();
-       node;
-       node = node->GetNextNode(this)) {
-    if (node->NodeType() != nsIDOMNode::TEXT_NODE) {
-      canMerge = false;
-      continue;
-    }
-
-    if (canMerge || node->TextLength() == 0) {
-      // No need to touch canMerge. That way we can merge across empty
-      // textnodes if and only if the node before is a textnode
-      nodes.AppendElement(node);
-    }
-    else {
-      canMerge = true;
-    }
-
-    // If there's no following sibling, then we need to ensure that we don't
-    // collect following siblings of our (grand)parent as to-be-removed
-    canMerge = canMerge && !!node->GetNextSibling();
-  }
-
-  if (nodes.IsEmpty()) {
-    return NS_OK;
-  }
-
-  // We're relying on mozAutoSubtreeModified to keep the doc alive here.
-  nsIDocument* doc = OwnerDoc();
-
-  // Batch possible DOMSubtreeModified events.
-  mozAutoSubtreeModified subtree(doc, nsnull);
-
-  // Fire all DOMNodeRemoved events. Optimize the common case of there being
-  // no listeners
-  bool hasRemoveListeners = nsContentUtils::
-      HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED);
-  if (hasRemoveListeners) {
-    for (PRUint32 i = 0; i < nodes.Length(); ++i) {
-      nsContentUtils::MaybeFireNodeRemoved(nodes[i], nodes[i]->GetNodeParent(),
-                                           doc);
-    }
-  }
-
-  mozAutoDocUpdate batch(doc, UPDATE_CONTENT_MODEL, true);
-
-  // Merge and remove all nodes
-  nsAutoString tmpStr;
-  for (PRUint32 i = 0; i < nodes.Length(); ++i) {
-    nsIContent* node = nodes[i];
-    // Merge with previous node unless empty
-    const nsTextFragment* text = node->GetText();
-    if (text->GetLength()) {
-      nsIContent* target = node->GetPreviousSibling();
-      NS_ASSERTION((target && target->NodeType() == nsIDOMNode::TEXT_NODE) ||
-                   hasRemoveListeners,
-                   "Should always have a previous text sibling unless "
-                   "mutation events messed us up");
-      if (!hasRemoveListeners ||
-          (target && target->NodeType() == nsIDOMNode::TEXT_NODE)) {
-        nsTextNode* t = static_cast<nsTextNode*>(target);
-        if (text->Is2b()) {
-          t->AppendTextForNormalize(text->Get2b(), text->GetLength(), true, node);
-        }
-        else {
-          tmpStr.Truncate();
-          text->AppendTo(tmpStr);
-          t->AppendTextForNormalize(tmpStr.get(), tmpStr.Length(), true, node);
-        }
-      }
-    }
-
-    // Remove node
-    nsCOMPtr<nsINode> parent = node->GetNodeParent();
-    NS_ASSERTION(parent || hasRemoveListeners,
-                 "Should always have a parent unless "
-                 "mutation events messed us up");
-    if (parent) {
-      parent->RemoveChildAt(parent->IndexOf(node), true);
-    }
-  }
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetDOMBaseURI(nsAString &aURI) const
-{
-  nsCOMPtr<nsIURI> baseURI = GetBaseURI();
-
-  nsCAutoString spec;
-  if (baseURI) {
-    baseURI->GetSpec(spec);
-  }
-
-  CopyUTF8toUTF16(spec, aURI);
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix)
-{
-  Element *element = GetNameSpaceElement();
-  if (element) {
-    // XXX Waiting for DOM spec to list error codes.
-  
-    // Trace up the content parent chain looking for the namespace
-    // declaration that defines the aNamespaceURI namespace. Once found,
-    // return the prefix (i.e. the attribute localName).
-    for (nsIContent* content = element; content;
-         content = content->GetParent()) {
-      PRUint32 attrCount = content->GetAttrCount();
-  
-      for (PRUint32 i = 0; i < attrCount; ++i) {
-        const nsAttrName* name = content->GetAttrNameAt(i);
-  
-        if (name->NamespaceEquals(kNameSpaceID_XMLNS) &&
-            content->AttrValueIs(kNameSpaceID_XMLNS, name->LocalName(),
-                                 aNamespaceURI, eCaseMatters)) {
-          // If the localName is "xmlns", the prefix we output should be
-          // null.
-          nsIAtom *localName = name->LocalName();
-  
-          if (localName != nsGkAtoms::xmlns) {
-            localName->ToString(aPrefix);
-          }
-          else {
-            SetDOMStringToNull(aPrefix);
-          }
-          return NS_OK;
-        }
-      }
-    }
-  }
-
-  SetDOMStringToNull(aPrefix);
-
-  return NS_OK;
-}
-
-static nsresult
-SetUserDataProperty(PRUint16 aCategory, nsINode *aNode, nsIAtom *aKey,
-                    nsISupports* aValue, void** aOldValue)
-{
-  nsresult rv = aNode->SetProperty(aCategory, aKey, aValue,
-                                   nsPropertyTable::SupportsDtorFunc, true,
-                                   aOldValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // Property table owns it now.
-  NS_ADDREF(aValue);
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::SetUserData(const nsAString &aKey, nsIVariant *aData,
-                     nsIDOMUserDataHandler *aHandler, nsIVariant **aResult)
-{
-  *aResult = nsnull;
-
-  nsCOMPtr<nsIAtom> key = do_GetAtom(aKey);
-  if (!key) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  nsresult rv;
-  void *data;
-  if (aData) {
-    rv = SetUserDataProperty(DOM_USER_DATA, this, key, aData, &data);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-  else {
-    data = UnsetProperty(DOM_USER_DATA, key);
-  }
-
-  // Take over ownership of the old data from the property table.
-  nsCOMPtr<nsIVariant> oldData = dont_AddRef(static_cast<nsIVariant*>(data));
-
-  if (aData && aHandler) {
-    nsCOMPtr<nsIDOMUserDataHandler> oldHandler;
-    rv = SetUserDataProperty(DOM_USER_DATA_HANDLER, this, key, aHandler,
-                             getter_AddRefs(oldHandler));
-    if (NS_FAILED(rv)) {
-      // We failed to set the handler, remove the data.
-      DeleteProperty(DOM_USER_DATA, key);
-
-      return rv;
-    }
-  }
-  else {
-    DeleteProperty(DOM_USER_DATA_HANDLER, key);
-  }
-
-  oldData.swap(*aResult);
-
-  return NS_OK;
-}
-
-PRUint16
-nsINode::CompareDocPosition(nsINode* aOtherNode)
-{
-  NS_PRECONDITION(aOtherNode, "don't pass null");
-
-  if (this == aOtherNode) {
-    return 0;
-  }
-
-  nsAutoTArray<nsINode*, 32> parents1, parents2;
-
-  nsINode *node1 = aOtherNode, *node2 = this;
-
-  // Check if either node is an attribute
-  nsIAttribute* attr1 = nsnull;
-  if (node1->IsNodeOfType(nsINode::eATTRIBUTE)) {
-    attr1 = static_cast<nsIAttribute*>(node1);
-    nsIContent* elem = attr1->GetContent();
-    // If there is an owner element add the attribute
-    // to the chain and walk up to the element
-    if (elem) {
-      node1 = elem;
-      parents1.AppendElement(static_cast<nsINode*>(attr1));
-    }
-  }
-  if (node2->IsNodeOfType(nsINode::eATTRIBUTE)) {
-    nsIAttribute* attr2 = static_cast<nsIAttribute*>(node2);
-    nsIContent* elem = attr2->GetContent();
-    if (elem == node1 && attr1) {
-      // Both nodes are attributes on the same element.
-      // Compare position between the attributes.
-
-      PRUint32 i;
-      const nsAttrName* attrName;
-      for (i = 0; (attrName = elem->GetAttrNameAt(i)); ++i) {
-        if (attrName->Equals(attr1->NodeInfo())) {
-          NS_ASSERTION(!attrName->Equals(attr2->NodeInfo()),
-                       "Different attrs at same position");
-          return nsIDOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC |
-            nsIDOMNode::DOCUMENT_POSITION_PRECEDING;
-        }
-        if (attrName->Equals(attr2->NodeInfo())) {
-          return nsIDOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC |
-            nsIDOMNode::DOCUMENT_POSITION_FOLLOWING;
-        }
-      }
-      NS_NOTREACHED("neither attribute in the element");
-      return nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED;
-    }
-
-    if (elem) {
-      node2 = elem;
-      parents2.AppendElement(static_cast<nsINode*>(attr2));
-    }
-  }
-
-  // We now know that both nodes are either nsIContents or nsIDocuments.
-  // If either node started out as an attribute, that attribute will have
-  // the same relative position as its ownerElement, except if the
-  // ownerElement ends up being the container for the other node
-
-  // Build the chain of parents
-  do {
-    parents1.AppendElement(node1);
-    node1 = node1->GetNodeParent();
-  } while (node1);
-  do {
-    parents2.AppendElement(node2);
-    node2 = node2->GetNodeParent();
-  } while (node2);
-
-  // Check if the nodes are disconnected.
-  PRUint32 pos1 = parents1.Length();
-  PRUint32 pos2 = parents2.Length();
-  nsINode* top1 = parents1.ElementAt(--pos1);
-  nsINode* top2 = parents2.ElementAt(--pos2);
-  if (top1 != top2) {
-    return top1 < top2 ?
-      (nsIDOMNode::DOCUMENT_POSITION_PRECEDING |
-       nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED |
-       nsIDOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC) :
-      (nsIDOMNode::DOCUMENT_POSITION_FOLLOWING |
-       nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED |
-       nsIDOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);
-  }
-
-  // Find where the parent chain differs and check indices in the parent.
-  nsINode* parent = top1;
-  PRUint32 len;
-  for (len = NS_MIN(pos1, pos2); len > 0; --len) {
-    nsINode* child1 = parents1.ElementAt(--pos1);
-    nsINode* child2 = parents2.ElementAt(--pos2);
-    if (child1 != child2) {
-      // child1 or child2 can be an attribute here. This will work fine since
-      // IndexOf will return -1 for the attribute making the attribute be
-      // considered before any child.
-      return parent->IndexOf(child1) < parent->IndexOf(child2) ?
-        static_cast<PRUint16>(nsIDOMNode::DOCUMENT_POSITION_PRECEDING) :
-        static_cast<PRUint16>(nsIDOMNode::DOCUMENT_POSITION_FOLLOWING);
-    }
-    parent = child1;
-  }
-
-  // We hit the end of one of the parent chains without finding a difference
-  // between the chains. That must mean that one node is an ancestor of the
-  // other. The one with the shortest chain must be the ancestor.
-  return pos1 < pos2 ?
-    (nsIDOMNode::DOCUMENT_POSITION_PRECEDING |
-     nsIDOMNode::DOCUMENT_POSITION_CONTAINS) :
-    (nsIDOMNode::DOCUMENT_POSITION_FOLLOWING |
-     nsIDOMNode::DOCUMENT_POSITION_CONTAINED_BY);    
-}
-
-bool
-nsINode::IsEqualTo(nsINode* aOther)
-{
-  if (!aOther) {
-    return false;
-  }
-
-  nsAutoString string1, string2;
-
-  nsINode* node1 = this;
-  nsINode* node2 = aOther;
-  do {
-    PRUint16 nodeType = node1->NodeType();
-    if (nodeType != node2->NodeType()) {
-      return false;
-    }
-
-    nsINodeInfo* nodeInfo1 = node1->mNodeInfo;
-    nsINodeInfo* nodeInfo2 = node2->mNodeInfo;
-    if (!nodeInfo1->Equals(nodeInfo2) ||
-        nodeInfo1->GetExtraName() != nodeInfo2->GetExtraName()) {
-      return false;
-    }
-
-    switch(nodeType) {
-      case nsIDOMNode::ELEMENT_NODE:
-      {
-        // Both are elements (we checked that their nodeinfos are equal). Do the
-        // check on attributes.
-        Element* element1 = node1->AsElement();
-        Element* element2 = node2->AsElement();
-        PRUint32 attrCount = element1->GetAttrCount();
-        if (attrCount != element2->GetAttrCount()) {
-          return false;
-        }
-
-        // Iterate over attributes.
-        for (PRUint32 i = 0; i < attrCount; ++i) {
-          const nsAttrName* attrName = element1->GetAttrNameAt(i);
-#ifdef DEBUG
-          bool hasAttr =
-#endif
-          element1->GetAttr(attrName->NamespaceID(), attrName->LocalName(),
-                            string1);
-          NS_ASSERTION(hasAttr, "Why don't we have an attr?");
-    
-          if (!element2->AttrValueIs(attrName->NamespaceID(),
-                                     attrName->LocalName(),
-                                     string1,
-                                     eCaseMatters)) {
-            return false;
-          }
-        }
-        break;
-      }
-      case nsIDOMNode::TEXT_NODE:
-      case nsIDOMNode::COMMENT_NODE:
-      case nsIDOMNode::CDATA_SECTION_NODE:
-      case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
-      {
-        string1.Truncate();
-        static_cast<nsIContent*>(node1)->AppendTextTo(string1);
-        string2.Truncate();
-        static_cast<nsIContent*>(node2)->AppendTextTo(string2);
-
-        if (!string1.Equals(string2)) {
-          return false;
-        }
-
-        break;
-      }
-      case nsIDOMNode::DOCUMENT_NODE:
-      case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
-        break;
-      case nsIDOMNode::ATTRIBUTE_NODE:
-      {
-        NS_ASSERTION(node1 == this && node2 == aOther,
-                     "Did we come upon an attribute node while walking a "
-                     "subtree?");
-        nsCOMPtr<nsIDOMNode> domNode1 = do_QueryInterface(node1);
-        nsCOMPtr<nsIDOMNode> domNode2 = do_QueryInterface(node2);
-        domNode1->GetNodeValue(string1);
-        domNode2->GetNodeValue(string2);
-        
-        // Returning here as to not bother walking subtree. And there is no
-        // risk that we're half way through walking some other subtree since
-        // attribute nodes doesn't appear in subtrees.
-        return string1.Equals(string2);
-      }
-      case nsIDOMNode::DOCUMENT_TYPE_NODE:
-      {
-        nsCOMPtr<nsIDOMDocumentType> docType1 = do_QueryInterface(node1);
-        nsCOMPtr<nsIDOMDocumentType> docType2 = do_QueryInterface(node2);
-    
-        NS_ASSERTION(docType1 && docType2, "Why don't we have a document type node?");
-
-        // Public ID
-        docType1->GetPublicId(string1);
-        docType2->GetPublicId(string2);
-        if (!string1.Equals(string2)) {
-          return false;
-        }
-    
-        // System ID
-        docType1->GetSystemId(string1);
-        docType2->GetSystemId(string2);
-        if (!string1.Equals(string2)) {
-          return false;
-        }
-    
-        // Internal subset
-        docType1->GetInternalSubset(string1);
-        docType2->GetInternalSubset(string2);
-        if (!string1.Equals(string2)) {
-          return false;
-        }
-
-        break;
-      }
-      default:
-        NS_ABORT_IF_FALSE(false, "Unknown node type");
-    }
-
-    nsINode* nextNode = node1->GetFirstChild();
-    if (nextNode) {
-      node1 = nextNode;
-      node2 = node2->GetFirstChild();
-    }
-    else {
-      if (node2->GetFirstChild()) {
-        // node2 has a firstChild, but node1 doesn't
-        return false;
-      }
-
-      // Find next sibling, possibly walking parent chain.
-      while (1) {
-        if (node1 == this) {
-          NS_ASSERTION(node2 == aOther, "Should have reached the start node "
-                                        "for both trees at the same time");
-          return true;
-        }
-
-        nextNode = node1->GetNextSibling();
-        if (nextNode) {
-          node1 = nextNode;
-          node2 = node2->GetNextSibling();
-          break;
-        }
-
-        if (node2->GetNextSibling()) {
-          // node2 has a nextSibling, but node1 doesn't
-          return false;
-        }
-        
-        node1 = node1->GetNodeParent();
-        node2 = node2->GetNodeParent();
-        NS_ASSERTION(node1 && node2, "no parent while walking subtree");
-      }
-    }
-  } while(node2);
-
-  return false;
-}
-
-nsresult
-nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix,
-                            nsAString& aNamespaceURI)
-{
-  Element *element = GetNameSpaceElement();
-  if (!element ||
-      NS_FAILED(element->LookupNamespaceURIInternal(aNamespacePrefix,
-                                                    aNamespaceURI))) {
-    SetDOMStringToNull(aNamespaceURI);
-  }
-
-  return NS_OK;
-}
-
-NS_IMPL_DOMTARGET_DEFAULTS(nsINode)
-
-NS_IMETHODIMP
-nsINode::AddEventListener(const nsAString& aType,
-                          nsIDOMEventListener *aListener,
-                          bool aUseCapture,
-                          bool aWantsUntrusted,
-                          PRUint8 aOptionalArgc)
-{
-  NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
-               "Won't check if this is chrome, you want to set "
-               "aWantsUntrusted to false or make the aWantsUntrusted "
-               "explicit by making aOptionalArgc non-zero.");
-
-  if (!aWantsUntrusted &&
-      (aOptionalArgc < 2 &&
-       !nsContentUtils::IsChromeDoc(OwnerDoc()))) {
-    aWantsUntrusted = true;
-  }
-
-  nsEventListenerManager* listener_manager = GetListenerManager(true);
-  NS_ENSURE_STATE(listener_manager);
-  listener_manager->AddEventListener(aType, aListener, aUseCapture,
-                                     aWantsUntrusted);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsINode::AddSystemEventListener(const nsAString& aType,
-                                nsIDOMEventListener *aListener,
-                                bool aUseCapture,
-                                bool aWantsUntrusted,
-                                PRUint8 aOptionalArgc)
-{
-  NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
-               "Won't check if this is chrome, you want to set "
-               "aWantsUntrusted to false or make the aWantsUntrusted "
-               "explicit by making aOptionalArgc non-zero.");
-
-  if (!aWantsUntrusted &&
-      (aOptionalArgc < 2 &&
-       !nsContentUtils::IsChromeDoc(OwnerDoc()))) {
-    aWantsUntrusted = true;
-  }
-
-  return NS_AddSystemEventListener(this, aType, aListener, aUseCapture,
-                                   aWantsUntrusted);
-}
-
-NS_IMETHODIMP
-nsINode::RemoveEventListener(const nsAString& aType,
-                             nsIDOMEventListener* aListener,
-                             bool aUseCapture)
-{
-  nsEventListenerManager* elm = GetListenerManager(false);
-  if (elm) {
-    elm->RemoveEventListener(aType, aListener, aUseCapture);
-  }
-  return NS_OK;
-}
-
-NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(nsINode)
-
-nsresult
-nsINode::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
-{
-  // This is only here so that we can use the NS_DECL_NSIDOMTARGET macro
-  NS_ABORT();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-nsresult
-nsINode::DispatchEvent(nsIDOMEvent *aEvent, bool* aRetVal)
-{
-  // XXX sXBL/XBL2 issue -- do we really want the owner here?  What
-  // if that's the XBL document?  Would we want its presshell?  Or what?
-  nsCOMPtr<nsIDocument> document = OwnerDoc();
-
-  // Do nothing if the element does not belong to a document
-  if (!document) {
-    *aRetVal = true;
-    return NS_OK;
-  }
-
-  // Obtain a presentation shell
-  nsIPresShell *shell = document->GetShell();
-  nsRefPtr<nsPresContext> context;
-  if (shell) {
-    context = shell->GetPresContext();
-  }
-
-  nsEventStatus status = nsEventStatus_eIgnore;
-  nsresult rv =
-    nsEventDispatcher::DispatchDOMEvent(this, nsnull, aEvent, context,
-                                        &status);
-  *aRetVal = (status != nsEventStatus_eConsumeNoDefault);
-  return rv;
-}
-
-nsresult
-nsINode::PostHandleEvent(nsEventChainPostVisitor& /*aVisitor*/)
-{
-  return NS_OK;
-}
-
-nsresult
-nsINode::DispatchDOMEvent(nsEvent* aEvent,
-                          nsIDOMEvent* aDOMEvent,
-                          nsPresContext* aPresContext,
-                          nsEventStatus* aEventStatus)
-{
-  return nsEventDispatcher::DispatchDOMEvent(this, aEvent, aDOMEvent,
-                                             aPresContext, aEventStatus);
-}
-
-nsEventListenerManager*
-nsINode::GetListenerManager(bool aCreateIfNotFound)
-{
-  return nsContentUtils::GetListenerManager(this, aCreateIfNotFound);
-}
-
-nsIScriptContext*
-nsINode::GetContextForEventHandlers(nsresult* aRv)
-{
-  return nsContentUtils::GetContextForEventHandlers(this, aRv);
-}
-
-/* static */
-void
-nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
-{
-  nsContentUtils::TraceWrapper(tmp, cb, closure);
-}
-
-
-static
-bool UnoptimizableCCNode(nsINode* aNode)
-{
-  const PtrBits problematicFlags = (NODE_IS_ANONYMOUS |
-                                    NODE_IS_IN_ANONYMOUS_SUBTREE |
-                                    NODE_IS_NATIVE_ANONYMOUS_ROOT |
-                                    NODE_MAY_BE_IN_BINDING_MNGR |
-                                    NODE_IS_INSERTION_PARENT);
-  return aNode->HasFlag(problematicFlags) ||
-         aNode->NodeType() == nsIDOMNode::ATTRIBUTE_NODE ||
-         // For strange cases like xbl:content/xbl:children
-         (aNode->IsElement() &&
-          aNode->AsElement()->IsInNamespace(kNameSpaceID_XBL));
-}
-
-/* static */
-bool
-nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
-{
-  if (NS_LIKELY(!cb.WantAllTraces())) {
-    nsIDocument *currentDoc = tmp->GetCurrentDoc();
-    if (currentDoc &&
-        nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
-      return false;
-    }
-
-    if (nsCCUncollectableMarker::sGeneration) {
-      // If we're black no need to traverse.
-      if (tmp->IsBlack() || tmp->InCCBlackTree()) {
-        return false;
-      }
-
-      if (!UnoptimizableCCNode(tmp)) {
-        // If we're in a black document, return early.
-        if ((currentDoc && currentDoc->IsBlack())) {
-          return false;
-        }
-        // If we're not in anonymous content and we have a black parent,
-        // return early.
-        nsIContent* parent = tmp->GetParent();
-        if (parent && !UnoptimizableCCNode(parent) && parent->IsBlack()) {
-          NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
-          return false;
-        }
-      }
-    }
-  }
-
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
-
-  nsSlots *slots = tmp->GetExistingSlots();
-  if (slots) {
-    slots->Traverse(cb);
-  }
-
-  if (tmp->HasProperties()) {
-    nsNodeUtils::TraverseUserData(tmp, cb);
-    nsCOMArray<nsISupports>* objects =
-      static_cast<nsCOMArray<nsISupports>*>(tmp->GetProperty(nsGkAtoms::keepobjectsalive));
-    if (objects) {
-      for (PRInt32 i = 0; i < objects->Count(); ++i) {
-         cb.NoteXPCOMChild(objects->ObjectAt(i));
-      }
-    }
-  }
-
-  if (tmp->NodeType() != nsIDOMNode::DOCUMENT_NODE &&
-      tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) {
-    nsContentUtils::TraverseListenerManager(tmp, cb);
-  }
-
-  return true;
-}
-
-/* static */
-void
-nsINode::Unlink(nsINode *tmp)
-{
-  nsContentUtils::ReleaseWrapper(tmp, tmp);
-
-  nsSlots *slots = tmp->GetExistingSlots();
-  if (slots) {
-    slots->Unlink();
-  }
-
-  if (tmp->NodeType() != nsIDOMNode::DOCUMENT_NODE &&
-      tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) {
-    nsContentUtils::RemoveListenerManager(tmp);
-    tmp->UnsetFlags(NODE_HAS_LISTENERMANAGER);
-  }
-
-  if (tmp->HasProperties()) {
-    nsNodeUtils::UnlinkUserData(tmp);
-    tmp->DeleteProperty(nsGkAtoms::keepobjectsalive);
-  }
-}
-
-//----------------------------------------------------------------------
-
 nsEventStates
 Element::IntrinsicState() const
 {
   return IsEditable() ? NS_EVENT_STATE_MOZ_READWRITE :
                         NS_EVENT_STATE_MOZ_READONLY;
 }
 
 void
@@ -1498,17 +367,17 @@ nsIContent::GetDesiredIMEState()
   nsIPresShell* ps = doc->GetShell();
   if (!ps) {
     return IMEState(IMEState::DISABLED);
   }
   nsPresContext* pc = ps->GetPresContext();
   if (!pc) {
     return IMEState(IMEState::DISABLED);
   }
-  nsIEditor* editor = GetHTMLEditor(pc);
+  nsIEditor* editor = nsContentUtils::GetHTMLEditor(pc);
   nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(editor);
   if (!imeEditor) {
     return IMEState(IMEState::DISABLED);
   }
   IMEState state;
   imeEditor->GetPreferredIMEState(&state);
   return state;
 }
@@ -1638,37 +507,16 @@ nsIContent::GetBaseURI() const
     if (NS_SUCCEEDED(rv)) {
       base.swap(newBase);
     }
   }
 
   return base.forget();
 }
 
-static void
-ReleaseURI(void*, /* aObject*/
-           nsIAtom*, /* aPropertyName */
-           void* aPropertyValue,
-           void* /* aData */)
-{
-  nsIURI* uri = static_cast<nsIURI*>(aPropertyValue);
-  NS_RELEASE(uri);
-}
-
-nsresult
-nsINode::SetExplicitBaseURI(nsIURI* aURI)
-{
-  nsresult rv = SetProperty(nsGkAtoms::baseURIProperty, aURI, ReleaseURI);
-  if (NS_SUCCEEDED(rv)) {
-    SetHasExplicitBaseURI();
-    NS_ADDREF(aURI);
-  }
-  return rv;
-}
-
 //----------------------------------------------------------------------
 
 static inline JSObject*
 GetJSObjectChild(nsWrapperCache* aCache)
 {
   return aCache->PreservingWrapper() ? aCache->GetWrapperPreserveColor() : NULL;
 }
 
@@ -2028,16 +876,30 @@ nsGenericElement::GetOffsetRect(nsRect& 
   // we only care about the size. Using 'parent' might make things
   // a bit faster by speeding up the internal GetOffsetTo operations.
   nsIFrame* parent = frame->GetParent() ? frame->GetParent() : frame;
   nsRect rcFrame = nsLayoutUtils::GetAllInFlowRectsUnion(frame, parent);
   aRect.width = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width);
   aRect.height = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height);
 }
 
+nsIntSize
+nsGenericElement::GetPaddingRectSize()
+{
+  nsIFrame* frame = GetStyledFrame();
+  if (!frame) {
+    return nsIntSize(0, 0);
+  }
+
+  NS_ASSERTION(frame->GetParent(), "Styled frame has no parent");
+  nsRect rcFrame = nsLayoutUtils::GetAllInFlowPaddingRectsUnion(frame, frame->GetParent());
+  return nsIntSize(nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width),
+                   nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height));
+}
+
 nsIScrollableFrame*
 nsGenericElement::GetScrollFrame(nsIFrame **aStyledFrame)
 {
   // it isn't clear what to return for SVG nodes, so just return nothing
   if (IsSVG()) {
     if (aStyledFrame) {
       *aStyledFrame = nsnull;
     }
@@ -2140,20 +1002,17 @@ nsGenericElement::SetScrollLeft(PRInt32 
 PRInt32
 nsGenericElement::GetScrollHeight()
 {
   if (IsSVG())
     return 0;
 
   nsIScrollableFrame* sf = GetScrollFrame();
   if (!sf) {
-    nsRect rcFrame;
-    nsCOMPtr<nsIContent> parent;
-    GetOffsetRect(rcFrame, getter_AddRefs(parent));
-    return rcFrame.height;
+    return GetPaddingRectSize().height;
   }
 
   nscoord height = sf->GetScrollRange().height + sf->GetScrollPortRect().height;
   return nsPresContext::AppUnitsToIntCSSPixels(height);
 }
 
 NS_IMETHODIMP
 nsGenericElement::GetScrollHeight(PRInt32* aScrollHeight)
@@ -2166,20 +1025,17 @@ nsGenericElement::GetScrollHeight(PRInt3
 PRInt32
 nsGenericElement::GetScrollWidth()
 {
   if (IsSVG())
     return 0;
 
   nsIScrollableFrame* sf = GetScrollFrame();
   if (!sf) {
-    nsRect rcFrame;
-    nsCOMPtr<nsIContent> parent;
-    GetOffsetRect(rcFrame, getter_AddRefs(parent));
-    return rcFrame.width;
+    return GetPaddingRectSize().width;
   }
 
   nscoord width = sf->GetScrollRange().width + sf->GetScrollPortRect().width;
   return nsPresContext::AppUnitsToIntCSSPixels(width);
 }
 
 NS_IMETHODIMP
 nsGenericElement::GetScrollWidth(PRInt32 *aScrollWidth)
@@ -3719,155 +2575,27 @@ nsGenericElement::InsertChildAt(nsIConte
                                 PRUint32 aIndex,
                                 bool aNotify)
 {
   NS_PRECONDITION(aKid, "null ptr");
 
   return doInsertChildAt(aKid, aIndex, aNotify, mAttrsAndChildren);
 }
 
-static nsresult
-AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode)
-{
-  NS_ASSERTION(!aNode->GetNodeParent(),
-               "Should have removed from parent already");
-
-  nsIDocument *doc = aParent->OwnerDoc();
-
-  nsresult rv;
-  nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMNode> adoptedNode;
-  rv = domDoc->AdoptNode(node, getter_AddRefs(adoptedNode));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  NS_ASSERTION(aParent->OwnerDoc() == doc,
-               "ownerDoc chainged while adopting");
-  NS_ASSERTION(adoptedNode == node, "Uh, adopt node changed nodes?");
-  NS_ASSERTION(aParent->HasSameOwnerDoc(aNode),
-               "ownerDocument changed again after adopting!");
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
-                         bool aNotify, nsAttrAndChildArray& aChildArray)
-{
-  NS_PRECONDITION(!aKid->GetNodeParent(),
-                  "Inserting node that already has parent");
-  nsresult rv;
-
-  // The id-handling code, and in the future possibly other code, need to
-  // react to unexpected attribute changes.
-  nsMutationGuard::DidMutate();
-
-  // Do this before checking the child-count since this could cause mutations
-  nsIDocument* doc = GetCurrentDoc();
-  mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, aNotify);
-
-  if (!HasSameOwnerDoc(aKid)) {
-    rv = AdoptNodeIntoOwnerDoc(this, aKid);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  PRUint32 childCount = aChildArray.ChildCount();
-  NS_ENSURE_TRUE(aIndex <= childCount, NS_ERROR_ILLEGAL_VALUE);
-  bool isAppend = (aIndex == childCount);
-
-  rv = aChildArray.InsertChildAt(aKid, aIndex);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (aIndex == 0) {
-    mFirstChild = aKid;
-  }
-
-  nsIContent* parent =
-    IsNodeOfType(eDOCUMENT) ? nsnull : static_cast<nsIContent*>(this);
-
-  rv = aKid->BindToTree(doc, parent,
-                        parent ? parent->GetBindingParent() : nsnull,
-                        true);
-  if (NS_FAILED(rv)) {
-    if (GetFirstChild() == aKid) {
-      mFirstChild = aKid->GetNextSibling();
-    }
-    aChildArray.RemoveChildAt(aIndex);
-    aKid->UnbindFromTree();
-    return rv;
-  }
-
-  NS_ASSERTION(aKid->GetNodeParent() == this,
-               "Did we run script inappropriately?");
-
-  if (aNotify) {
-    // Note that we always want to call ContentInserted when things are added
-    // as kids to documents
-    if (parent && isAppend) {
-      nsNodeUtils::ContentAppended(parent, aKid, aIndex);
-    } else {
-      nsNodeUtils::ContentInserted(this, aKid, aIndex);
-    }
-
-    if (nsContentUtils::HasMutationListeners(aKid,
-          NS_EVENT_BITS_MUTATION_NODEINSERTED, this)) {
-      nsMutationEvent mutation(true, NS_MUTATION_NODEINSERTED);
-      mutation.mRelatedNode = do_QueryInterface(this);
-
-      mozAutoSubtreeModified subtree(OwnerDoc(), this);
-      (new nsAsyncDOMEvent(aKid, mutation))->RunDOMEventWhenSafe();
-    }
-  }
-
-  return NS_OK;
-}
-
 void
 nsGenericElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
 {
   nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
   NS_ASSERTION(oldKid == GetChildAt(aIndex), "Unexpected child in RemoveChildAt");
 
   if (oldKid) {
     doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
   }
 }
 
-void
-nsINode::doRemoveChildAt(PRUint32 aIndex, bool aNotify,
-                         nsIContent* aKid, nsAttrAndChildArray& aChildArray)
-{
-  NS_PRECONDITION(aKid && aKid->GetNodeParent() == this &&
-                  aKid == GetChildAt(aIndex) &&
-                  IndexOf(aKid) == (PRInt32)aIndex, "Bogus aKid");
-
-  nsMutationGuard::DidMutate();
-
-  nsIDocument* doc = GetCurrentDoc();
-
-  mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, aNotify);
-
-  nsIContent* previousSibling = aKid->GetPreviousSibling();
-
-  if (GetFirstChild() == aKid) {
-    mFirstChild = aKid->GetNextSibling();
-  }
-
-  aChildArray.RemoveChildAt(aIndex);
-
-  if (aNotify) {
-    nsNodeUtils::ContentRemoved(this, aKid, aIndex, previousSibling);
-  }
-
-  aKid->UnbindFromTree();
-}
-
 NS_IMETHODIMP
 nsGenericElement::GetTextContent(nsAString &aTextContent)
 {
   nsContentUtils::GetNodeTextContent(this, true, aTextContent);
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -3980,168 +2708,16 @@ nsGenericElement::SaveSubtreeState()
     mAttrsAndChildren.ChildAt(i)->SaveSubtreeState();
   }
 }
 
 //----------------------------------------------------------------------
 
 // Generic DOMNode implementations
 
-// When replacing, aRefChild is the content being replaced; when
-// inserting it's the content before which we're inserting.  In the
-// latter case it may be null.
-static
-bool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent,
-                      bool aIsReplace, nsINode* aRefChild)
-{
-  MOZ_ASSERT(aNewChild, "Must have new child");
-  MOZ_ASSERT_IF(aIsReplace, aRefChild);
-  MOZ_ASSERT(aParent);
-  MOZ_ASSERT(aParent->IsNodeOfType(nsINode::eDOCUMENT) ||
-             aParent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT) ||
-             aParent->IsElement(),
-             "Nodes that are not documents, document fragments or elements "
-             "can't be parents!");
-
-  // A common case is that aNewChild has no kids, in which case
-  // aParent can't be a descendant of aNewChild unless they're
-  // actually equal to each other.  Fast-path that case, since aParent
-  // could be pretty deep in the DOM tree.
-  if (aNewChild == aParent ||
-      (aNewChild->GetFirstChild() &&
-       nsContentUtils::ContentIsDescendantOf(aParent, aNewChild))) {
-    return false;
-  }
-
-  // The allowed child nodes differ for documents and elements
-  switch (aNewChild->NodeType()) {
-  case nsIDOMNode::COMMENT_NODE :
-  case nsIDOMNode::PROCESSING_INSTRUCTION_NODE :
-    // OK in both cases
-    return true;
-  case nsIDOMNode::TEXT_NODE :
-  case nsIDOMNode::CDATA_SECTION_NODE :
-  case nsIDOMNode::ENTITY_REFERENCE_NODE :
-    // Allowed under Elements and DocumentFragments
-    return aParent->NodeType() != nsIDOMNode::DOCUMENT_NODE;
-  case nsIDOMNode::ELEMENT_NODE :
-    {
-      if (!aParent->IsNodeOfType(nsINode::eDOCUMENT)) {
-        // Always ok to have elements under other elements or document fragments
-        return true;
-      }
-
-      nsIDocument* parentDocument = static_cast<nsIDocument*>(aParent);
-      Element* rootElement = parentDocument->GetRootElement();
-      if (rootElement) {
-        // Already have a documentElement, so this is only OK if we're
-        // replacing it.
-        return aIsReplace && rootElement == aRefChild;
-      }
-
-      // We don't have a documentElement yet.  Our one remaining constraint is
-      // that the documentElement must come after the doctype.
-      if (!aRefChild) {
-        // Appending is just fine.
-        return true;
-      }
-
-      nsIContent* docTypeContent = parentDocument->GetDocumentType();
-      if (!docTypeContent) {
-        // It's all good.
-        return true;
-      }
-
-      PRInt32 doctypeIndex = aParent->IndexOf(docTypeContent);
-      PRInt32 insertIndex = aParent->IndexOf(aRefChild);
-
-      // Now we're OK in the following two cases only:
-      // 1) We're replacing something that's not before the doctype
-      // 2) We're inserting before something that comes after the doctype 
-      return aIsReplace ? (insertIndex >= doctypeIndex) :
-        insertIndex > doctypeIndex;
-    }
-  case nsIDOMNode::DOCUMENT_TYPE_NODE :
-    {
-      if (!aParent->IsNodeOfType(nsINode::eDOCUMENT)) {
-        // doctypes only allowed under documents
-        return false;
-      }
-
-      nsIDocument* parentDocument = static_cast<nsIDocument*>(aParent);
-      nsIContent* docTypeContent = parentDocument->GetDocumentType();
-      if (docTypeContent) {
-        // Already have a doctype, so this is only OK if we're replacing it
-        return aIsReplace && docTypeContent == aRefChild;
-      }
-
-      // We don't have a doctype yet.  Our one remaining constraint is
-      // that the doctype must come before the documentElement.
-      Element* rootElement = parentDocument->GetRootElement();
-      if (!rootElement) {
-        // It's all good
-        return true;
-      }
-
-      if (!aRefChild) {
-        // Trying to append a doctype, but have a documentElement
-        return false;
-      }
-
-      PRInt32 rootIndex = aParent->IndexOf(rootElement);
-      PRInt32 insertIndex = aParent->IndexOf(aRefChild);
-
-      // Now we're OK if and only if insertIndex <= rootIndex.  Indeed, either
-      // we end up replacing aRefChild or we end up before it.  Either one is
-      // ok as long as aRefChild is not after rootElement.
-      return insertIndex <= rootIndex;
-    }
-  case nsIDOMNode::DOCUMENT_FRAGMENT_NODE :
-    {
-      // Note that for now we only allow nodes inside document fragments if
-      // they're allowed inside elements.  If we ever change this to allow
-      // doctype nodes in document fragments, we'll need to update this code.
-      // Also, there's a version of this code in ReplaceOrInsertBefore.  If you
-      // change this code, change that too.
-      if (!aParent->IsNodeOfType(nsINode::eDOCUMENT)) {
-        // All good here
-        return true;
-      }
-
-      bool sawElement = false;
-      for (nsIContent* child = aNewChild->GetFirstChild();
-           child;
-           child = child->GetNextSibling()) {
-        if (child->IsElement()) {
-          if (sawElement) {
-            // Can't put two elements into a document
-            return false;
-          }
-          sawElement = true;
-        }
-        // If we can put this content at the the right place, we might be ok;
-        // if not, we bail out.
-        if (!IsAllowedAsChild(child, aParent, aIsReplace, aRefChild)) {
-          return false;
-        }
-      }
-
-      // Everything in the fragment checked out ok, so we can stick it in here
-      return true;
-    }
-  default:
-    /*
-     * aNewChild is of invalid type.
-     */
-    break;
-  }
-
-  return false;
-}
-
 void
 nsGenericElement::FireNodeInserted(nsIDocument* aDoc,
                                    nsINode* aParent,
                                    nsTArray<nsCOMPtr<nsIContent> >& aNodes)
 {
   PRUint32 count = aNodes.Length();
   for (PRUint32 i = 0; i < count; ++i) {
     nsIContent* childContent = aNodes[i];
@@ -4152,408 +2728,16 @@ nsGenericElement::FireNodeInserted(nsIDo
       mutation.mRelatedNode = do_QueryInterface(aParent);
 
       mozAutoSubtreeModified subtree(aDoc, aParent);
       (new nsAsyncDOMEvent(childContent, mutation))->RunDOMEventWhenSafe();
     }
   }
 }
 
-nsresult
-nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
-                               nsINode* aRefChild)
-{
-  // XXXbz I wish I could assert that nsContentUtils::IsSafeToRunScript() so we
-  // could rely on scriptblockers going out of scope to actually run XBL
-  // teardown, but various crud adds nodes under scriptblockers (e.g. native
-  // anonymous content).  The only good news is those insertions can't trigger
-  // the bad XBL cases.
-  if (!aNewChild || (aReplace && !aRefChild)) {
-    return NS_ERROR_NULL_POINTER;
-  }
-
-  if ((!IsNodeOfType(eDOCUMENT) &&
-       !IsNodeOfType(eDOCUMENT_FRAGMENT) &&
-       !IsElement()) ||
-      !aNewChild->IsNodeOfType(eCONTENT)){
-    return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-  }
-
-  PRUint16 nodeType = aNewChild->NodeType();
-
-  // Before we do anything else, fire all DOMNodeRemoved mutation events
-  // We do this up front as to avoid having to deal with script running
-  // at random places further down.
-  // Scope firing mutation events so that we don't carry any state that
-  // might be stale
-  {
-    // This check happens again further down (though then using IndexOf).
-    // We're only checking this here to avoid firing mutation events when
-    // none should be fired.
-    // It's ok that we do the check twice in the case when firing mutation
-    // events as we need to recheck after running script anyway.
-    if (aRefChild && aRefChild->GetNodeParent() != this) {
-      return NS_ERROR_DOM_NOT_FOUND_ERR;
-    }
-
-    // If we're replacing, fire for node-to-be-replaced.
-    // If aRefChild == aNewChild then we'll fire for it in check below
-    if (aReplace && aRefChild != aNewChild) {
-      nsContentUtils::MaybeFireNodeRemoved(aRefChild, this, OwnerDoc());
-    }
-
-    // If the new node already has a parent, fire for removing from old
-    // parent
-    nsINode* oldParent = aNewChild->GetNodeParent();
-    if (oldParent) {
-      nsContentUtils::MaybeFireNodeRemoved(aNewChild, oldParent,
-                                           aNewChild->OwnerDoc());
-    }
-
-    // If we're inserting a fragment, fire for all the children of the
-    // fragment
-    if (nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
-      static_cast<nsGenericElement*>(aNewChild)->FireNodeRemovedForChildren();
-    }
-  }
-
-  nsIDocument* doc = OwnerDoc();
-  nsIContent* newContent = static_cast<nsIContent*>(aNewChild);
-  if (newContent->IsRootOfAnonymousSubtree()) {
-    // This is anonymous content.  Don't allow its insertion
-    // anywhere, since it might have UnbindFromTree calls coming
-    // its way.
-    return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
-  }
-
-  // Make sure that the inserted node is allowed as a child of its new parent.
-  if (!IsAllowedAsChild(newContent, this, aReplace, aRefChild)) {
-    return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-  }
-
-  // Record the node to insert before, if any
-  nsINode* nodeToInsertBefore;
-  if (aReplace) {
-    nodeToInsertBefore = aRefChild->GetNextSibling();
-  } else {
-    nodeToInsertBefore = aRefChild;
-  }
-  if (nodeToInsertBefore == aNewChild) {
-    // We're going to remove aNewChild from its parent, so use its next sibling
-    // as the node to insert before.
-    nodeToInsertBefore = nodeToInsertBefore->GetNextSibling();
-  }
-
-  Maybe<nsAutoTArray<nsCOMPtr<nsIContent>, 50> > fragChildren;
-
-  // Remove the new child from the old parent if one exists
-  nsCOMPtr<nsINode> oldParent = newContent->GetNodeParent();
-  if (oldParent) {
-    PRInt32 removeIndex = oldParent->IndexOf(newContent);
-    if (removeIndex < 0) {
-      // newContent is anonymous.  We can't deal with this, so just bail
-      NS_ERROR("How come our flags didn't catch this?");
-      return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
-    }
-
-    // Hold a strong ref to nodeToInsertBefore across the removal of newContent
-    nsCOMPtr<nsINode> kungFuDeathGrip = nodeToInsertBefore;
-
-    // Removing a child can run script, via XBL destructors.
-    nsMutationGuard guard;
-
-    // Scope for the mutation batch and scriptblocker, so they go away
-    // while kungFuDeathGrip is still alive.
-    {
-      mozAutoDocUpdate batch(newContent->GetCurrentDoc(),
-                             UPDATE_CONTENT_MODEL, true);
-      nsAutoMutationBatch mb(oldParent, true, true);
-      oldParent->RemoveChildAt(removeIndex, true);
-      if (nsAutoMutationBatch::GetCurrentBatch() == &mb) {
-        mb.RemovalDone();
-        mb.SetPrevSibling(oldParent->GetChildAt(removeIndex - 1));
-        mb.SetNextSibling(oldParent->GetChildAt(removeIndex));
-      }
-    }
-
-    // We expect one mutation (the removal) to have happened.
-    if (guard.Mutated(1)) {
-      // XBL destructors, yuck.
-      
-      // Verify that nodeToInsertBefore, if non-null, is still our child.  If
-      // it's not, there's no way we can do this insert sanely; just bail out.
-      if (nodeToInsertBefore && nodeToInsertBefore->GetParent() != this) {
-        return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-      }
-
-      // Verify that newContent has no parent.
-      if (newContent->GetParent()) {
-        return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-      }
-
-      // And verify that newContent is still allowed as our child.
-      if (aNewChild == aRefChild) {
-        // We've already removed aRefChild.  So even if we were doing a replace,
-        // now we're doing a simple insert before nodeToInsertBefore.
-        if (!IsAllowedAsChild(newContent, this, false, nodeToInsertBefore)) {
-          return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-        }
-      } else {
-        if ((aRefChild && aRefChild->GetParent() != this) ||
-            !IsAllowedAsChild(newContent, this, aReplace, aRefChild)) {
-          return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-        }
-        // And recompute nodeToInsertBefore, just in case.
-        if (aReplace) {
-          nodeToInsertBefore = aRefChild->GetNextSibling();
-        } else {
-          nodeToInsertBefore = aRefChild;
-        }
-      }
-    }
-  } else if (nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
-    // Make sure to remove all the fragment's kids.  We need to do this before
-    // we start inserting anything, so we will run out XBL destructors and
-    // binding teardown (GOD, I HATE THESE THINGS) before we insert anything
-    // into the DOM.
-    PRUint32 count = newContent->GetChildCount();
-
-    fragChildren.construct();
-
-    // Copy the children into a separate array to avoid having to deal with
-    // mutations to the fragment later on here.
-    fragChildren.ref().SetCapacity(count);
-    for (nsIContent* child = newContent->GetFirstChild();
-         child;
-         child = child->GetNextSibling()) {
-      NS_ASSERTION(child->GetCurrentDoc() == nsnull,
-                   "How did we get a child with a current doc?");
-      fragChildren.ref().AppendElement(child);
-    }
-
-    // Hold a strong ref to nodeToInsertBefore across the removals
-    nsCOMPtr<nsINode> kungFuDeathGrip = nodeToInsertBefore;
-
-    nsMutationGuard guard;
-
-    // Scope for the mutation batch and scriptblocker, so they go away
-    // while kungFuDeathGrip is still alive.
-    {
-      mozAutoDocUpdate batch(newContent->GetCurrentDoc(),
-                             UPDATE_CONTENT_MODEL, true);
-      nsAutoMutationBatch mb(newContent, false, true);
-
-      for (PRUint32 i = count; i > 0;) {
-        newContent->RemoveChildAt(--i, true);
-      }
-    }
-
-    // We expect |count| removals
-    if (guard.Mutated(count)) {
-      // XBL destructors, yuck.
-      
-      // Verify that nodeToInsertBefore, if non-null, is still our child.  If
-      // it's not, there's no way we can do this insert sanely; just bail out.
-      if (nodeToInsertBefore && nodeToInsertBefore->GetParent() != this) {
-        return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-      }
-
-      // Verify that all the things in fragChildren have no parent.
-      for (PRUint32 i = 0; i < count; ++i) {
-        if (fragChildren.ref().ElementAt(i)->GetParent()) {
-          return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-        }
-      }
-
-      // Note that unlike the single-element case above, none of our kids can
-      // be aRefChild, so we can always pass through aReplace in the
-      // IsAllowedAsChild checks below and don't have to worry about whether
-      // recomputing nodeToInsertBefore is OK.
-
-      // Verify that our aRefChild is still sensible
-      if (aRefChild && aRefChild->GetParent() != this) {
-        return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-      }
-
-      // Recompute nodeToInsertBefore, just in case.
-      if (aReplace) {
-        nodeToInsertBefore = aRefChild->GetNextSibling();
-      } else {
-        nodeToInsertBefore = aRefChild;
-      }      
-
-      // And verify that newContent is still allowed as our child.  Sadly, we
-      // need to reimplement the relevant part of IsAllowedAsChild() because
-      // now our nodes are in an array and all.  If you change this code,
-      // change the code there.
-      if (IsNodeOfType(nsINode::eDOCUMENT)) {
-        bool sawElement = false;
-        for (PRUint32 i = 0; i < count; ++i) {
-          nsIContent* child = fragChildren.ref().ElementAt(i);
-          if (child->IsElement()) {
-            if (sawElement) {
-              // No good
-              return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-            }
-            sawElement = true;
-          }
-          if (!IsAllowedAsChild(child, this, aReplace, aRefChild)) {
-            return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
-          }
-        }
-      }
-    }
-  }
-
-  mozAutoDocUpdate batch(GetCurrentDoc(), UPDATE_CONTENT_MODEL, true);
-  nsAutoMutationBatch mb;
-
-  // Figure out which index we want to insert at.  Note that we use
-  // nodeToInsertBefore to determine this, because it's possible that
-  // aRefChild == aNewChild, in which case we just removed it from the
-  // parent list.
-  PRInt32 insPos;
-  if (nodeToInsertBefore) {
-    insPos = IndexOf(nodeToInsertBefore);
-    if (insPos < 0) {
-      // XXXbz How the heck would _that_ happen, exactly?
-      return NS_ERROR_DOM_NOT_FOUND_ERR;
-    }
-  }
-  else {
-    insPos = GetChildCount();
-  }
-
-  // If we're replacing and we haven't removed aRefChild yet, do so now
-  if (aReplace && aRefChild != aNewChild) {
-    mb.Init(this, true, true);
-
-    // Since aRefChild is never null in the aReplace case, we know that at
-    // this point nodeToInsertBefore is the next sibling of aRefChild.
-    NS_ASSERTION(aRefChild->GetNextSibling() == nodeToInsertBefore,
-                 "Unexpected nodeToInsertBefore");
-
-    // An since nodeToInsertBefore is at index insPos, we want to remove
-    // at the previous index.
-    NS_ASSERTION(insPos >= 1, "insPos too small");
-    RemoveChildAt(insPos-1, true);
-    --insPos;
-  }
-
-  nsresult res = NS_OK;
-  // Move new child over to our document if needed. Do this after removing
-  // it from its parent so that AdoptNode doesn't fire DOMNodeRemoved
-  // DocumentType nodes are the only nodes that can have a null
-  // ownerDocument according to the DOM spec, and we need to allow
-  // inserting them w/o calling AdoptNode().
-  if (!HasSameOwnerDoc(newContent)) {
-    res = AdoptNodeIntoOwnerDoc(this, aNewChild);
-    NS_ENSURE_SUCCESS(res, res);
-  }
-
-  /*
-   * Check if we're inserting a document fragment. If we are, we need
-   * to actually add its children individually (i.e. we don't add the
-   * actual document fragment).
-   */
-  if (nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
-    PRUint32 count = fragChildren.ref().Length();
-    if (!count) {
-      return NS_OK;
-    }
-
-    if (!aReplace) {
-      mb.Init(this, true, true);
-    }
-    nsAutoMutationBatch* mutationBatch = nsAutoMutationBatch::GetCurrentBatch();
-    if (mutationBatch) {
-      mutationBatch->RemovalDone();
-      mutationBatch->SetPrevSibling(GetChildAt(insPos - 1));
-      mutationBatch->SetNextSibling(GetChildAt(insPos));
-    }
-
-    bool appending =
-      !IsNodeOfType(eDOCUMENT) && PRUint32(insPos) == GetChildCount();
-    PRInt32 firstInsPos = insPos;
-    nsIContent* firstInsertedContent = fragChildren.ref().ElementAt(0);
-
-    // Iterate through the fragment's children, and insert them in the new
-    // parent
-    for (PRUint32 i = 0; i < count; ++i, ++insPos) {
-      // XXXbz how come no reparenting here?  That seems odd...
-      // Insert the child.
-      res = InsertChildAt(fragChildren.ref().ElementAt(i), insPos, !appending);
-      if (NS_FAILED(res)) {
-        // Make sure to notify on any children that we did succeed to insert
-        if (appending && i != 0) {
-          nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
-                                       firstInsertedContent,
-                                       firstInsPos);
-        }
-        return res;
-      }
-    }
-
-    if (mutationBatch && !appending) {
-      mutationBatch->NodesAdded();
-    }
-
-    // Notify and fire mutation events when appending
-    if (appending) {
-      nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
-                                   firstInsertedContent, firstInsPos);
-      if (mutationBatch) {
-        mutationBatch->NodesAdded();
-      }
-      // Optimize for the case when there are no listeners
-      if (nsContentUtils::
-            HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
-        nsGenericElement::FireNodeInserted(doc, this, fragChildren.ref());
-      }
-    }
-  }
-  else {
-    // Not inserting a fragment but rather a single node.
-
-    // FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=544654
-    //       We need to reparent here for nodes for which the parent of their
-    //       wrapper is not the wrapper for their ownerDocument (XUL elements,
-    //       form controls, ...). Also applies in the fragment code above.
-
-    if (nsAutoMutationBatch::GetCurrentBatch() == &mb) {
-      mb.RemovalDone();
-      mb.SetPrevSibling(GetChildAt(insPos - 1));
-      mb.SetNextSibling(GetChildAt(insPos));
-    }
-    res = InsertChildAt(newContent, insPos, true);
-    NS_ENSURE_SUCCESS(res, res);
-  }
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::CompareDocumentPosition(nsIDOMNode* aOther, PRUint16* aReturn)
-{
-  nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
-  if (!other) {
-    return NS_ERROR_NULL_POINTER;
-  }
-  *aReturn = CompareDocPosition(other);
-  return NS_OK;
-}
-
-nsresult
-nsINode::IsEqualNode(nsIDOMNode* aOther, bool* aReturn)
-{
-  nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
-  *aReturn = IsEqualTo(other);
-  return NS_OK;
-}
-
 //----------------------------------------------------------------------
 
 // nsISupports implementation
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericElement)
 
 #define SUBTREE_UNBINDINGS_PER_RUNNABLE 500
 
@@ -4662,17 +2846,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
       tmp->DeleteProperty(nsGkAtoms::itemprop);
     } else if (tmp->IsXUL()) {
       tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
       tmp->DeleteProperty(nsGkAtoms::popuplistener);
     }
   }
 
   // Unlink child content (and unbind our subtree).
-  if (UnoptimizableCCNode(tmp) || !nsCCUncollectableMarker::sGeneration) {
+  if (tmp->UnoptimizableCCNode() || !nsCCUncollectableMarker::sGeneration) {
     PRUint32 childCount = tmp->mAttrsAndChildren.ChildCount();
     if (childCount) {
       // Don't allow script to run while we're unbinding everything.
       nsAutoScriptBlocker scriptBlocker;
       while (childCount-- > 0) {
         // Hold a strong ref to the node when we remove it, because we may be
         // the last reference to it.  We need to call TakeChildAt() and
         // update mFirstChild before calling UnbindFromTree, since this last
@@ -4749,23 +2933,23 @@ nsGenericElement::MarkNodeChildren(nsINo
   }
 }
 
 nsINode*
 FindOptimizableSubtreeRoot(nsINode* aNode)
 {
   nsINode* p;
   while ((p = aNode->GetNodeParent())) {
-    if (UnoptimizableCCNode(aNode)) {
+    if (aNode->UnoptimizableCCNode()) {
       return nsnull;
     }
     aNode = p;
   }
   
-  if (UnoptimizableCCNode(aNode)) {
+  if (aNode->UnoptimizableCCNode()) {
     return nsnull;
   }
   return aNode;
 }
 
 nsAutoTArray<nsINode*, 1020>* gCCBlackMarkedNodes = nsnull;
 
 void
@@ -4796,17 +2980,17 @@ nsGenericElement::CanSkipInCC(nsINode* a
   nsIDocument* currentDoc = aNode->GetCurrentDoc();
   if (currentDoc &&
       nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
     return !NeedsScriptTraverse(aNode);
   }
 
   // Bail out early if aNode is somewhere in anonymous content,
   // or otherwise unusual.
-  if (UnoptimizableCCNode(aNode)) {
+  if (aNode->UnoptimizableCCNode()) {
     return false;
   }
 
   nsINode* root =
     currentDoc ? static_cast<nsINode*>(currentDoc) :
                  FindOptimizableSubtreeRoot(aNode);
   if (!root) {
     return false;
@@ -4955,17 +3139,17 @@ OwnedByBindingManager(nsIDocument* aCurr
 bool
 nsGenericElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
 {
   // Don't try to optimize anything during shutdown.
   if (nsCCUncollectableMarker::sGeneration == 0) {
     return false;
   }
 
-  bool unoptimizable = UnoptimizableCCNode(aNode);
+  bool unoptimizable = aNode->UnoptimizableCCNode();
   nsIDocument* currentDoc = aNode->GetCurrentDoc();
   if (currentDoc &&
       nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration()) &&
       (!unoptimizable || NodeHasActiveFrame(currentDoc, aNode) ||
        OwnedByBindingManager(currentDoc, aNode))) {
     MarkNodeChildren(aNode);
     return true;
   }
@@ -6214,47 +4398,16 @@ nsGenericElement::FireNodeRemovedForChil
 }
 
 void
 nsGenericElement::GetLinkTarget(nsAString& aTarget)
 {
   aTarget.Truncate();
 }
 
-static void
-nsCOMArrayDeleter(void* aObject, nsIAtom* aPropertyName,
-                  void* aPropertyValue, void* aData)
-{
-  nsCOMArray<nsISupports>* objects =
-    static_cast<nsCOMArray<nsISupports>*>(aPropertyValue);
-  delete objects;
-}
-
-void
-nsINode::BindObject(nsISupports* aObject)
-{
-  nsCOMArray<nsISupports>* objects =
-    static_cast<nsCOMArray<nsISupports>*>(GetProperty(nsGkAtoms::keepobjectsalive));
-  if (!objects) {
-    objects = new nsCOMArray<nsISupports>();
-    SetProperty(nsGkAtoms::keepobjectsalive, objects, nsCOMArrayDeleter, true);
-  }
-  objects->AppendObject(aObject);
-}
-
-void
-nsINode::UnbindObject(nsISupports* aObject)
-{
-  nsCOMArray<nsISupports>* objects =
-    static_cast<nsCOMArray<nsISupports>*>(GetProperty(nsGkAtoms::keepobjectsalive));
-  if (objects) {
-    objects->RemoveObject(aObject);
-  }
-}
-
 // NOTE: The aPresContext pointer is NOT addrefed.
 // *aSelectorList might be null even if NS_OK is returned; this
 // happens when all the selectors were pseudo-element selectors.
 static nsresult
 ParseSelectorList(nsINode* aNode,
                   const nsAString& aSelectorString,
                   nsCSSSelectorList** aSelectorList)
 {
@@ -6436,37 +4589,16 @@ nsGenericElement::MozMatchesSelector(con
 
   nsresult rv;
   *aReturn = MozMatchesSelector(aSelector, &rv);
 
   return rv;
 }
 
 size_t
-nsINode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
-{
-  size_t n = 0;
-  nsEventListenerManager* elm =
-    const_cast<nsINode*>(this)->GetListenerManager(false);
-  if (elm) {
-    n += elm->SizeOfIncludingThis(aMallocSizeOf);
-  }
-
-  // Measurement of the following members may be added later if DMD finds it is
-  // worthwhile:
-  // - mNodeInfo (Nb: allocated in nsNodeInfo.cpp with a nsFixedSizeAllocator)
-  // - mSlots
-  //
-  // The following members are not measured:
-  // - mParent, mNextSibling, mPreviousSibling, mFirstChild: because they're
-  //   non-owning
-  return n;
-}
-
-size_t
 nsGenericElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
   return Element::SizeOfExcludingThis(aMallocSizeOf) +
          mAttrsAndChildren.SizeOfExcludingThis(aMallocSizeOf);
 }
 
 static const nsAttrValue::EnumTable kCORSAttributeTable[] = {
   // Order matters here
@@ -6505,46 +4637,16 @@ nsGenericElement::AttrValueToCORSMode(co
 {
   if (!aValue) {
     return CORS_NONE;
   }
 
   return CORSMode(aValue->GetEnumValue());
 }
 
-#define EVENT(name_, id_, type_, struct_)                                    \
-  NS_IMETHODIMP nsINode::GetOn##name_(JSContext *cx, jsval *vp) {            \
-    nsEventListenerManager *elm = GetListenerManager(false);              \
-    if (elm) {                                                               \
-      elm->GetJSEventListener(nsGkAtoms::on##name_, vp);                     \
-    } else {                                                                 \
-      *vp = JSVAL_NULL;                                                      \
-    }                                                                        \
-    return NS_OK;                                                            \
-  }                                                                          \
-  NS_IMETHODIMP nsINode::SetOn##name_(JSContext *cx, const jsval &v) {       \
-    nsEventListenerManager *elm = GetListenerManager(true);               \
-    if (!elm) {                                                              \
-      return NS_ERROR_OUT_OF_MEMORY;                                         \
-    }                                                                        \
-                                                                             \
-    JSObject *obj = GetWrapper();                                            \
-    if (!obj) {                                                              \
-      /* Just silently do nothing */                                         \
-      return NS_OK;                                                          \
-    }                                                                        \
-    return elm->SetJSEventListenerToJsval(nsGkAtoms::on##name_, cx, obj, v); \
-}
-#define TOUCH_EVENT EVENT
-#define DOCUMENT_ONLY_EVENT EVENT
-#include "nsEventNameList.h"
-#undef DOCUMENT_ONLY_EVENT
-#undef TOUCH_EVENT
-#undef EVENT
-
 NS_IMETHODIMP
 nsGenericElement::GetOnmouseenter(JSContext* cx, JS::Value* vp)
 {
   return nsINode::GetOnmouseenter(cx, vp);
 }
 
 NS_IMETHODIMP
 nsGenericElement::SetOnmouseenter(JSContext* cx, const JS::Value& v)
@@ -6559,85 +4661,23 @@ nsGenericElement::GetOnmouseleave(JSCont
 }
 
 NS_IMETHODIMP
 nsGenericElement::SetOnmouseleave(JSContext* cx, const JS::Value& v)
 {
   return nsINode::SetOnmouseleave(cx, v);
 }
 
-bool
-nsINode::Contains(const nsINode* aOther) const
-{
-  if (aOther == this) {
-    return true;
-  }
-  if (!aOther ||
-      OwnerDoc() != aOther->OwnerDoc() ||
-      IsInDoc() != aOther->IsInDoc() ||
-      !(aOther->IsElement() ||
-        aOther->IsNodeOfType(nsINode::eCONTENT)) ||
-      !GetFirstChild()) {
-    return false;
-  }
-
-  const nsIContent* other = static_cast<const nsIContent*>(aOther);
-  if (this == OwnerDoc()) {
-    // document.contains(aOther) returns true if aOther is in the document,
-    // but is not in any anonymous subtree.
-    // IsInDoc() check is done already before this.
-    return !other->IsInAnonymousSubtree();
-  }
-
-  if (!IsElement() && !IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT)) {
-    return false;
-  }
-
-  const nsIContent* thisContent = static_cast<const nsIContent*>(this);
-  if (thisContent->GetBindingParent() != other->GetBindingParent()) {
-    return false;
-  }
-
-  return nsContentUtils::ContentIsDescendantOf(other, this);
-}
-
-nsresult
-nsINode::Contains(nsIDOMNode* aOther, bool* aReturn)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(aOther);
-  *aReturn = Contains(node);
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 nsGenericElement::MozRequestPointerLock()
 {
   OwnerDoc()->RequestPointerLock(this);
   return NS_OK;
 }
 
-PRUint32
-nsINode::Length() const
-{
-  switch (NodeType()) {
-  case nsIDOMNode::DOCUMENT_TYPE_NODE:
-    return 0;
-
-  case nsIDOMNode::TEXT_NODE:
-  case nsIDOMNode::CDATA_SECTION_NODE:
-  case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
-  case nsIDOMNode::COMMENT_NODE:
-    MOZ_ASSERT(IsNodeOfType(eCONTENT));
-    return static_cast<const nsIContent*>(this)->TextLength();
-
-  default:
-    return GetChildCount();
-  }
-}
-
 static const char*
 GetFullScreenError(nsIDocument* aDoc)
 {
   if (!nsContentUtils::IsRequestFullScreenAllowed()) {
     return "FullScreenDeniedNotInputDriven";
   }
   
   if (nsContentUtils::IsSitePermDeny(aDoc->NodePrincipal(), "fullscreen")) {
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -772,16 +772,23 @@ protected:
    * Retrieve the rectangle for the offsetX properties, which
    * are coordinates relative to the returned aOffsetParent.
    *
    * @param aRect offset rectangle
    * @param aOffsetParent offset parent
    */
   virtual void GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent);
 
+  /**
+   * Retrieve the size of the padding rect of this element.
+   *
+   * @param aSize the size of the padding rect
+   */
+  nsIntSize GetPaddingRectSize();
+
   nsIFrame* GetStyledFrame();
 
   virtual mozilla::dom::Element* GetNameSpaceElement()
   {
     return this;
   }
 
   nsresult GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -196,23 +196,24 @@ GK_ATOM(combobox, "combobox")
 GK_ATOM(command, "command")
 GK_ATOM(commands, "commands")
 GK_ATOM(commandset, "commandset")
 GK_ATOM(commandupdate, "commandupdate")
 GK_ATOM(commandupdater, "commandupdater")
 GK_ATOM(comment, "comment")
 GK_ATOM(compact, "compact")
 GK_ATOM(concat, "concat")
-GK_ATOM(contenteditable, "contenteditable")
 GK_ATOM(conditions, "conditions")
 GK_ATOM(constructor, "constructor")
+GK_ATOM(consumeoutsideclicks, "consumeoutsideclicks")
 GK_ATOM(container, "container")
 GK_ATOM(containment, "containment")
 GK_ATOM(contains, "contains")
 GK_ATOM(content, "content")
+GK_ATOM(contenteditable, "contenteditable")
 GK_ATOM(headerContentDisposition, "content-disposition")
 GK_ATOM(headerContentLanguage, "content-language")
 GK_ATOM(contentLocation, "content-location")
 GK_ATOM(headerContentScriptType, "content-script-type")
 GK_ATOM(headerContentStyleType, "content-style-type")
 GK_ATOM(headerContentType, "content-type")
 GK_ATOM(context, "context")
 GK_ATOM(contextmenu, "contextmenu")
copy from content/base/src/nsGenericElement.cpp
copy to content/base/src/nsINode.cpp
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsINode.cpp
@@ -1,147 +1,113 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=79: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
- * Base class for all element classes; this provides an implementation
- * of DOM Core's nsIDOMElement, implements nsIContent, provides
- * utility methods for subclasses, and so forth.
+ * Base class for all DOM nodes.
  */
 
-#include "mozilla/Util.h"
+#include "nsINode.h"
 
-#include "nsGenericElement.h"
-
+#include "jsapi.h"
+#include "mozAutoDocUpdate.h"
+#include "mozilla/CORSMode.h"
+#include "mozilla/Telemetry.h"
+#include "mozilla/Util.h"
+#include "nsAsyncDOMEvent.h"
+#include "nsAttrValueOrString.h"
+#include "nsBindingManager.h"
+#include "nsCCUncollectableMarker.h"
+#include "nsClientRect.h"
+#include "nsContentCreatorFunctions.h"
+#include "nsContentList.h"
+#include "nsContentUtils.h"
+#include "nsCycleCollectionParticipant.h"
+#include "nsCycleCollector.h"
+#include "nsDocument.h"
 #include "nsDOMAttribute.h"
 #include "nsDOMAttributeMap.h"
-#include "nsIAtom.h"
-#include "nsINodeInfo.h"
-#include "nsIDocument.h"
-#include "nsIDOMNodeList.h"
-#include "nsIDOMDocument.h"
-#include "nsIContentIterator.h"
+#include "nsDOMCID.h"
+#include "nsDOMCSSAttrDeclaration.h"
+#include "nsDOMError.h"
+#include "nsDOMMutationObserver.h"
+#include "nsDOMString.h"
+#include "nsDOMTokenList.h"
+#include "nsEventDispatcher.h"
 #include "nsEventListenerManager.h"
-#include "nsFocusManager.h"
-#include "nsILinkHandler.h"
-#include "nsIScriptGlobalObject.h"
-#include "nsIURL.h"
-#include "nsNetUtil.h"
-#include "nsIFrame.h"
-#include "nsIAnonymousContentCreator.h"
-#include "nsIPresShell.h"
-#include "nsPresContext.h"
-#include "nsStyleConsts.h"
-#include "nsString.h"
-#include "nsUnicharUtils.h"
 #include "nsEventStateManager.h"
-#include "nsIDOMEvent.h"
-#include "nsDOMCID.h"
-#include "nsIServiceManager.h"
-#include "nsIDOMCSSStyleDeclaration.h"
-#include "nsDOMCSSAttrDeclaration.h"
-#include "nsINameSpaceManager.h"
-#include "nsContentList.h"
-#include "nsDOMTokenList.h"
-#include "nsXBLPrototypeBinding.h"
-#include "nsDOMError.h"
-#include "nsDOMString.h"
-#include "nsIScriptSecurityManager.h"
-#include "nsIDOMMutationEvent.h"
-#include "nsMutationEvent.h"
-#include "nsNodeUtils.h"
-#include "nsDocument.h"
-#include "nsAttrValueOrString.h"
-#ifdef MOZ_XUL
-#include "nsXULElement.h"
-#endif /* MOZ_XUL */
+#include "nsFocusManager.h"
 #include "nsFrameManager.h"
 #include "nsFrameSelection.h"
-#ifdef DEBUG
-#include "nsRange.h"
-#endif
-
-#include "nsBindingManager.h"
-#include "nsXBLBinding.h"
-#include "nsPIDOMWindow.h"
-#include "nsPIBoxObject.h"
-#include "nsClientRect.h"
-#include "nsSVGUtils.h"
-#include "nsLayoutUtils.h"
+#include "nsGenericElement.h"
+#include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
-#include "nsContentUtils.h"
-#include "nsIJSContextStack.h"
-
-#include "nsIDOMEventListener.h"
-#include "nsIWebNavigation.h"
+#include "nsIAnonymousContentCreator.h"
+#include "nsIAtom.h"
 #include "nsIBaseWindow.h"
-#include "nsIWidget.h"
-
-#include "jsapi.h"
-
-#include "nsNodeInfoManager.h"
 #include "nsICategoryManager.h"
+#include "nsIContentIterator.h"
+#include "nsIControllers.h"
+#include "nsIDocument.h"
+#include "nsIDOMDocument.h"
 #include "nsIDOMDocumentType.h"
+#include "nsIDOMEvent.h"
+#include "nsIDOMEventListener.h"
+#include "nsIDOMMutationEvent.h"
+#include "nsIDOMNodeList.h"
 #include "nsIDOMUserDataHandler.h"
-#include "nsGenericHTMLElement.h"
+#include "nsIEditorDocShell.h"
 #include "nsIEditor.h"
 #include "nsIEditorIMESupport.h"
-#include "nsIEditorDocShell.h"
-#include "nsEventDispatcher.h"
-#include "nsContentCreatorFunctions.h"
-#include "nsIControllers.h"
+#include "nsIFrame.h"
+#include "nsIJSContextStack.h"
+#include "nsILinkHandler.h"
+#include "nsINameSpaceManager.h"
+#include "nsINodeInfo.h"
+#include "nsIPresShell.h"
+#include "nsIScriptError.h"
+#include "nsIScriptGlobalObject.h"
+#include "nsIScriptSecurityManager.h"
+#include "nsIScrollableFrame.h"
+#include "nsIServiceManager.h"
+#include "nsIURL.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
-#include "nsIScrollableFrame.h"
-#include "nsXBLInsertionPoint.h"
-#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
-#include "nsCSSRuleProcessor.h"
+#include "nsIWebNavigation.h"
+#include "nsIWidget.h"
+#include "nsLayoutStatics.h"
+#include "nsLayoutUtils.h"
+#include "nsMutationEvent.h"
+#include "nsNetUtil.h"
+#include "nsNodeInfoManager.h"
+#include "nsNodeUtils.h"
+#include "nsPIBoxObject.h"
+#include "nsPIDOMWindow.h"
+#include "nsPresContext.h"
 #include "nsRuleProcessorData.h"
-#include "nsAsyncDOMEvent.h"
+#include "nsString.h"
+#include "nsStyleConsts.h"
+#include "nsSVGFeatures.h"
+#include "nsSVGUtils.h"
 #include "nsTextNode.h"
-#include "dombindings.h"
-
-#ifdef MOZ_XUL
-#include "nsIXULDocument.h"
-#endif /* MOZ_XUL */
-
-#include "nsCycleCollectionParticipant.h"
-#include "nsCCUncollectableMarker.h"
+#include "nsUnicharUtils.h"
+#include "nsXBLBinding.h"
+#include "nsXBLInsertionPoint.h"
+#include "nsXBLPrototypeBinding.h"
+#include "prprf.h"
+#include "xpcpublic.h"
 
-#include "mozAutoDocUpdate.h"
-
-#include "nsCSSParser.h"
-#include "prprf.h"
-#include "nsDOMMutationObserver.h"
-#include "nsSVGFeatures.h"
 #include "nsWrapperCacheInlines.h"
-#include "nsCycleCollector.h"
-#include "xpcpublic.h"
-#include "nsIScriptError.h"
-#include "nsLayoutStatics.h"
-#include "mozilla/Telemetry.h"
-
-#include "mozilla/CORSMode.h"
-
-#include "nsStyledElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
-
-PRInt32 nsIContent::sTabFocusModel = eTabFocus_any;
-bool nsIContent::sTabFocusModelAppliesToXUL = false;
-PRUint32 nsMutationGuard::sMutationCount = 0;
-
-//----------------------------------------------------------------------
-
 nsINode::nsSlots::~nsSlots()
 {
   if (mChildNodes) {
     mChildNodes->DropReference();
     NS_RELEASE(mChildNodes);
   }
 
   if (mWeakReference) {
@@ -261,30 +227,16 @@ nsINode::GetTextEditorRootContent(nsIEdi
     nsIContent* rootContent = GetEditorRootContent(editor);
     if (aEditor)
       editor.swap(*aEditor);
     return rootContent;
   }
   return nsnull;
 }
 
-static nsIEditor* GetHTMLEditor(nsPresContext* aPresContext)
-{
-  nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
-  nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(container));
-  bool isEditable;
-  if (!editorDocShell ||
-      NS_FAILED(editorDocShell->GetEditable(&isEditable)) || !isEditable)
-    return nsnull;
-
-  nsCOMPtr<nsIEditor> editor;
-  editorDocShell->GetEditor(getter_AddRefs(editor));
-  return editor;
-}
-
 static nsIContent* GetRootForContentSubtree(nsIContent* aContent)
 {
   NS_ENSURE_TRUE(aContent, nsnull);
   nsIContent* stop = aContent->GetBindingParent();
   while (aContent) {
     nsIContent* parent = aContent->GetParent();
     if (parent == stop) {
       break;
@@ -312,17 +264,17 @@ nsINode::GetSelectionRootContent(nsIPres
     // This node should be a descendant of input/textarea editor.
     nsIContent* content = GetTextEditorRootContent();
     if (content)
       return content;
   }
 
   nsPresContext* presContext = aPresShell->GetPresContext();
   if (presContext) {
-    nsIEditor* editor = GetHTMLEditor(presContext);
+    nsIEditor* editor = nsContentUtils::GetHTMLEditor(presContext);
     if (editor) {
       // This node is in HTML editor.
       nsIDocument* doc = GetCurrentDoc();
       if (!doc || doc->HasFlag(NODE_IS_EDITABLE) ||
           !HasFlag(NODE_IS_EDITABLE)) {
         nsIContent* editorRoot = GetEditorRootContent(editor);
         NS_ENSURE_TRUE(editorRoot, nsnull);
         return nsContentUtils::IsInSameAnonymousTree(this, editorRoot) ?
@@ -1161,29 +1113,29 @@ nsINode::GetContextForEventHandlers(nsre
 /* static */
 void
 nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
 {
   nsContentUtils::TraceWrapper(tmp, cb, closure);
 }
 
 
-static
-bool UnoptimizableCCNode(nsINode* aNode)
+bool
+nsINode::UnoptimizableCCNode() const
 {
   const PtrBits problematicFlags = (NODE_IS_ANONYMOUS |
                                     NODE_IS_IN_ANONYMOUS_SUBTREE |
                                     NODE_IS_NATIVE_ANONYMOUS_ROOT |
                                     NODE_MAY_BE_IN_BINDING_MNGR |
                                     NODE_IS_INSERTION_PARENT);
-  return aNode->HasFlag(problematicFlags) ||
-         aNode->NodeType() == nsIDOMNode::ATTRIBUTE_NODE ||
+  return HasFlag(problematicFlags) ||
+         NodeType() == nsIDOMNode::ATTRIBUTE_NODE ||
          // For strange cases like xbl:content/xbl:children
-         (aNode->IsElement() &&
-          aNode->AsElement()->IsInNamespace(kNameSpaceID_XBL));
+         (IsElement() &&
+          AsElement()->IsInNamespace(kNameSpaceID_XBL));
 }
 
 /* static */
 bool
 nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
 {
   if (NS_LIKELY(!cb.WantAllTraces())) {
     nsIDocument *currentDoc = tmp->GetCurrentDoc();
@@ -1193,25 +1145,25 @@ nsINode::Traverse(nsINode *tmp, nsCycleC
     }
 
     if (nsCCUncollectableMarker::sGeneration) {
       // If we're black no need to traverse.
       if (tmp->IsBlack() || tmp->InCCBlackTree()) {
         return false;
       }
 
-      if (!UnoptimizableCCNode(tmp)) {
+      if (!tmp->UnoptimizableCCNode()) {
         // If we're in a black document, return early.
         if ((currentDoc && currentDoc->IsBlack())) {
           return false;
         }
         // If we're not in anonymous content and we have a black parent,
         // return early.
         nsIContent* parent = tmp->GetParent();
-        if (parent && !UnoptimizableCCNode(parent) && parent->IsBlack()) {
+        if (parent && !parent->UnoptimizableCCNode() && parent->IsBlack()) {
           NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
           return false;
         }
       }
     }
   }
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
@@ -1259,395 +1211,16 @@ nsINode::Unlink(nsINode *tmp)
   }
 
   if (tmp->HasProperties()) {
     nsNodeUtils::UnlinkUserData(tmp);
     tmp->DeleteProperty(nsGkAtoms::keepobjectsalive);
   }
 }
 
-//----------------------------------------------------------------------
-
-nsEventStates
-Element::IntrinsicState() const
-{
-  return IsEditable() ? NS_EVENT_STATE_MOZ_READWRITE :
-                        NS_EVENT_STATE_MOZ_READONLY;
-}
-
-void
-Element::NotifyStateChange(nsEventStates aStates)
-{
-  nsIDocument* doc = GetCurrentDoc();
-  if (doc) {
-    nsAutoScriptBlocker scriptBlocker;
-    doc->ContentStateChanged(this, aStates);
-  }
-}
-
-void
-Element::UpdateLinkState(nsEventStates aState)
-{
-  NS_ABORT_IF_FALSE(!aState.HasAtLeastOneOfStates(~(NS_EVENT_STATE_VISITED |
-                                                    NS_EVENT_STATE_UNVISITED)),
-                    "Unexpected link state bits");
-  mState =
-    (mState & ~(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) |
-    aState;
-}
-
-void
-Element::UpdateState(bool aNotify)
-{
-  nsEventStates oldState = mState;
-  mState = IntrinsicState() | (oldState & ESM_MANAGED_STATES);
-  if (aNotify) {
-    nsEventStates changedStates = oldState ^ mState;
-    if (!changedStates.IsEmpty()) {
-      nsIDocument* doc = GetCurrentDoc();
-      if (doc) {
-        nsAutoScriptBlocker scriptBlocker;
-        doc->ContentStateChanged(this, changedStates);
-      }
-    }
-  }
-}
-
-void
-nsIContent::UpdateEditableState(bool aNotify)
-{
-  // Guaranteed to be non-element content
-  NS_ASSERTION(!IsElement(), "What happened here?");
-  nsIContent *parent = GetParent();
-
-  SetEditableFlag(parent && parent->HasFlag(NODE_IS_EDITABLE));
-}
-
-void
-nsGenericElement::UpdateEditableState(bool aNotify)
-{
-  nsIContent *parent = GetParent();
-
-  SetEditableFlag(parent && parent->HasFlag(NODE_IS_EDITABLE));
-  if (aNotify) {
-    UpdateState(aNotify);
-  } else {
-    // Avoid calling UpdateState in this very common case, because
-    // this gets called for pretty much every single element on
-    // insertion into the document and UpdateState can be slow for
-    // some kinds of elements even when not notifying.
-    if (IsEditable()) {
-      RemoveStatesSilently(NS_EVENT_STATE_MOZ_READONLY);
-      AddStatesSilently(NS_EVENT_STATE_MOZ_READWRITE);
-    } else {
-      RemoveStatesSilently(NS_EVENT_STATE_MOZ_READWRITE);
-      AddStatesSilently(NS_EVENT_STATE_MOZ_READONLY);
-    }
-  }
-}
-
-nsEventStates
-Element::StyleStateFromLocks() const
-{
-  nsEventStates locks = LockedStyleStates();
-  nsEventStates state = mState | locks;
-
-  if (locks.HasState(NS_EVENT_STATE_VISITED)) {
-    return state & ~NS_EVENT_STATE_UNVISITED;
-  }
-  if (locks.HasState(NS_EVENT_STATE_UNVISITED)) {
-    return state & ~NS_EVENT_STATE_VISITED;
-  }
-  return state;
-}
-
-nsEventStates
-Element::LockedStyleStates() const
-{
-  nsEventStates *locks =
-    static_cast<nsEventStates*> (GetProperty(nsGkAtoms::lockedStyleStates));
-  if (locks) {
-    return *locks;
-  }
-  return nsEventStates();
-}
-
-static void
-nsEventStatesPropertyDtor(void *aObject, nsIAtom *aProperty,
-                          void *aPropertyValue, void *aData)
-{
-  nsEventStates *states = static_cast<nsEventStates*>(aPropertyValue);
-  delete states;
-}
-
-void
-Element::NotifyStyleStateChange(nsEventStates aStates)
-{
-  nsIDocument* doc = GetCurrentDoc();
-  if (doc) {
-    nsIPresShell *presShell = doc->GetShell();
-    if (presShell) {
-      nsAutoScriptBlocker scriptBlocker;
-      presShell->ContentStateChanged(doc, this, aStates);
-    }
-  }
-}
-
-void
-Element::LockStyleStates(nsEventStates aStates)
-{
-  nsEventStates *locks = new nsEventStates(LockedStyleStates());
-
-  *locks |= aStates;
-
-  if (aStates.HasState(NS_EVENT_STATE_VISITED)) {
-    *locks &= ~NS_EVENT_STATE_UNVISITED;
-  }
-  if (aStates.HasState(NS_EVENT_STATE_UNVISITED)) {
-    *locks &= ~NS_EVENT_STATE_VISITED;
-  }
-
-  SetProperty(nsGkAtoms::lockedStyleStates, locks, nsEventStatesPropertyDtor);
-  SetHasLockedStyleStates();
-
-  NotifyStyleStateChange(aStates);
-}
-
-void
-Element::UnlockStyleStates(nsEventStates aStates)
-{
-  nsEventStates *locks = new nsEventStates(LockedStyleStates());
-
-  *locks &= ~aStates;
-
-  if (locks->IsEmpty()) {
-    DeleteProperty(nsGkAtoms::lockedStyleStates);
-    ClearHasLockedStyleStates();
-    delete locks;
-  }
-  else {
-    SetProperty(nsGkAtoms::lockedStyleStates, locks, nsEventStatesPropertyDtor);
-  }
-
-  NotifyStyleStateChange(aStates);
-}
-
-void
-Element::ClearStyleStateLocks()
-{
-  nsEventStates locks = LockedStyleStates();
-
-  DeleteProperty(nsGkAtoms::lockedStyleStates);
-  ClearHasLockedStyleStates();
-
-  NotifyStyleStateChange(locks);
-}
-
-nsIContent*
-nsIContent::FindFirstNonNativeAnonymous() const
-{
-  // This handles also nested native anonymous content.
-  for (const nsIContent *content = this; content;
-       content = content->GetBindingParent()) {
-    if (!content->IsInNativeAnonymousSubtree()) {
-      // Oops, this function signature allows casting const to
-      // non-const.  (Then again, so does GetChildAt(0)->GetParent().)
-      return const_cast<nsIContent*>(content);
-    }
-  }
-  return nsnull;
-}
-
-nsIContent*
-nsIContent::GetFlattenedTreeParent() const
-{
-  nsIContent *parent = GetParent();
-  if (parent && parent->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
-    nsIDocument *doc = parent->OwnerDoc();
-    nsIContent* insertionElement =
-      doc->BindingManager()->GetNestedInsertionPoint(parent, this);
-    if (insertionElement) {
-      parent = insertionElement;
-    }
-  }
-  return parent;
-}
-
-nsIContent::IMEState
-nsIContent::GetDesiredIMEState()
-{
-  if (!IsEditableInternal()) {
-    // Check for the special case where we're dealing with elements which don't
-    // have the editable flag set, but are readwrite (such as text controls).
-    if (!IsElement() ||
-        !AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
-      return IMEState(IMEState::DISABLED);
-    }
-  }
-  // NOTE: The content for independent editors (e.g., input[type=text],
-  // textarea) must override this method, so, we don't need to worry about
-  // that here.
-  nsIContent *editableAncestor = GetEditingHost();
-
-  // This is in another editable content, use the result of it.
-  if (editableAncestor && editableAncestor != this) {
-    return editableAncestor->GetDesiredIMEState();
-  }
-  nsIDocument* doc = GetCurrentDoc();
-  if (!doc) {
-    return IMEState(IMEState::DISABLED);
-  }
-  nsIPresShell* ps = doc->GetShell();
-  if (!ps) {
-    return IMEState(IMEState::DISABLED);
-  }
-  nsPresContext* pc = ps->GetPresContext();
-  if (!pc) {
-    return IMEState(IMEState::DISABLED);
-  }
-  nsIEditor* editor = GetHTMLEditor(pc);
-  nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(editor);
-  if (!imeEditor) {
-    return IMEState(IMEState::DISABLED);
-  }
-  IMEState state;
-  imeEditor->GetPreferredIMEState(&state);
-  return state;
-}
-
-bool
-nsIContent::HasIndependentSelection()
-{
-  nsIFrame* frame = GetPrimaryFrame();
-  return (frame && frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION);
-}
-
-dom::Element*
-nsIContent::GetEditingHost()
-{
-  // If this isn't editable, return NULL.
-  NS_ENSURE_TRUE(IsEditableInternal(), nsnull);
-
-  nsIDocument* doc = GetCurrentDoc();
-  NS_ENSURE_TRUE(doc, nsnull);
-  // If this is in designMode, we should return <body>
-  if (doc->HasFlag(NODE_IS_EDITABLE)) {
-    return doc->GetBodyElement();
-  }
-
-  nsIContent* content = this;
-  for (dom::Element* parent = GetElementParent();
-       parent && parent->HasFlag(NODE_IS_EDITABLE);
-       parent = content->GetElementParent()) {
-    content = parent;
-  }
-  return content->AsElement();
-}
-
-nsresult
-nsIContent::LookupNamespaceURIInternal(const nsAString& aNamespacePrefix,
-                                       nsAString& aNamespaceURI) const
-{
-  if (aNamespacePrefix.EqualsLiteral("xml")) {
-    // Special-case for xml prefix
-    aNamespaceURI.AssignLiteral("http://www.w3.org/XML/1998/namespace");
-    return NS_OK;
-  }
-
-  if (aNamespacePrefix.EqualsLiteral("xmlns")) {
-    // Special-case for xmlns prefix
-    aNamespaceURI.AssignLiteral("http://www.w3.org/2000/xmlns/");
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIAtom> name;
-  if (!aNamespacePrefix.IsEmpty()) {
-    name = do_GetAtom(aNamespacePrefix);
-    NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
-  }
-  else {
-    name = nsGkAtoms::xmlns;
-  }
-  // Trace up the content parent chain looking for the namespace
-  // declaration that declares aNamespacePrefix.
-  const nsIContent* content = this;
-  do {
-    if (content->GetAttr(kNameSpaceID_XMLNS, name, aNamespaceURI))
-      return NS_OK;
-  } while ((content = content->GetParent()));
-  return NS_ERROR_FAILURE;
-}
-
-already_AddRefed<nsIURI>
-nsIContent::GetBaseURI() const
-{
-  nsIDocument* doc = OwnerDoc();
-  // Start with document base
-  nsCOMPtr<nsIURI> base = doc->GetDocBaseURI();
-
-  // Collect array of xml:base attribute values up the parent chain. This
-  // is slightly slower for the case when there are xml:base attributes, but
-  // faster for the far more common case of there not being any such
-  // attributes.
-  // Also check for SVG elements which require special handling
-  nsAutoTArray<nsString, 5> baseAttrs;
-  nsString attr;
-  const nsIContent *elem = this;
-  do {
-    // First check for SVG specialness (why is this SVG specific?)
-    if (elem->IsSVG()) {
-      nsIContent* bindingParent = elem->GetBindingParent();
-      if (bindingParent) {
-        nsXBLBinding* binding =
-          bindingParent->OwnerDoc()->BindingManager()->GetBinding(bindingParent);
-        if (binding) {
-          // XXX sXBL/XBL2 issue
-          // If this is an anonymous XBL element use the binding
-          // document for the base URI. 
-          // XXX Will fail with xml:base
-          base = binding->PrototypeBinding()->DocURI();
-          break;
-        }
-      }
-    }
-
-    nsIURI* explicitBaseURI = elem->GetExplicitBaseURI();
-    if (explicitBaseURI) {
-      base = explicitBaseURI;
-      break;
-    }
-    
-    // Otherwise check for xml:base attribute
-    elem->GetAttr(kNameSpaceID_XML, nsGkAtoms::base, attr);
-    if (!attr.IsEmpty()) {
-      baseAttrs.AppendElement(attr);
-    }
-    elem = elem->GetParent();
-  } while(elem);
-  
-  // Now resolve against all xml:base attrs
-  for (PRUint32 i = baseAttrs.Length() - 1; i != PRUint32(-1); --i) {
-    nsCOMPtr<nsIURI> newBase;
-    nsresult rv = NS_NewURI(getter_AddRefs(newBase), baseAttrs[i],
-                            doc->GetDocumentCharacterSet().get(), base);
-    // Do a security check, almost the same as nsDocument::SetBaseURL()
-    // Only need to do this on the final uri
-    if (NS_SUCCEEDED(rv) && i == 0) {
-      rv = nsContentUtils::GetSecurityManager()->
-        CheckLoadURIWithPrincipal(NodePrincipal(), newBase,
-                                  nsIScriptSecurityManager::STANDARD);
-    }
-    if (NS_SUCCEEDED(rv)) {
-      base.swap(newBase);
-    }
-  }
-
-  return base.forget();
-}
-
 static void
 ReleaseURI(void*, /* aObject*/
            nsIAtom*, /* aPropertyName */
            void* aPropertyValue,
            void* /* aData */)
 {
   nsIURI* uri = static_cast<nsIURI*>(aPropertyValue);
   NS_RELEASE(uri);
@@ -1659,2076 +1232,16 @@ nsINode::SetExplicitBaseURI(nsIURI* aURI
   nsresult rv = SetProperty(nsGkAtoms::baseURIProperty, aURI, ReleaseURI);
   if (NS_SUCCEEDED(rv)) {
     SetHasExplicitBaseURI();
     NS_ADDREF(aURI);
   }
   return rv;
 }
 
-//----------------------------------------------------------------------
-
-static inline JSObject*
-GetJSObjectChild(nsWrapperCache* aCache)
-{
-  return aCache->PreservingWrapper() ? aCache->GetWrapperPreserveColor() : NULL;
-}
-
-static bool
-NeedsScriptTraverse(nsWrapperCache* aCache)
-{
-  JSObject* o = GetJSObjectChild(aCache);
-  return o && xpc_IsGrayGCThing(o);
-}
-
-//----------------------------------------------------------------------
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsChildContentList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsChildContentList)
-
-// If nsChildContentList is changed so that any additional fields are
-// traversed by the cycle collector, then CAN_SKIP must be updated to
-// check that the additional fields are null.
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsChildContentList)
-
-// nsChildContentList only ever has a single child, its wrapper, so if
-// the wrapper is black, the list can't be part of a garbage cycle.
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsChildContentList)
-  return !NeedsScriptTraverse(tmp);
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
-
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsChildContentList)
-  return !NeedsScriptTraverse(tmp);
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
-
-// CanSkipThis returns false to avoid problems with incomplete unlinking.
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsChildContentList)
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
-
-NS_INTERFACE_TABLE_HEAD(nsChildContentList)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_NODELIST_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsChildContentList)
-    NS_INTERFACE_TABLE_ENTRY(nsChildContentList, nsINodeList)
-    NS_INTERFACE_TABLE_ENTRY(nsChildContentList, nsIDOMNodeList)
-  NS_OFFSET_AND_INTERFACE_TABLE_END
-  NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
-  NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsChildContentList)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NodeList)
-NS_INTERFACE_MAP_END
-
-JSObject*
-nsChildContentList::WrapObject(JSContext *cx, JSObject *scope,
-                               bool *triedToWrap)
-{
-  return mozilla::dom::binding::NodeList::create(cx, scope, this, triedToWrap);
-}
-
-NS_IMETHODIMP
-nsChildContentList::GetLength(PRUint32* aLength)
-{
-  *aLength = mNode ? mNode->GetChildCount() : 0;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsChildContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
-{
-  nsINode* node = GetNodeAt(aIndex);
-  if (!node) {
-    *aReturn = nsnull;
-
-    return NS_OK;
-  }
-
-  return CallQueryInterface(node, aReturn);
-}
-
-nsIContent*
-nsChildContentList::GetNodeAt(PRUint32 aIndex)
-{
-  if (mNode) {
-    return mNode->GetChildAt(aIndex);
-  }
-
-  return nsnull;
-}
-
-PRInt32
-nsChildContentList::IndexOf(nsIContent* aContent)
-{
-  if (mNode) {
-    return mNode->IndexOf(aContent);
-  }
-
-  return -1;
-}
-
-//----------------------------------------------------------------------
-
-NS_IMPL_CYCLE_COLLECTION_1(nsNode3Tearoff, mNode)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNode3Tearoff)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver)
-NS_INTERFACE_MAP_END_AGGREGATED(mNode)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNode3Tearoff)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3Tearoff)
-
-NS_IMETHODIMP
-nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
-                                   nsAString& aNamespaceURI)
-{
-  return mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
-}
-
-nsIContent*
-nsGenericElement::GetFirstElementChild()
-{
-  nsAttrAndChildArray& children = mAttrsAndChildren;
-  PRUint32 i, count = children.ChildCount();
-  for (i = 0; i < count; ++i) {
-    nsIContent* child = children.ChildAt(i);
-    if (child->IsElement()) {
-      return child;
-    }
-  }
-  
-  return nsnull;
-}
-
-nsIContent*
-nsGenericElement::GetLastElementChild()
-{
-  nsAttrAndChildArray& children = mAttrsAndChildren;
-  PRUint32 i = children.ChildCount();
-  while (i > 0) {
-    nsIContent* child = children.ChildAt(--i);
-    if (child->IsElement()) {
-      return child;
-    }
-  }
-  
-  return nsnull;
-}
-
-nsIContent*
-nsGenericElement::GetPreviousElementSibling()
-{
-  nsIContent* parent = GetParent();
-  if (!parent) {
-    return nsnull;
-  }
-
-  NS_ASSERTION(parent->IsElement() ||
-               parent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT),
-               "Parent content must be an element or a doc fragment");
-
-  nsAttrAndChildArray& children =
-    static_cast<nsGenericElement*>(parent)->mAttrsAndChildren;
-  PRInt32 index = children.IndexOfChild(this);
-  if (index < 0) {
-    return nsnull;
-  }
-
-  PRUint32 i = index;
-  while (i > 0) {
-    nsIContent* child = children.ChildAt((PRUint32)--i);
-    if (child->IsElement()) {
-      return child;
-    }
-  }
-  
-  return nsnull;
-}
-
-nsIContent*
-nsGenericElement::GetNextElementSibling()
-{
-  nsIContent* parent = GetParent();
-  if (!parent) {
-    return nsnull;
-  }
-
-  NS_ASSERTION(parent->IsElement() ||
-               parent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT),
-               "Parent content must be an element or a doc fragment");
-
-  nsAttrAndChildArray& children =
-    static_cast<nsGenericElement*>(parent)->mAttrsAndChildren;
-  PRInt32 index = children.IndexOfChild(this);
-  if (index < 0) {
-    return nsnull;
-  }
-
-  PRUint32 i, count = children.ChildCount();
-  for (i = (PRUint32)index + 1; i < count; ++i) {
-    nsIContent* child = children.ChildAt(i);
-    if (child->IsElement()) {
-      return child;
-    }
-  }
-  
-  return nsnull;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetChildElementCount(PRUint32* aResult)
-{
-  *aResult = GetChildrenList()->Length(true);
-  return NS_OK;
-}
-
-// readonly attribute nsIDOMNodeList children
-NS_IMETHODIMP
-nsGenericElement::GetChildElements(nsIDOMNodeList** aResult)
-{
-  NS_ADDREF(*aResult = GetChildrenList());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetFirstElementChild(nsIDOMElement** aResult)
-{
-  *aResult = nsnull;
-
-  nsIContent *result = GetFirstElementChild();
-
-  return result ? CallQueryInterface(result, aResult) : NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetLastElementChild(nsIDOMElement** aResult)
-{
-  *aResult = nsnull;
-
-  nsIContent *result = GetLastElementChild();
-
-  return result ? CallQueryInterface(result, aResult) : NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetPreviousElementSibling(nsIDOMElement** aResult)
-{
-  *aResult = nsnull;
-
-  nsIContent *result = GetPreviousElementSibling();
-
-  return result ? CallQueryInterface(result, aResult) : NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetNextElementSibling(nsIDOMElement** aResult)
-{
-  *aResult = nsnull;
-
-  nsIContent *result = GetNextElementSibling();
-
-  return result ? CallQueryInterface(result, aResult) : NS_OK;
-}
-
-nsContentList*
-nsGenericElement::GetChildrenList()
-{
-  nsGenericElement::nsDOMSlots *slots = DOMSlots();
-
-  if (!slots->mChildrenList) {
-    slots->mChildrenList = new nsContentList(this, kNameSpaceID_Wildcard, 
-                                             nsGkAtoms::_asterix, nsGkAtoms::_asterix,
-                                             false);
-  }
-
-  return slots->mChildrenList;
-}
-
-nsDOMTokenList*
-nsGenericElement::GetClassList(nsresult *aResult)
-{
-  *aResult = NS_ERROR_OUT_OF_MEMORY;
-
-  nsGenericElement::nsDOMSlots *slots = DOMSlots();
-
-  if (!slots->mClassList) {
-    nsCOMPtr<nsIAtom> classAttr = GetClassAttributeName();
-    if (!classAttr) {
-      *aResult = NS_OK;
-
-      return nsnull;
-    }
-
-    slots->mClassList = new nsDOMTokenList(this, classAttr);
-  }
-
-  *aResult = NS_OK;
-
-  return slots->mClassList;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetClassList(nsIDOMDOMTokenList** aResult)
-{
-  *aResult = nsnull;
-
-  nsresult rv;
-  nsIDOMDOMTokenList* list = GetClassList(&rv);
-  NS_ENSURE_TRUE(list, rv);
-
-  NS_ADDREF(*aResult = list);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::SetCapture(bool aRetargetToElement)
-{
-  // If there is already an active capture, ignore this request. This would
-  // occur if a splitter, frame resizer, etc had already captured and we don't
-  // want to override those.
-  if (nsIPresShell::GetCapturingContent())
-    return NS_OK;
-
-  nsIPresShell::SetCapturingContent(this, CAPTURE_PREVENTDRAG |
-    (aRetargetToElement ? CAPTURE_RETARGETTOELEMENT : 0));
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::ReleaseCapture()
-{
-  if (nsIPresShell::GetCapturingContent() == this) {
-    nsIPresShell::SetCapturingContent(nsnull, 0);
-  }
-
-  return NS_OK;
-}
-
-nsIFrame*
-nsGenericElement::GetStyledFrame()
-{
-  nsIFrame *frame = GetPrimaryFrame(Flush_Layout);
-  return frame ? nsLayoutUtils::GetStyleFrame(frame) : nsnull;
-}
-
-void
-nsGenericElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
-{
-  *aOffsetParent = nsnull;
-  aRect = nsRect();
-
-  nsIFrame* frame = GetStyledFrame();
-  if (!frame) {
-    return;
-  }
-
-  nsPoint origin = frame->GetPosition();
-  aRect.x = nsPresContext::AppUnitsToIntCSSPixels(origin.x);
-  aRect.y = nsPresContext::AppUnitsToIntCSSPixels(origin.y);
-
-  // Get the union of all rectangles in this and continuation frames.
-  // It doesn't really matter what we use as aRelativeTo here, since
-  // we only care about the size. Using 'parent' might make things
-  // a bit faster by speeding up the internal GetOffsetTo operations.
-  nsIFrame* parent = frame->GetParent() ? frame->GetParent() : frame;
-  nsRect rcFrame = nsLayoutUtils::GetAllInFlowRectsUnion(frame, parent);
-  aRect.width = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width);
-  aRect.height = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height);
-}
-
-nsIScrollableFrame*
-nsGenericElement::GetScrollFrame(nsIFrame **aStyledFrame)
-{
-  // it isn't clear what to return for SVG nodes, so just return nothing
-  if (IsSVG()) {
-    if (aStyledFrame) {
-      *aStyledFrame = nsnull;
-    }
-    return nsnull;
-  }
-
-  nsIFrame* frame = GetStyledFrame();
-
-  if (aStyledFrame) {
-    *aStyledFrame = frame;
-  }
-  if (!frame) {
-    return nsnull;
-  }
-
-  // menu frames implement GetScrollTargetFrame but we don't want
-  // to use it here.  Similar for comboboxes.
-  if (frame->GetType() != nsGkAtoms::menuFrame &&
-      frame->GetType() != nsGkAtoms::comboboxControlFrame) {
-    nsIScrollableFrame *scrollFrame = frame->GetScrollTargetFrame();
-    if (scrollFrame)
-      return scrollFrame;
-  }
-
-  nsIDocument* doc = OwnerDoc();
-  bool quirksMode = doc->GetCompatibilityMode() == eCompatibility_NavQuirks;
-  Element* elementWithRootScrollInfo =
-    quirksMode ? doc->GetBodyElement() : doc->GetRootElement();
-  if (this == elementWithRootScrollInfo) {
-    // In quirks mode, the scroll info for the body element should map to the
-    // root scrollable frame.
-    // In strict mode, the scroll info for the root element should map to the
-    // the root scrollable frame.
-    return frame->PresContext()->PresShell()->GetRootScrollFrameAsScrollable();
-  }
-
-  return nsnull;
-}
-
-PRInt32
-nsGenericElement::GetScrollTop()
-{
-  nsIScrollableFrame* sf = GetScrollFrame();
-
-  return sf ?
-         nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollPosition().y) :
-         0;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetScrollTop(PRInt32* aScrollTop)
-{
-  *aScrollTop = GetScrollTop();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::SetScrollTop(PRInt32 aScrollTop)
-{
-  nsIScrollableFrame* sf = GetScrollFrame();
-  if (sf) {
-    nsPoint pt = sf->GetScrollPosition();
-    sf->ScrollToCSSPixels(nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
-                                     aScrollTop));
-  }
-  return NS_OK;
-}
-
-PRInt32
-nsGenericElement::GetScrollLeft()
-{
-  nsIScrollableFrame* sf = GetScrollFrame();
-
-  return sf ?
-         nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollPosition().x) :
-         0;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetScrollLeft(PRInt32* aScrollLeft)
-{
-  *aScrollLeft = GetScrollLeft();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::SetScrollLeft(PRInt32 aScrollLeft)
-{
-  nsIScrollableFrame* sf = GetScrollFrame();
-  if (sf) {
-    nsPoint pt = sf->GetScrollPosition();
-    sf->ScrollToCSSPixels(nsIntPoint(aScrollLeft,
-                                     nsPresContext::AppUnitsToIntCSSPixels(pt.y)));
-  }
-  return NS_OK;
-}
-
-PRInt32
-nsGenericElement::GetScrollHeight()
-{
-  if (IsSVG())
-    return 0;
-
-  nsIScrollableFrame* sf = GetScrollFrame();
-  if (!sf) {
-    nsRect rcFrame;
-    nsCOMPtr<nsIContent> parent;
-    GetOffsetRect(rcFrame, getter_AddRefs(parent));
-    return rcFrame.height;
-  }
-
-  nscoord height = sf->GetScrollRange().height + sf->GetScrollPortRect().height;
-  return nsPresContext::AppUnitsToIntCSSPixels(height);
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetScrollHeight(PRInt32* aScrollHeight)
-{
-  *aScrollHeight = GetScrollHeight();
-
-  return NS_OK;
-}
-
-PRInt32
-nsGenericElement::GetScrollWidth()
-{
-  if (IsSVG())
-    return 0;
-
-  nsIScrollableFrame* sf = GetScrollFrame();
-  if (!sf) {
-    nsRect rcFrame;
-    nsCOMPtr<nsIContent> parent;
-    GetOffsetRect(rcFrame, getter_AddRefs(parent));
-    return rcFrame.width;
-  }
-
-  nscoord width = sf->GetScrollRange().width + sf->GetScrollPortRect().width;
-  return nsPresContext::AppUnitsToIntCSSPixels(width);
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetScrollWidth(PRInt32 *aScrollWidth)
-{
-  *aScrollWidth = GetScrollWidth();
-
-  return NS_OK;
-}
-
-nsRect
-nsGenericElement::GetClientAreaRect()
-{
-  nsIFrame* styledFrame;
-  nsIScrollableFrame* sf = GetScrollFrame(&styledFrame);
-
-  if (sf) {
-    return sf->GetScrollPortRect();
-  }
-
-  if (styledFrame &&
-      (styledFrame->GetStyleDisplay()->mDisplay != NS_STYLE_DISPLAY_INLINE ||
-       styledFrame->IsFrameOfType(nsIFrame::eReplaced))) {
-    // Special case code to make client area work even when there isn't
-    // a scroll view, see bug 180552, bug 227567.
-    return styledFrame->GetPaddingRect() - styledFrame->GetPositionIgnoringScrolling();
-  }
-
-  // SVG nodes reach here and just return 0
-  return nsRect(0, 0, 0, 0);
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetClientTop(PRInt32 *aClientTop)
-{
-  *aClientTop = GetClientTop();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetClientLeft(PRInt32 *aClientLeft)
-{
-  *aClientLeft = GetClientLeft();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetClientHeight(PRInt32 *aClientHeight)
-{
-  *aClientHeight = GetClientHeight();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetClientWidth(PRInt32 *aClientWidth)
-{
-  *aClientWidth = GetClientWidth();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetBoundingClientRect(nsIDOMClientRect** aResult)
-{
-  // Weak ref, since we addref it below
-  nsClientRect* rect = new nsClientRect();
-  NS_ADDREF(*aResult = rect);
-  
-  nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
-  if (!frame) {
-    // display:none, perhaps? Return the empty rect
-    return NS_OK;
-  }
-
-  nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(frame,
-          nsLayoutUtils::GetContainingBlockForClientRect(frame),
-          nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
-  rect->SetLayoutRect(r);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetElementsByClassName(const nsAString& aClasses,
-                                         nsIDOMNodeList** aReturn)
-{
-  return nsContentUtils::GetElementsByClassName(this, aClasses, aReturn);
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetClientRects(nsIDOMClientRectList** aResult)
-{
-  *aResult = nsnull;
-
-  nsRefPtr<nsClientRectList> rectList = new nsClientRectList(this);
-
-  nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
-  if (!frame) {
-    // display:none, perhaps? Return an empty list
-    *aResult = rectList.forget().get();
-    return NS_OK;
-  }
-
-  nsLayoutUtils::RectListBuilder builder(rectList);
-  nsLayoutUtils::GetAllInFlowRects(frame,
-          nsLayoutUtils::GetContainingBlockForClientRect(frame), &builder,
-          nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
-  if (NS_FAILED(builder.mRV))
-    return builder.mRV;
-  *aResult = rectList.forget().get();
-  return NS_OK;
-}
-
-
-//----------------------------------------------------------------------
-
-
-NS_IMPL_ISUPPORTS1(nsNodeWeakReference,
-                   nsIWeakReference)
-
-nsNodeWeakReference::~nsNodeWeakReference()
-{
-  if (mNode) {
-    NS_ASSERTION(mNode->GetSlots() &&
-                 mNode->GetSlots()->mWeakReference == this,
-                 "Weak reference has wrong value");
-    mNode->GetSlots()->mWeakReference = nsnull;
-  }
-}
-
-NS_IMETHODIMP
-nsNodeWeakReference::QueryReferent(const nsIID& aIID, void** aInstancePtr)
-{
-  return mNode ? mNode->QueryInterface(aIID, aInstancePtr) :
-                 NS_ERROR_NULL_POINTER;
-}
-
-
-NS_IMPL_CYCLE_COLLECTION_1(nsNodeSupportsWeakRefTearoff, mNode)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeSupportsWeakRefTearoff)
-  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-NS_INTERFACE_MAP_END_AGGREGATED(mNode)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeSupportsWeakRefTearoff)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSupportsWeakRefTearoff)
-
-NS_IMETHODIMP
-nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
-{
-  nsINode::nsSlots* slots = mNode->GetSlots();
-  NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
-
-  if (!slots->mWeakReference) {
-    slots->mWeakReference = new nsNodeWeakReference(mNode);
-    NS_ENSURE_TRUE(slots->mWeakReference, NS_ERROR_OUT_OF_MEMORY);
-  }
-
-  NS_ADDREF(*aInstancePtr = slots->mWeakReference);
-
-  return NS_OK;
-}
-
-//----------------------------------------------------------------------
-
-NS_IMPL_CYCLE_COLLECTION_1(nsNodeSelectorTearoff, mNode)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeSelectorTearoff)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMNodeSelector)
-NS_INTERFACE_MAP_END_AGGREGATED(mNode)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeSelectorTearoff)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSelectorTearoff)
-
-NS_IMETHODIMP
-nsNodeSelectorTearoff::QuerySelector(const nsAString& aSelector,
-                                     nsIDOMElement **aReturn)
-{
-  nsresult rv;
-  nsIContent* result = nsGenericElement::doQuerySelector(mNode, aSelector, &rv);
-  return result ? CallQueryInterface(result, aReturn) : rv;
-}
-
-NS_IMETHODIMP
-nsNodeSelectorTearoff::QuerySelectorAll(const nsAString& aSelector,
-                                        nsIDOMNodeList **aReturn)
-{
-  return nsGenericElement::doQuerySelectorAll(mNode, aSelector, aReturn);
-}
-
-//----------------------------------------------------------------------
-
-NS_IMPL_CYCLE_COLLECTION_1(nsTouchEventReceiverTearoff, mElement)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTouchEventReceiverTearoff)
-  NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
-NS_INTERFACE_MAP_END_AGGREGATED(mElement)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTouchEventReceiverTearoff)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTouchEventReceiverTearoff)
-
-//----------------------------------------------------------------------
-
-NS_IMPL_CYCLE_COLLECTION_1(nsInlineEventHandlersTearoff, mElement)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsInlineEventHandlersTearoff)
-  NS_INTERFACE_MAP_ENTRY(nsIInlineEventHandlers)
-NS_INTERFACE_MAP_END_AGGREGATED(mElement)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsInlineEventHandlersTearoff)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsInlineEventHandlersTearoff)
-
-//----------------------------------------------------------------------
-nsGenericElement::nsDOMSlots::nsDOMSlots()
-  : nsINode::nsSlots(),
-    mDataset(nsnull),
-    mBindingParent(nsnull)
-{
-}
-
-nsGenericElement::nsDOMSlots::~nsDOMSlots()
-{
-  if (mAttributeMap) {
-    mAttributeMap->DropReference();
-  }
-
-  if (mClassList) {
-    mClassList->DropReference();
-  }
-}
-
-void
-nsGenericElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
-{
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mStyle");
-  cb.NoteXPCOMChild(mStyle.get());
-
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mSMILOverrideStyle");
-  cb.NoteXPCOMChild(mSMILOverrideStyle.get());
-
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAttributeMap");
-  cb.NoteXPCOMChild(mAttributeMap.get());
-
-  if (aIsXUL) {
-    NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mControllers");
-    cb.NoteXPCOMChild(mControllers);
-  }
-
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
-  cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
-
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mClassList");
-  cb.NoteXPCOMChild(mClassList.get());
-}
-
-void
-nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
-{
-  mStyle = nsnull;
-  mSMILOverrideStyle = nsnull;
-  if (mAttributeMap) {
-    mAttributeMap->DropReference();
-    mAttributeMap = nsnull;
-  }
-  if (aIsXUL)
-    NS_IF_RELEASE(mControllers);
-  mChildrenList = nsnull;
-  if (mClassList) {
-    mClassList->DropReference();
-    mClassList = nsnull;
-  }
-}
-
-nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : Element(aNodeInfo)
-{
-  NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE ||
-                    (mNodeInfo->NodeType() ==
-                       nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
-                     mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
-                                       kNameSpaceID_None)),
-                    "Bad NodeType in aNodeInfo");
-
-  SetIsElement();
-}
-
-nsGenericElement::~nsGenericElement()
-{
-  NS_PRECONDITION(!IsInDoc(),
-                  "Please remove this from the document properly");
-  if (GetParent()) {
-    NS_RELEASE(mParent);
-  }
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetNodeName(nsAString& aNodeName)
-{
-  aNodeName = NodeName();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetLocalName(nsAString& aLocalName)
-{
-  aLocalName = LocalName();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetNodeValue(nsAString& aNodeValue)
-{
-  SetDOMStringToNull(aNodeValue);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::SetNodeValue(const nsAString& aNodeValue)
-{
-  // The DOM spec says that when nodeValue is defined to be null "setting it
-  // has no effect", so we don't throw an exception.
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetNodeType(PRUint16* aNodeType)
-{
-  *aNodeType = NodeType();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetNamespaceURI(nsAString& aNamespaceURI)
-{
-  return mNodeInfo->GetNamespaceURI(aNamespaceURI);
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetPrefix(nsAString& aPrefix)
-{
-  mNodeInfo->GetPrefix(aPrefix);
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::InternalIsSupported(nsISupports* aObject,
-                                      const nsAString& aFeature,
-                                      const nsAString& aVersion,
-                                      bool* aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-  *aReturn = false;
-
-  // Convert the incoming UTF16 strings to raw char*'s to save us some
-  // code when doing all those string compares.
-  NS_ConvertUTF16toUTF8 feature(aFeature);
-  NS_ConvertUTF16toUTF8 version(aVersion);
-
-  const char *f = feature.get();
-  const char *v = version.get();
-
-  if (PL_strcasecmp(f, "XML") == 0 ||
-      PL_strcasecmp(f, "HTML") == 0) {
-    if (aVersion.IsEmpty() ||
-        PL_strcmp(v, "1.0") == 0 ||
-        PL_strcmp(v, "2.0") == 0) {
-      *aReturn = true;
-    }
-  } else if (PL_strcasecmp(f, "Views") == 0 ||
-             PL_strcasecmp(f, "StyleSheets") == 0 ||
-             PL_strcasecmp(f, "Core") == 0 ||
-             PL_strcasecmp(f, "CSS") == 0 ||
-             PL_strcasecmp(f, "CSS2") == 0 ||
-             PL_strcasecmp(f, "Events") == 0 ||
-             PL_strcasecmp(f, "UIEvents") == 0 ||
-             PL_strcasecmp(f, "MouseEvents") == 0 ||
-             // Non-standard!
-             PL_strcasecmp(f, "MouseScrollEvents") == 0 ||
-             PL_strcasecmp(f, "HTMLEvents") == 0 ||
-             PL_strcasecmp(f, "Range") == 0 ||
-             PL_strcasecmp(f, "XHTML") == 0) {
-    if (aVersion.IsEmpty() ||
-        PL_strcmp(v, "2.0") == 0) {
-      *aReturn = true;
-    }
-  } else if (PL_strcasecmp(f, "XPath") == 0) {
-    if (aVersion.IsEmpty() ||
-        PL_strcmp(v, "3.0") == 0) {
-      *aReturn = true;
-    }
-  } else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
-             PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
-             nsSVGFeatures::HasFeature(aObject, aFeature)) {
-    if (aVersion.IsEmpty() ||
-        PL_strcmp(v, "1.0") == 0 ||
-        PL_strcmp(v, "1.1") == 0) {
-      *aReturn = true;
-    }
-  }
-  else if (NS_SMILEnabled() && PL_strcasecmp(f, "TimeControl") == 0) {
-    if (aVersion.IsEmpty() || PL_strcmp(v, "1.0") == 0) {
-      *aReturn = true;
-    }
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::IsSupported(const nsAString& aFeature,
-                              const nsAString& aVersion,
-                              bool* aReturn)
-{
-  return InternalIsSupported(this, aFeature, aVersion, aReturn);
-}
-
-NS_IMETHODIMP
-nsGenericElement::HasAttributes(bool* aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-
-  *aReturn = GetAttrCount() > 0;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
-{
-  if (!IsElement()) {
-    *aAttributes = nsnull;
-    return NS_OK;
-  }
-
-  nsDOMSlots *slots = DOMSlots();
-
-  if (!slots->mAttributeMap) {
-    slots->mAttributeMap = new nsDOMAttributeMap(this);
-  }
-
-  NS_ADDREF(*aAttributes = slots->mAttributeMap);
-
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::HasChildNodes(bool* aReturn)
-{
-  *aReturn = mAttrsAndChildren.ChildCount() > 0;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericElement::GetTagName(nsAString& aTagName)
-{
-  aTagName = NodeName();
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::GetAttribute(const nsAString& aName,
-                               nsAString& aReturn)
-{
-  const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
-
-  if (!name) {
-    if (mNodeInfo->NamespaceID() == kNameSpaceID_XUL) {
-      // XXX should be SetDOMStringToNull(aReturn);
-      // See bug 232598
-      aReturn.Truncate();
-    }
-    else {
-      SetDOMStringToNull(aReturn);
-    }
-
-    return NS_OK;
-  }
-
-  GetAttr(name->NamespaceID(), name->LocalName(), aReturn);
-
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::SetAttribute(const nsAString& aName,
-                               const nsAString& aValue)
-{
-  const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
-
-  if (!name) {
-    nsresult rv = nsContentUtils::CheckQName(aName, false);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aName);
-    NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
-
-    return SetAttr(kNameSpaceID_None, nameAtom, aValue, true);
-  }
-
-  return SetAttr(name->NamespaceID(), name->LocalName(), name->GetPrefix(),
-                 aValue, true);
-}
-
-nsresult
-nsGenericElement::RemoveAttribute(const nsAString& aName)
-{
-  const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
-
-  if (!name) {
-    // If there is no canonical nsAttrName for this attribute name, then the
-    // attribute does not exist and we can't get its namespace ID and
-    // local name below, so we return early.
-    return NS_OK;
-  }
-
-  // Hold a strong reference here so that the atom or nodeinfo doesn't go
-  // away during UnsetAttr. If it did UnsetAttr would be left with a
-  // dangling pointer as argument without knowing it.
-  nsAttrName tmp(*name);
-
-  return UnsetAttr(name->NamespaceID(), name->LocalName(), true);
-}
-
-nsresult
-nsGenericElement::GetAttributeNode(const nsAString& aName,
-                                   nsIDOMAttr** aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-  *aReturn = nsnull;
-
-  nsIDocument* document = OwnerDoc();
-  if (document) {
-    document->WarnOnceAbout(nsIDocument::eGetAttributeNode);
-  }
-
-  nsCOMPtr<nsIDOMNamedNodeMap> map;
-  nsresult rv = GetAttributes(getter_AddRefs(map));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMNode> node;
-  rv = map->GetNamedItem(aName, getter_AddRefs(node));
-
-  if (NS_SUCCEEDED(rv) && node) {
-    rv = CallQueryInterface(node, aReturn);
-  }
-
-  return rv;
-}
-
-nsresult
-nsGenericElement::SetAttributeNode(nsIDOMAttr* aAttribute,
-                                   nsIDOMAttr** aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-  NS_ENSURE_ARG_POINTER(aAttribute);
-
-  *aReturn = nsnull;
-
-  OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode);
-
-  nsCOMPtr<nsIDOMNamedNodeMap> map;
-  nsresult rv = GetAttributes(getter_AddRefs(map));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMNode> returnNode;
-  rv = map->SetNamedItem(aAttribute, getter_AddRefs(returnNode));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (returnNode) {
-    rv = CallQueryInterface(returnNode, aReturn);
-  }
-
-  return rv;
-}
-
-nsresult
-nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
-                                      nsIDOMAttr** aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-  NS_ENSURE_ARG_POINTER(aAttribute);
-
-  *aReturn = nsnull;
-
-  OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
-
-  nsCOMPtr<nsIDOMNamedNodeMap> map;
-  nsresult rv = GetAttributes(getter_AddRefs(map));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsAutoString name;
-
-  rv = aAttribute->GetName(name);
-  if (NS_SUCCEEDED(rv)) {
-    nsCOMPtr<nsIDOMNode> node;
-    rv = map->RemoveNamedItem(name, getter_AddRefs(node));
-
-    if (NS_SUCCEEDED(rv) && node) {
-      rv = CallQueryInterface(node, aReturn);
-    }
-  }
-
-  return rv;
-}
-
-nsresult
-nsGenericElement::GetElementsByTagName(const nsAString& aTagname,
-                                       nsIDOMNodeList** aReturn)
-{
-  nsContentList *list = NS_GetContentList(this, kNameSpaceID_Unknown, 
-                                          aTagname).get();
-
-  // transfer ref to aReturn
-  *aReturn = list;
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::GetAttributeNS(const nsAString& aNamespaceURI,
-                                 const nsAString& aLocalName,
-                                 nsAString& aReturn)
-{
-  PRInt32 nsid =
-    nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
-
-  if (nsid == kNameSpaceID_Unknown) {
-    // Unknown namespace means no attribute.
-    SetDOMStringToNull(aReturn);
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
-  bool hasAttr = GetAttr(nsid, name, aReturn);
-  if (!hasAttr) {
-    SetDOMStringToNull(aReturn);
-  }
-
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::SetAttributeNS(const nsAString& aNamespaceURI,
-                                 const nsAString& aQualifiedName,
-                                 const nsAString& aValue)
-{
-  nsCOMPtr<nsINodeInfo> ni;
-  nsresult rv =
-    nsContentUtils::GetNodeInfoFromQName(aNamespaceURI, aQualifiedName,
-                                         mNodeInfo->NodeInfoManager(),
-                                         nsIDOMNode::ATTRIBUTE_NODE,
-                                         getter_AddRefs(ni));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return SetAttr(ni->NamespaceID(), ni->NameAtom(), ni->GetPrefixAtom(),
-                 aValue, true);
-}
-
-nsresult
-nsGenericElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
-                                    const nsAString& aLocalName)
-{
-  nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
-  PRInt32 nsid =
-    nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
-
-  if (nsid == kNameSpaceID_Unknown) {
-    // If the namespace ID is unknown, it means there can't possibly be an
-    // existing attribute. We would need a known namespace ID to pass into
-    // UnsetAttr, so we return early if we don't have one.
-    return NS_OK;
-  }
-
-  UnsetAttr(nsid, name, true);
-
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
-                                     const nsAString& aLocalName,
-                                     nsIDOMAttr** aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-  *aReturn = nsnull;
-
-  OwnerDoc()->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
-
-  return GetAttributeNodeNSInternal(aNamespaceURI, aLocalName, aReturn);
-}
-
-nsresult
-nsGenericElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
-                                             const nsAString& aLocalName,
-                                             nsIDOMAttr** aReturn)
-{
-  nsCOMPtr<nsIDOMNamedNodeMap> map;
-  nsresult rv = GetAttributes(getter_AddRefs(map));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMNode> node;
-  rv = map->GetNamedItemNS(aNamespaceURI, aLocalName, getter_AddRefs(node));
-
-  if (NS_SUCCEEDED(rv) && node) {
-    rv = CallQueryInterface(node, aReturn);
-  }
-
-  return rv;
-}
-
-nsresult
-nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
-                                     nsIDOMAttr** aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-  NS_ENSURE_ARG_POINTER(aNewAttr);
-  *aReturn = nsnull;
-
-  OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
-
-  nsCOMPtr<nsIDOMNamedNodeMap> map;
-  nsresult rv = GetAttributes(getter_AddRefs(map));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMNode> returnNode;
-  rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (returnNode) {
-    rv = CallQueryInterface(returnNode, aReturn);
-  }
-
-  return rv;
-}
-
-nsresult
-nsGenericElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
-                                         const nsAString& aLocalName,
-                                         nsIDOMNodeList** aReturn)
-{
-  PRInt32 nameSpaceId = kNameSpaceID_Wildcard;
-
-  if (!aNamespaceURI.EqualsLiteral("*")) {
-    nsresult rv =
-      nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI,
-                                                            nameSpaceId);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  NS_ASSERTION(nameSpaceId != kNameSpaceID_Unknown, "Unexpected namespace ID!");
-
-  nsContentList *list = NS_GetContentList(this, nameSpaceId, aLocalName).get();
-
-  // transfer ref to aReturn
-  *aReturn = list;
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::HasAttribute(const nsAString& aName, bool* aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-
-  const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
-  *aReturn = (name != nsnull);
-
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::HasAttributeNS(const nsAString& aNamespaceURI,
-                                 const nsAString& aLocalName,
-                                 bool* aReturn)
-{
-  NS_ENSURE_ARG_POINTER(aReturn);
-
-  PRInt32 nsid =
-    nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
-
-  if (nsid == kNameSpaceID_Unknown) {
-    // Unknown namespace means no attr...
-
-    *aReturn = false;
-
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
-  *aReturn = HasAttr(nsid, name);
-
-  return NS_OK;
-}
-
-static nsXBLBinding*
-GetFirstBindingWithContent(nsBindingManager* aBmgr, nsIContent* aBoundElem)
-{
-  nsXBLBinding* binding = aBmgr->GetBinding(aBoundElem);
-  while (binding) {
-    if (binding->GetAnonymousContent()) {
-      return binding;
-    }
-    binding = binding->GetBaseBinding();
-  }
-  
-  return nsnull;
-}
-
-static nsresult
-BindNodesInInsertPoints(nsXBLBinding* aBinding, nsIContent* aInsertParent,
-                        nsIDocument* aDocument)
-{
-  NS_PRECONDITION(aBinding && aInsertParent, "Missing arguments");
-
-  nsresult rv;
-  // These should be refcounted or otherwise protectable.
-  nsInsertionPointList* inserts =
-    aBinding->GetExistingInsertionPointsFor(aInsertParent);
-  if (inserts) {
-    bool allowScripts = aBinding->AllowScripts();
-#ifdef MOZ_XUL
-    nsCOMPtr<nsIXULDocument> xulDoc = do_QueryInterface(aDocument);
-#endif
-    PRUint32 i;
-    for (i = 0; i < inserts->Length(); ++i) {
-      nsCOMPtr<nsIContent> insertRoot =
-        inserts->ElementAt(i)->GetDefaultContent();
-      if (insertRoot) {
-        for (nsCOMPtr<nsIContent> child = insertRoot->GetFirstChild();
-             child;
-             child = child->GetNextSibling()) {
-          rv = child->BindToTree(aDocument, aInsertParent,
-                                 aBinding->GetBoundElement(), allowScripts);
-          NS_ENSURE_SUCCESS(rv, rv);
-
-#ifdef MOZ_XUL
-          if (xulDoc) {
-            xulDoc->AddSubtreeToDocument(child);
-          }
-#endif
-        }
-      }
-    }
-  }
-
-  return NS_OK;
-}
-
-nsresult
-nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                             nsIContent* aBindingParent,
-                             bool aCompileEventHandlers)
-{
-  NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
-  NS_PRECONDITION(HasSameOwnerDoc(NODE_FROM(aParent, aDocument)),
-                  "Must have the same owner document");
-  NS_PRECONDITION(!aParent || aDocument == aParent->GetCurrentDoc(),
-                  "aDocument must be current doc of aParent");
-  NS_PRECONDITION(!GetCurrentDoc(), "Already have a document.  Unbind first!");
-  // Note that as we recurse into the kids, they'll have a non-null parent.  So
-  // only assert if our parent is _changing_ while we have a parent.
-  NS_PRECONDITION(!GetParent() || aParent == GetParent(),
-                  "Already have a parent.  Unbind first!");
-  NS_PRECONDITION(!GetBindingParent() ||
-                  aBindingParent == GetBindingParent() ||
-                  (!aBindingParent && aParent &&
-                   aParent->GetBindingParent() == GetBindingParent()),
-                  "Already have a binding parent.  Unbind first!");
-  NS_PRECONDITION(!aParent || !aDocument ||
-                  !aParent->HasFlag(NODE_FORCE_XBL_BINDINGS),
-                  "Parent in document but flagged as forcing XBL");
-  NS_PRECONDITION(aBindingParent != this,
-                  "Content must not be its own binding parent");
-  NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
-                  aBindingParent == aParent,
-                  "Native anonymous content must have its parent as its "
-                  "own binding parent");
-  NS_PRECONDITION(aBindingParent || !aParent ||
-                  aBindingParent == aParent->GetBindingParent(),
-                  "We should be passed the right binding parent");
-
-#ifdef MOZ_XUL
-  // First set the binding parent
-  nsXULElement* xulElem = nsXULElement::FromContent(this);
-  if (xulElem) {
-    xulElem->SetXULBindingParent(aBindingParent);
-  }
-  else 
-#endif
-  {
-    if (aBindingParent) {
-      nsDOMSlots *slots = DOMSlots();
-
-      slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
-    }
-  }
-  NS_ASSERTION(!aBindingParent || IsRootOfNativeAnonymousSubtree() ||
-               !HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE) ||
-               (aParent && aParent->IsInNativeAnonymousSubtree()),
-               "Trying to re-bind content from native anonymous subtree to "
-               "non-native anonymous parent!");
-  if (aParent && aParent->IsInNativeAnonymousSubtree()) {
-    SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
-  }
-
-  bool hadForceXBL = HasFlag(NODE_FORCE_XBL_BINDINGS);
-
-  // Now set the parent and set the "Force attach xbl" flag if needed.
-  if (aParent) {
-    if (!GetParent()) {
-      NS_ADDREF(aParent);
-    }
-    mParent = aParent;
-
-    if (aParent->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
-      SetFlags(NODE_FORCE_XBL_BINDINGS);
-    }
-  }
-  else {
-    mParent = aDocument;
-  }
-  SetParentIsContent(aParent);
-
-  // XXXbz sXBL/XBL2 issue!
-
-  // Finally, set the document
-  if (aDocument) {
-    // Notify XBL- & nsIAnonymousContentCreator-generated
-    // anonymous content that the document is changing.
-    // XXXbz ordering issues here?  Probably not, since ChangeDocumentFor is
-    // just pretty broken anyway....  Need to get it working.
-    // XXXbz XBL doesn't handle this (asserts), and we don't really want
-    // to be doing this during parsing anyway... sort this out.    
-    //    aDocument->BindingManager()->ChangeDocumentFor(this, nsnull,
-    //                                                   aDocument);
-
-    // We no longer need to track the subtree pointer (and in fact we'll assert
-    // if we do this any later).
-    ClearSubtreeRootPointer();
-
-    // Being added to a document.
-    SetInDocument();
-
-    // Unset this flag since we now really are in a document.
-    UnsetFlags(NODE_FORCE_XBL_BINDINGS |
-               // And clear the lazy frame construction bits.
-               NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES |
-               // And the restyle bits
-               ELEMENT_ALL_RESTYLE_FLAGS);
-  } else {
-    // If we're not in the doc, update our subtree pointer.
-    SetSubtreeRootPointer(aParent->SubtreeRoot());
-  }
-
-  // If NODE_FORCE_XBL_BINDINGS was set we might have anonymous children
-  // that also need to be told that they are moving.
-  nsresult rv;
-  if (hadForceXBL) {
-    nsBindingManager* bmgr = OwnerDoc()->BindingManager();
-
-    // First check if we have a binding...
-    nsXBLBinding* contBinding =
-      GetFirstBindingWithContent(bmgr, this);
-    if (contBinding) {
-      nsCOMPtr<nsIContent> anonRoot = contBinding->GetAnonymousContent();
-      bool allowScripts = contBinding->AllowScripts();
-      for (nsCOMPtr<nsIContent> child = anonRoot->GetFirstChild();
-           child;
-           child = child->GetNextSibling()) {
-        rv = child->BindToTree(aDocument, this, this, allowScripts);
-        NS_ENSURE_SUCCESS(rv, rv);
-      }
-
-      // ...then check if we have content in insertion points that are
-      // direct children of the <content>
-      rv = BindNodesInInsertPoints(contBinding, this, aDocument);
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-
-    // ...and finally check if we're in a binding where we have content in
-    // insertion points.
-    if (aBindingParent) {
-      nsXBLBinding* binding = bmgr->GetBinding(aBindingParent);
-      if (binding) {
-        rv = BindNodesInInsertPoints(binding, this, aDocument);
-        NS_ENSURE_SUCCESS(rv, rv);
-      }
-    }
-  }
-
-  UpdateEditableState(false);
-
-  // Now recurse into our kids
-  for (nsIContent* child = GetFirstChild(); child;
-       child = child->GetNextSibling()) {
-    rv = child->BindToTree(aDocument, this, aBindingParent,
-                           aCompileEventHandlers);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  nsNodeUtils::ParentChainChanged(this);
-
-  if (aDocument && HasID() && !aBindingParent) {
-    aDocument->AddToIdTable(this, DoGetID());
-  }
-
-  if (MayHaveStyle() && !IsXUL()) {
-    // XXXbz if we already have a style attr parsed, this won't do
-    // anything... need to fix that.
-    // If MayHaveStyle() is true, we must be an nsStyledElement
-    static_cast<nsStyledElement*>(this)->ReparseStyleAttribute(false);
-  }
-
-  if (aDocument) {
-    // If we're in a document now, let our mapped attrs know what their new
-    // sheet is.  This is safe to run for non-mapped-attribute elements too;
-    // it'll just do a small bit of unnecessary work.  But most elements in
-    // practice are mapped-attribute elements.
-    nsHTMLStyleSheet* sheet = aDocument->GetAttributeStyleSheet();
-    if (sheet) {
-      mAttrsAndChildren.SetMappedAttrStyleSheet(sheet);
-    }
-  }
-
-  // XXXbz script execution during binding can trigger some of these
-  // postcondition asserts....  But we do want that, since things will
-  // generally be quite broken when that happens.
-  NS_POSTCONDITION(aDocument == GetCurrentDoc(), "Bound to wrong document");
-  NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
-  NS_POSTCONDITION(aBindingParent == GetBindingParent(),
-                   "Bound to wrong binding parent");
-
-  return NS_OK;
-}
-
-class RemoveFromBindingManagerRunnable : public nsRunnable {
-public:
-  RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
-                                   Element* aElement,
-                                   nsIDocument* aDoc,
-                                   nsIContent* aBindingParent):
-    mManager(aManager), mElement(aElement), mDoc(aDoc),
-    mBindingParent(aBindingParent)
-  {}
-
-  NS_IMETHOD Run()
-  {
-    mManager->RemovedFromDocumentInternal(mElement, mDoc, mBindingParent);
-    return NS_OK;
-  }
-
-private:
-  nsRefPtr<nsBindingManager> mManager;
-  nsRefPtr<Element> mElement;
-  nsCOMPtr<nsIDocument> mDoc;
-  nsCOMPtr<nsIContent> mBindingParent;
-};
-
-void
-nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
-{
-  NS_PRECONDITION(aDeep || (!GetCurrentDoc() && !GetBindingParent()),
-                  "Shallow unbind won't clear document and binding parent on "
-                  "kids!");
-
-  RemoveFromIdTable();
-
-  // Make sure to unbind this node before doing the kids
-  nsIDocument *document =
-    HasFlag(NODE_FORCE_XBL_BINDINGS) ? OwnerDoc() : GetCurrentDoc();
-
-  if (aNullParent) {
-    if (IsFullScreenAncestor()) {
-      // The element being removed is an ancestor of the full-screen element,
-      // exit full-screen state.
-      nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
-                                      "DOM", OwnerDoc(),
-                                      nsContentUtils::eDOM_PROPERTIES,
-                                      "RemovedFullScreenElement");
-      // Fully exit full-screen.
-      nsIDocument::ExitFullScreen(false);
-    }
-    if (HasPointerLock()) {
-      nsIDocument::UnlockPointer();
-    }
-    if (GetParent()) {
-      NS_RELEASE(mParent);
-    } else {
-      mParent = nsnull;
-    }
-    SetParentIsContent(false);
-  }
-  ClearInDocument();
-
-  // Begin keeping track of our subtree root.
-  SetSubtreeRootPointer(aNullParent ? this : mParent->SubtreeRoot());
-
-  if (document) {
-    // Notify XBL- & nsIAnonymousContentCreator-generated
-    // anonymous content that the document is changing.
-    if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
-      nsContentUtils::AddScriptRunner(
-        new RemoveFromBindingManagerRunnable(document->BindingManager(), this,
-                                             document, GetBindingParent()));
-    }
-
-    document->ClearBoxObjectFor(this);
-  }
-
-  // Ensure that CSS transitions don't continue on an element at a
-  // different place in the tree (even if reinserted before next
-  // animation refresh).
-  // FIXME (Bug 522599): Need a test for this.
-  if (HasFlag(NODE_HAS_PROPERTIES)) {
-    DeleteProperty(nsGkAtoms::transitionsOfBeforeProperty);
-    DeleteProperty(nsGkAtoms::transitionsOfAfterProperty);
-    DeleteProperty(nsGkAtoms::transitionsProperty);
-    DeleteProperty(nsGkAtoms::animationsOfBeforeProperty);
-    DeleteProperty(nsGkAtoms::animationsOfAfterProperty);
-    DeleteProperty(nsGkAtoms::animationsProperty);
-  }
-
-  // Unset this since that's what the old code effectively did.
-  UnsetFlags(NODE_FORCE_XBL_BINDINGS);
-  
-#ifdef MOZ_XUL
-  nsXULElement* xulElem = nsXULElement::FromContent(this);
-  if (xulElem) {
-    xulElem->SetXULBindingParent(nsnull);
-  }
-  else
-#endif
-  {
-    nsDOMSlots *slots = GetExistingDOMSlots();
-    if (slots) {
-      slots->mBindingParent = nsnull;
-    }
-  }
-
-  if (aDeep) {
-    // Do the kids. Don't call GetChildCount() here since that'll force
-    // XUL to generate template children, which there is no need for since
-    // all we're going to do is unbind them anyway.
-    PRUint32 i, n = mAttrsAndChildren.ChildCount();
-
-    for (i = 0; i < n; ++i) {
-      // Note that we pass false for aNullParent here, since we don't want
-      // the kids to forget us.  We _do_ want them to forget their binding
-      // parent, though, since this only walks non-anonymous kids.
-      mAttrsAndChildren.ChildAt(i)->UnbindFromTree(true, false);
-    }
-  }
-
-  nsNodeUtils::ParentChainChanged(this);
-}
-
-already_AddRefed<nsINodeList>
-nsGenericElement::GetChildren(PRUint32 aFilter)
-{
-  nsRefPtr<nsSimpleContentList> list = new nsSimpleContentList(this);
-  if (!list) {
-    return nsnull;
-  }
-
-  nsIFrame *frame = GetPrimaryFrame();
-
-  // Append :before generated content.
-  if (frame) {
-    nsIFrame *beforeFrame = nsLayoutUtils::GetBeforeFrame(frame);
-    if (beforeFrame) {
-      list->AppendElement(beforeFrame->GetContent());
-    }
-  }
-
-  // If XBL is bound to this node then append XBL anonymous content including
-  // explict content altered by insertion point if we were requested for XBL
-  // anonymous content, otherwise append explicit content with respect to
-  // insertion point if any.
-  nsINodeList *childList = nsnull;
-
-  nsIDocument* document = OwnerDoc();
-  if (!(aFilter & eAllButXBL)) {
-    childList = document->BindingManager()->GetXBLChildNodesFor(this);
-    if (!childList) {
-      childList = GetChildNodesList();
-    }