Merge m-c to fx-team
authorPhil Ringnalda <philringnalda@gmail.com>
Sun, 06 Jan 2013 11:01:58 -0800
changeset 126965 2ee91743312d6d2c48341f1d751edf4b915d1723
parent 126964 4ff4cf256fa678b3e2bf2c145a6de91c6532384b (current diff)
parent 126903 6503c6bee6f84f26ba6b79cac1fccfca4e69f1f1 (diff)
child 126966 a030d7a75344c8e9d247c181520834b9fd22704c
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone20.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 m-c to fx-team
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js
browser/themes/gnomestripe/downloads/download-notification.png
browser/themes/gnomestripe/jar.mn
browser/themes/pinstripe/downloads/download-notification.png
browser/themes/pinstripe/jar.mn
browser/themes/winstripe/downloads/download-notification.png
browser/themes/winstripe/jar.mn
content/html/content/public/nsHTMLCanvasElement.h
content/html/content/src/nsHTMLAnchorElement.cpp
content/html/content/src/nsHTMLCanvasElement.cpp
content/html/content/src/nsHTMLLIElement.cpp
content/html/content/src/nsHTMLOListElement.cpp
content/html/content/src/nsHTMLParagraphElement.cpp
content/html/content/src/nsHTMLPreElement.cpp
content/html/content/src/nsHTMLScriptElement.cpp
content/html/content/src/nsHTMLSpanElement.cpp
content/html/content/src/nsHTMLTableCaptionElement.cpp
content/html/content/src/nsHTMLTableCellElement.cpp
content/html/content/src/nsHTMLTableColElement.cpp
content/html/content/src/nsHTMLTableElement.cpp
content/html/content/src/nsHTMLTableElement.h
content/html/content/src/nsHTMLTableRowElement.cpp
content/html/content/src/nsHTMLTableSectionElement.cpp
content/svg/content/src/nsSVGAnimateElement.cpp
content/svg/content/src/nsSVGAnimateMotionElement.cpp
content/svg/content/src/nsSVGAnimateMotionElement.h
content/svg/content/src/nsSVGAnimateTransformElement.cpp
content/svg/content/src/nsSVGAnimationElement.cpp
content/svg/content/src/nsSVGAnimationElement.h
content/svg/content/src/nsSVGCircleElement.cpp
content/svg/content/src/nsSVGDefsElement.cpp
content/svg/content/src/nsSVGDescElement.cpp
content/svg/content/src/nsSVGEllipseElement.cpp
content/svg/content/src/nsSVGForeignObjectElement.cpp
content/svg/content/src/nsSVGForeignObjectElement.h
content/svg/content/src/nsSVGGElement.cpp
content/svg/content/src/nsSVGGraphicElement.cpp
content/svg/content/src/nsSVGGraphicElement.h
content/svg/content/src/nsSVGImageElement.cpp
content/svg/content/src/nsSVGImageElement.h
content/svg/content/src/nsSVGLineElement.cpp
content/svg/content/src/nsSVGMetadataElement.cpp
content/svg/content/src/nsSVGMpathElement.cpp
content/svg/content/src/nsSVGMpathElement.h
content/svg/content/src/nsSVGPolygonElement.cpp
content/svg/content/src/nsSVGPolylineElement.cpp
content/svg/content/src/nsSVGRectElement.cpp
content/svg/content/src/nsSVGScriptElement.cpp
content/svg/content/src/nsSVGSetElement.cpp
content/svg/content/src/nsSVGStopElement.cpp
content/svg/content/src/nsSVGStyleElement.cpp
content/svg/content/src/nsSVGSwitchElement.cpp
content/svg/content/src/nsSVGSwitchElement.h
content/svg/content/src/nsSVGTitleElement.cpp
dom/imptests/failures/webapps/DOMCore/tests/submissions/Ms2ger/test_interfaces.html.json
dom/interfaces/html/nsIDOMHTMLTableSectionElem.idl
mobile/android/base/resources/drawable-hdpi/ic_menu_synced_tabs.png
mobile/android/base/resources/drawable-xhdpi/ic_menu_synced_tabs.png
mobile/android/base/resources/drawable/ic_menu_synced_tabs.png
view/public/nsIViewManager.h
view/public/nsViewsCID.h
view/src/nsViewManager.h
--- a/accessible/src/generic/DocAccessible.cpp
+++ b/accessible/src/generic/DocAccessible.cpp
@@ -30,17 +30,17 @@
 #include "nsIDOMXULPopupElement.h"
 #include "nsIEditingSession.h"
 #include "nsEventStateManager.h"
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsINameSpaceManager.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsUnicharUtils.h"
 #include "nsIURI.h"
 #include "nsIWebNavigation.h"
 #include "nsFocusManager.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/dom/Element.h"
 
@@ -1248,17 +1248,17 @@ DocAccessible::HandleAccEvent(AccEvent* 
 // Public members
 
 void*
 DocAccessible::GetNativeWindow() const
 {
   if (!mPresShell)
     return nullptr;
 
-  nsIViewManager* vm = mPresShell->GetViewManager();
+  nsViewManager* vm = mPresShell->GetViewManager();
   if (!vm)
     return nullptr;
 
   nsCOMPtr<nsIWidget> widget;
   vm->GetRootWidget(getter_AddRefs(widget));
   if (widget)
     return widget->GetNativeData(NS_NATIVE_WINDOW);
 
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -524,32 +524,42 @@ HyperTextAccessible::DOMPointToHypertext
     nsresult rv = ContentToRenderedOffset(frame, aNodeOffset, &addTextOffset);
     NS_ENSURE_SUCCESS(rv, nullptr);
     // Get the child node and 
     findNode = aNode;
 
   } else {
     // findNode could be null if aNodeOffset == # of child nodes, which means
     // one of two things:
-    // 1) we're at the end of the children, keep findNode = null, so that we get
-    //    the last possible offset
+    // 1) there are no children, and the passed-in node is not mContent -- use
+    //    parentContent for the node to find
     // 2) there are no children and the passed-in node is mContent, which means
-    //    we're an aempty nsIAccessibleText
-    // 3) there are no children, and the passed-in node is not mContent -- use
-    //    parentContent for the node to find
+    //    we're an empty nsIAccessibleText
+    // 3) there are children and we're at the end of the children
 
     findNode = aNode->GetChildAt(aNodeOffset);
-    if (!findNode && !aNodeOffset) {
-      if (aNode == GetNode()) {
-        // There are no children, which means this is an empty nsIAccessibleText, in which
-        // case we can only be at hypertext offset 0
-        *aHyperTextOffset = 0;
-        return nullptr;
+    if (!findNode) {
+      if (aNodeOffset == 0) {
+        if (aNode == GetNode()) {
+          // Case #1: this accessible has no children and thus has empty text,
+          // we can only be at hypertext offset 0.
+          *aHyperTextOffset = 0;
+          return nullptr;
+        }
+
+        // Case #2: there are no children, we're at this node.
+        findNode = aNode;
+      } else if (aNodeOffset == aNode->GetChildCount()) {
+        // Case #3: we're after the last child, get next node to this one.
+        for (nsINode* tmpNode = aNode;
+             !findNode && tmpNode && tmpNode != mContent;
+             tmpNode = tmpNode->GetParent()) {
+          findNode = tmpNode->GetNextSibling();
+        }
       }
-      findNode = aNode; // Case #2: there are no children
     }
   }
 
   // Get accessible for this findNode, or if that node isn't accessible, use the
   // accessible for the next DOM node which has one (based on forward depth first search)
   Accessible* descendantAcc = nullptr;
   if (findNode) {
     nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
--- a/accessible/src/html/HTMLTableAccessible.cpp
+++ b/accessible/src/html/HTMLTableAccessible.cpp
@@ -23,17 +23,17 @@
 #include "nsIDOMRange.h"
 #include "nsISelectionPrivate.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDOMHTMLTableCellElement.h"
 #include "nsIDOMHTMLTableElement.h"
 #include "nsIDOMHTMLTableRowElement.h"
-#include "nsIDOMHTMLTableSectionElem.h"
+#include "nsIDOMHTMLTableSectionElement.h"
 #include "nsIDocument.h"
 #include "nsIMutableArray.h"
 #include "nsIPresShell.h"
 #include "nsITableCellLayout.h"
 #include "nsFrameSelection.h"
 #include "nsError.h"
 #include "nsArrayUtils.h"
 #include "nsComponentManagerUtils.h"
--- a/accessible/src/mac/RootAccessibleWrap.mm
+++ b/accessible/src/mac/RootAccessibleWrap.mm
@@ -5,17 +5,17 @@
 
 #include "RootAccessibleWrap.h"
 
 #include "mozDocAccessible.h"
 
 #include "nsCOMPtr.h"
 #include "nsObjCExceptions.h"
 #include "nsIWidget.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 
 using namespace mozilla::a11y;
 
 RootAccessibleWrap::
   RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                      nsIPresShell* aPresShell) :
   RootAccessible(aDocument, aRootContent, aPresShell)
 {
--- a/accessible/src/msaa/AccessibleWrap.cpp
+++ b/accessible/src/msaa/AccessibleWrap.cpp
@@ -29,17 +29,17 @@
 #include "nsIMutableArray.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
 #include "nsIServiceManager.h"
 #include "nsTextFormatter.h"
 #include "nsView.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsEventMap.h"
 #include "nsArrayUtils.h"
 #include "mozilla/Preferences.h"
 
 #include "Accessible2_i.c"
 #include "AccessibleRole.h"
 #include "AccessibleStates.h"
 #include "oleacc.h"
@@ -1648,17 +1648,17 @@ AccessibleWrap::GetHWNDFor(Accessible* a
     // Popup lives in own windows, use its HWND until the popup window is
     // hidden to make old JAWS versions work with collapsed comboboxes (see
     // discussion in bug 379678).
     nsIFrame* frame = aAccessible->GetFrame();
     if (frame) {
       nsIWidget* widget = frame->GetNearestWidget();
       if (widget && widget->IsVisible()) {
         nsIPresShell* shell = document->PresShell();
-        nsIViewManager* vm = shell->GetViewManager();
+        nsViewManager* vm = shell->GetViewManager();
         if (vm) {
           nsCOMPtr<nsIWidget> rootWidget;
           vm->GetRootWidget(getter_AddRefs(rootWidget));
           // Make sure the accessible belongs to popup. If not then use
           // document HWND (which might be different from root widget in the
           // case of window emulation).
           if (rootWidget != widget)
             return static_cast<HWND>(widget->GetNativeData(NS_NATIVE_WINDOW));
--- a/accessible/src/msaa/DocAccessibleWrap.cpp
+++ b/accessible/src/msaa/DocAccessibleWrap.cpp
@@ -16,17 +16,17 @@
 #include "Statistics.h"
 
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionController.h"
 #include "nsIServiceManager.h"
 #include "nsIURI.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsIWebNavigation.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -1262,16 +1262,48 @@ function synthSelectAll(aNodeOrID, aChec
 
   this.getID = function synthSelectAll_getID()
   {
     return aNodeOrID + " selectall";
   }
 }
 
 /**
+ * Move the caret in text accessible.
+ */
+function moveCaretToDOMPoint(aID, aNode, aOffset, aExpectedOffset,
+                             aFocusTargetID)
+{
+  this.target = getAccessible(aID, [nsIAccessibleText]);
+  this.focus = aFocusTargetID ? getAccessible(aFocusTargetID) : null;
+  this.focusNode = this.focus ? this.focus.DOMNode : null;
+
+  this.invoke = function moveCaretToDOMPoint_invoke()
+  {
+    if (this.focusNode)
+      this.focusNode.focus();
+
+    window.getSelection().getRangeAt(0).setStart(aNode, aOffset);
+  }
+
+  this.getID = function moveCaretToDOMPoint_getID()
+  {
+   return "Set caret on " + prettyName(aID) + " at point: " +
+     prettyName(aNode) + " node with offset " + aOffset;
+  }
+
+  this.eventSeq = [
+    new caretMoveChecker(aExpectedOffset, this.target)
+  ];
+
+  if (this.focus)
+    this.eventSeq.push(new asyncInvokerChecker(EVENT_FOCUS, this.focus));
+}
+
+/**
  * Set caret offset in text accessible.
  */
 function setCaretOffset(aID, aOffset, aFocusTargetID)
 {
   this.target = getAccessible(aID, [nsIAccessibleText]);
   this.offset = aOffset == -1 ? this.target.characterCount: aOffset;
   this.focus = aFocusTargetID ? getAccessible(aFocusTargetID) : null;
 
--- a/accessible/tests/mochitest/events/test_caretmove.html
+++ b/accessible/tests/mochitest/events/test_caretmove.html
@@ -72,36 +72,58 @@
 
       id = "p";
       gQueue.push(new synthShiftTab(id, new caretMoveChecker(0, id)));
       id = "textarea";
       gQueue.push(new synthShiftTab(id, new caretMoveChecker(12, id)));
       id = "p";
       gQueue.push(new synthTab(id, new caretMoveChecker(0, id)));
 
+      // Set caret after a child of span element, i.e. after 'text' text.
+      gQueue.push(new moveCaretToDOMPoint("test1", getNode("test1_span"), 1,
+                                           4, "test1"));
+      gQueue.push(new moveCaretToDOMPoint("test2", getNode("test2_span"), 1,
+                                           4, "test2"));
+
+      // empty text element
+      gQueue.push(new moveCaretToDOMPoint("test3", getNode("test3"), 0,
+                                           0, "test3"));
+      gQueue.push(new moveCaretToDOMPoint("test4", getNode("test4_span"), 0,
+                                           0, "test4"));
+
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTests);
   </script>
 </head>
 
 <body>
 
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=454377"
      title="Accessible caret move events testing">
-    Mozilla Bug 454377
+    Bug 454377
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=824901"
+     title="HyperTextAccessible::DOMPointToHypertextOffset fails for node and offset equal to node child count">
+    Bug 824901
   </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <input id="textbox" value="hello"/>
   <textarea id="textarea">text<br>text</textarea>
   <p id="p" contentEditable="true"><span>text</span><br/>text</p>
   <div id="div" contentEditable="true"><p id="p1_in_div">text</p><p id="p2_in_div">text</p></div>
 
+  <p contentEditable="true" id="test1"><span id="test1_span">text</span>ohoho</p>
+  <p contentEditable="true" id="test2"><span><span id="test2_span">text</span></span>ohoho</p>
+  <p contentEditable="true" id="test3"></p>
+  <p contentEditable="true" id="test4"><span id="test4_span"></span></p>
+
   <div id="eventdump"></div>
 </body>
 </html>
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -278,20 +278,24 @@ pref("widget.ime.android.landscape_fulls
 pref("widget.ime.android.fullscreen_threshold", 250); // in hundreths of inches
 
 // optimize images' memory usage
 pref("image.mem.decodeondraw", true);
 pref("content.image.allow_locking", true);
 pref("image.mem.min_discard_timeout_ms", 10000);
 pref("image.mem.max_decoded_image_kb", 5120); /* 5MB */
 
+// XXX this isn't a good check for "are touch events supported", but
+// we don't really have a better one at the moment.
+#ifdef MOZ_WIDGET_GONK
 // enable touch events interfaces
 pref("dom.w3c_touch_events.enabled", 1);
 pref("dom.w3c_touch_events.safetyX", 0); // escape borders in units of 1/240"
 pref("dom.w3c_touch_events.safetyY", 120); // escape borders in units of 1/240"
+#endif
 
 #ifdef MOZ_SAFE_BROWSING
 // Safe browsing does nothing unless this pref is set
 pref("browser.safebrowsing.enabled", true);
 
 // Prevent loading of pages identified as malware
 pref("browser.safebrowsing.malware.enabled", true);
 
@@ -539,16 +543,18 @@ pref("dom.ipc.processPriorityManager.ena
 pref("dom.ipc.processPriorityManager.gracePeriodMS", 1000);
 
 // Kernel parameters for how processes are killed on low-memory.
 pref("gonk.systemMemoryPressureRecoveryPollMS", 5000);
 pref("hal.processPriorityManager.gonk.masterOomScoreAdjust", 0);
 pref("hal.processPriorityManager.gonk.masterKillUnderMB", 1);
 pref("hal.processPriorityManager.gonk.foregroundOomScoreAdjust", 67);
 pref("hal.processPriorityManager.gonk.foregroundKillUnderMB", 4);
+pref("hal.processPriorityManager.gonk.backgroundPerceivableOomScoreAdjust", 134);
+pref("hal.processPriorityManager.gonk.backgroundPerceivebleKillUnderMB", 5);
 pref("hal.processPriorityManager.gonk.backgroundHomescreenOomScoreAdjust", 200);
 pref("hal.processPriorityManager.gonk.backgroundHomescreenKillUnderMB", 5);
 pref("hal.processPriorityManager.gonk.backgroundOomScoreAdjust", 400);
 pref("hal.processPriorityManager.gonk.backgroundKillUnderMB", 8);
 pref("hal.processPriorityManager.gonk.notifyLowMemUnderMB", 10);
 
 // Niceness values (i.e., CPU priorities) for B2G processes.
 pref("hal.processPriorityManager.gonk.masterNice", -1);
--- a/b2g/build.mk
+++ b/b2g/build.mk
@@ -13,18 +13,16 @@ endif
 endif
 
 TIERS += app
 
 ifdef MOZ_EXTENSIONS
 tier_app_dirs += extensions
 endif
 
-tier_app_dirs += services
-
 tier_app_dirs += \
   $(MOZ_BRANDING_DIRECTORY) \
   b2g \
   $(NULL)
 
 
 installer: 
 	@$(MAKE) -C b2g/installer installer
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -20,22 +20,169 @@ XPCOMUtils.defineLazyServiceGetter(Servi
 
 XPCOMUtils.defineLazyGetter(this, "domWindowUtils", function () {
   return content.QueryInterface(Ci.nsIInterfaceRequestor)
                 .getInterface(Ci.nsIDOMWindowUtils);
 });
 
 const RESIZE_SCROLL_DELAY = 20;
 
+let HTMLDocument = Ci.nsIDOMHTMLDocument;
+let HTMLHtmlElement = Ci.nsIDOMHTMLHtmlElement;
+let HTMLBodyElement = Ci.nsIDOMHTMLBodyElement;
+let HTMLIFrameElement = Ci.nsIDOMHTMLIFrameElement;
 let HTMLInputElement = Ci.nsIDOMHTMLInputElement;
 let HTMLTextAreaElement = Ci.nsIDOMHTMLTextAreaElement;
 let HTMLSelectElement = Ci.nsIDOMHTMLSelectElement;
 let HTMLOptGroupElement = Ci.nsIDOMHTMLOptGroupElement;
 let HTMLOptionElement = Ci.nsIDOMHTMLOptionElement;
 
+let FormVisibility = {
+  /**
+   * Searches upwards in the DOM for an element that has been scrolled.
+   *
+   * @param {HTMLElement} node element to start search at.
+   * @return {Window|HTMLElement|Null} null when none are found window/element otherwise.
+   */
+  findScrolled: function fv_findScrolled(node) {
+    let win = node.ownerDocument.defaultView;
+
+    while (!(node instanceof HTMLBodyElement)) {
+
+      // We can skip elements that have not been scrolled.
+      // We only care about top now remember to add the scrollLeft
+      // check if we decide to care about the X axis.
+      if (node.scrollTop !== 0) {
+        // the element has been scrolled so we may need to adjust
+        // where we think the root element is located.
+        //
+        // Otherwise it may seem visible but be scrolled out of the viewport
+        // inside this scrollable node.
+        return node;
+      } else {
+        // this node does not effect where we think
+        // the node is even if it is scrollable it has not hidden
+        // the element we are looking for.
+        node = node.parentNode;
+        continue;
+      }
+    }
+
+    // we also care about the window this is the more
+    // common case where the content is larger then
+    // the viewport/screen.
+    if (win.scrollMaxX || win.scrollMaxY) {
+      return win;
+    }
+
+    return null;
+  },
+
+  /**
+   * Checks if "top  and "bottom" points of the position is visible.
+   *
+   * @param {Number} top position.
+   * @param {Number} height of the element.
+   * @param {Number} maxHeight of the window.
+   * @return {Boolean} true when visible.
+   */
+  yAxisVisible: function fv_yAxisVisible(top, height, maxHeight) {
+    return (top > 0 && (top + height) < maxHeight);
+  },
+
+  /**
+   * Searches up through the dom for scrollable elements
+   * which are not currently visible (relative to the viewport).
+   *
+   * @param {HTMLElement} element to start search at.
+   * @param {Object} pos .top, .height and .width of element.
+   */
+  scrollablesVisible: function fv_scrollablesVisible(element, pos) {
+    while ((element = this.findScrolled(element))) {
+      if (element.window && element.self === element)
+        break;
+
+      // remember getBoundingClientRect does not care
+      // about scrolling only where the element starts
+      // in the document.
+      let offset = element.getBoundingClientRect();
+
+      // the top of both the scrollable area and
+      // the form element itself are in the same document.
+      // We  adjust the "top" so if the elements coordinates
+      // are relative to the viewport in the current document.
+      let adjustedTop = pos.top - offset.top;
+
+      let visible = this.yAxisVisible(
+        adjustedTop,
+        pos.height,
+        pos.width
+      );
+
+      if (!visible)
+        return false;
+
+      element = element.parentNode;
+    }
+
+    return true;
+  },
+
+  /**
+   * Verifies the element is visible in the viewport.
+   * Handles scrollable areas, frames and scrollable viewport(s) (windows).
+   *
+   * @param {HTMLElement} element to verify.
+   * @return {Boolean} true when visible.
+   */
+  isVisible: function fv_isVisible(element) {
+    // scrollable frames can be ignored we just care about iframes...
+    let rect = element.getBoundingClientRect();
+    let parent = element.ownerDocument.defaultView;
+
+    // used to calculate the inner position of frames / scrollables.
+    // The intent was to use this information to scroll either up or down.
+    // scrollIntoView(true) will _break_ some web content so we can't do
+    // this today. If we want that functionality we need to manually scroll
+    // the individual elements.
+    let pos = {
+      top: rect.top,
+      height: rect.height,
+      width: rect.width
+    };
+
+    let visible = true;
+
+    do {
+      let frame = parent.frameElement;
+      visible = visible &&
+                this.yAxisVisible(pos.top, pos.height, parent.innerHeight) &&
+                this.scrollablesVisible(element, pos);
+
+      // nothing we can do about this now...
+      // In the future we can use this information to scroll
+      // only the elements we need to at this point as we should
+      // have all the details we need to figure out how to scroll.
+      if (!visible)
+        return false;
+
+      if (frame) {
+        let frameRect = frame.getBoundingClientRect();
+
+        pos.top += frameRect.top + frame.clientTop;
+      }
+    } while (
+      (parent !== parent.parent) &&
+      (parent = parent.parent)
+    );
+
+    return visible;
+  }
+};
+
 let FormAssistant = {
   init: function fa_init() {
     addEventListener("focus", this, true, false);
     addEventListener("blur", this, true, false);
     addEventListener("resize", this, true, false);
     addMessageListener("Forms:Select:Choice", this);
     addMessageListener("Forms:Input:Value", this);
     addMessageListener("Forms:Select:Blur", this);
@@ -84,18 +231,20 @@ let FormAssistant = {
   },
 
   handleEvent: function fa_handleEvent(evt) {
     let focusedElement = this.focusedElement;
     let target = evt.target;
 
     switch (evt.type) {
       case "focus":
-        if (this.isTextInputElement(target) && this.isIMEDisabled())
-          return;
+        if (target && isContentEditable(target)) {
+          this.showKeyboard(this.getTopLevelEditable(target));
+          break;
+        }
 
         if (target && this.isFocusableElement(target))
           this.showKeyboard(target);
         break;
 
       case "blur":
         if (this.focusedElement)
           this.hideKeyboard();
@@ -128,17 +277,17 @@ let FormAssistant = {
           this.scrollIntoViewTimeout = null;
         }
 
         // We may receive multiple resize events in quick succession, so wait
         // a bit before scrolling the input element into view.
         if (this.focusedElement) {
           this.scrollIntoViewTimeout = content.setTimeout(function () {
             this.scrollIntoViewTimeout = null;
-            if (this.focusedElement) {
+            if (this.focusedElement && !FormVisibility.isVisible(this.focusedElement)) {
               this.focusedElement.scrollIntoView(false);
             }
           }.bind(this), RESIZE_SCROLL_DELAY);
         }
         break;
     }
   },
 
@@ -188,32 +337,19 @@ let FormAssistant = {
       case "Forms:Select:Blur": {
         this.setFocusedElement(null);
         break;
       }
     }
   },
 
   observe: function fa_observe(subject, topic, data) {
-    switch (topic) {
-      case "xpcom-shutdown":
-        Services.obs.removeObserver(this, "xpcom-shutdown");
-        removeMessageListener("Forms:Select:Choice", this);
-        removeMessageListener("Forms:Input:Value", this);
-        break;
-    }
-  },
-
-  isIMEDisabled: function fa_isIMEDisabled() {
-    let disabled = false;
-    try {
-      disabled = domWindowUtils.IMEStatus == domWindowUtils.IME_STATUS_DISABLED;
-    } catch (e) {}
-
-    return disabled;
+    Services.obs.removeObserver(this, "xpcom-shutdown");
+    removeMessageListener("Forms:Select:Choice", this);
+    removeMessageListener("Forms:Input:Value", this);
   },
 
   showKeyboard: function fa_showKeyboard(target) {
     if (this.isKeyboardOpened)
       return;
 
     if (target instanceof HTMLOptionElement)
       target = target.parentNode;
@@ -227,36 +363,56 @@ let FormAssistant = {
 
   hideKeyboard: function fa_hideKeyboard() {
     sendAsyncMessage("Forms:Input", { "type": "blur" });
     this.isKeyboardOpened = false;
     this.setFocusedElement(null);
   },
 
   isFocusableElement: function fa_isFocusableElement(element) {
-    if (element.contentEditable && element.contentEditable == "true") {
-      return true;
-    }
-
     if (element instanceof HTMLSelectElement ||
         element instanceof HTMLTextAreaElement)
       return true;
 
     if (element instanceof HTMLOptionElement &&
         element.parentNode instanceof HTMLSelectElement)
       return true;
 
     return (element instanceof HTMLInputElement &&
             !this.ignoredInputTypes.has(element.type));
   },
 
   isTextInputElement: function fa_isTextInputElement(element) {
     return element instanceof HTMLInputElement ||
            element instanceof HTMLTextAreaElement ||
-           (element.contentEditable && element.contentEditable == "true");
+           isContentEditable(element);
+  },
+
+  getTopLevelEditable: function fa_getTopLevelEditable(element) {
+    function retrieveTopLevelEditable(element) {
+      // Retrieve the top element that is editable
+      if (element instanceof HTMLHtmlElement)
+        element = element.ownerDocument.body;
+      else if (element instanceof HTMLDocument)
+        element = element.body;
+
+      while (element && !isContentEditable(element))
+        element = element.parentNode;
+
+      // Return the container frame if we are into a nested editable frame
+      if (element &&
+          element instanceof HTMLBodyElement &&
+          element.ownerDocument.defaultView != content.document.defaultView)
+        return element.ownerDocument.defaultView.frameElement;
+    }
+
+    if (element instanceof HTMLIFrameElement)
+      return element;
+
+    return retrieveTopLevelEditable(element) || element;
   },
 
   sendKeyboardState: function(element) {
     // FIXME/bug 729623: work around apparent bug in the IME manager
     // in gecko.
     let readonly = element.getAttribute("readonly");
     if (readonly) {
       return false;
@@ -265,22 +421,37 @@ let FormAssistant = {
     sendAsyncMessage("Forms:Input", getJSON(element));
     return true;
   }
 };
 
 FormAssistant.init();
 
 
+function isContentEditable(element) {
+  if (element.isContentEditable || element.designMode == "on")
+    return true;
+
+  // If a body element is editable and the body is the child of an
+  // iframe we can assume this is an advanced HTML editor
+  if (element instanceof HTMLIFrameElement &&
+      element.contentDocument &&
+      (element.contentDocument.body.isContentEditable ||
+       element.contentDocument.designMode == "on"))
+    return true;
+
+  return element.ownerDocument && element.ownerDocument.designMode == "on";
+}
+
 function getJSON(element) {
   let type = element.type || "";
   let value = element.value || ""
 
   // Treat contenteditble element as a special text field
-  if (element.contentEditable && element.contentEditable == "true") {
+  if (isContentEditable(element)) {
     type = "text";
     value = element.textContent;
   }
 
   // Until the input type=date/datetime/time have been implemented
   // let's return their real type even if the platform returns 'text'
   // Related to Bug 777279 - Implement <input type=time>
   let attributeType = element.getAttribute("type") || "";
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -76,18 +76,22 @@ function getContentWindow() {
 function debug(str) {
   dump(' -*- Shell.js: ' + str + '\n');
 }
 
 var shell = {
 
   get CrashSubmit() {
     delete this.CrashSubmit;
+#ifdef MOZ_CRASHREPORTER
     Cu.import("resource://gre/modules/CrashSubmit.jsm", this);
     return this.CrashSubmit;
+#else
+    return this.CrashSubmit = null;
+#endif
   },
 
   onlineForCrashReport: function shell_onlineForCrashReport() {
     let wifiManager = navigator.mozWifiManager;
     let onWifi = (wifiManager &&
                   (wifiManager.connection.status == 'connected'));
     return !Services.io.offline && onWifi;
   },
@@ -98,17 +102,17 @@ var shell = {
       // For chrome crashes, we want to report the lastRunCrashID.
       if (isChrome) {
         crashID = Cc["@mozilla.org/xre/app-info;1"]
                     .getService(Ci.nsIXULRuntime).lastRunCrashID;
       }
     } catch(e) { }
 
     // Bail if there isn't a valid crashID.
-    if (!crashID && !this.CrashSubmit.pendingIDs().length) {
+    if (!this.CrashSubmit || !crashID && !this.CrashSubmit.pendingIDs().length) {
       return;
     }
 
     // purge the queue.
     this.CrashSubmit.pruneSavedDumps();
 
     try {
       // Check if we should automatically submit this crash.
--- a/b2g/components/ContentPermissionPrompt.js
+++ b/b2g/components/ContentPermissionPrompt.js
@@ -30,28 +30,35 @@ Cu.import("resource://gre/modules/Permis
 var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
 var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
 
 XPCOMUtils.defineLazyServiceGetter(this,
                                    "PermSettings",
                                    "@mozilla.org/permissionSettings;1",
                                    "nsIDOMPermissionSettings");
 
-function rememberPermission(aPermission, aPrincipal)
+function rememberPermission(aPermission, aPrincipal, aSession)
 {
   function convertPermToAllow(aPerm, aPrincipal)
   {
     let type =
       permissionManager.testExactPermissionFromPrincipal(aPrincipal, aPerm);
     if (type == Ci.nsIPermissionManager.PROMPT_ACTION ||
         (type == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
         PROMPT_FOR_UNKNOWN.indexOf(aPermission) >= 0)) {
-      permissionManager.addFromPrincipal(aPrincipal,
-                                         aPerm,
-                                         Ci.nsIPermissionManager.ALLOW_ACTION);
+      if (!aSession) {
+        permissionManager.addFromPrincipal(aPrincipal,
+                                           aPerm,
+                                           Ci.nsIPermissionManager.ALLOW_ACTION);
+      } else {
+        permissionManager.addFromPrincipal(aPrincipal,
+                                           aPerm,
+                                           Ci.nsIPermissionManager.ALLOW_ACTION,
+                                           Ci.nsIPermissionManager.EXPIRE_SESSION, 0);
+      }
     }
   }
 
   // Expand the permission to see if we have multiple access properties to convert
   let access = PermissionsTable[aPermission].access;
   if (access) {
     for (let idx in access) {
       convertPermToAllow(aPermission + "-" + access[idx], aPrincipal);
@@ -97,27 +104,28 @@ ContentPermissionPrompt.prototype = {
 
     let requestId = this._id++;
     content.addEventListener("mozContentEvent", function contentEvent(evt) {
       if (evt.detail.id != requestId)
         return;
       evt.target.removeEventListener(evt.type, contentEvent);
 
       if (evt.detail.type == "permission-allow") {
-        if (evt.detail.remember) {
-          rememberPermission(request.type, request.principal);
-        }
-
+        rememberPermission(request.type, request.principal, !evt.detail.remember);
         request.allow();
         return;
       }
 
       if (evt.detail.remember) {
         Services.perms.addFromPrincipal(request.principal, access,
                                         Ci.nsIPermissionManager.DENY_ACTION);
+      } else {
+        Services.perms.addFromPrincipal(request.principal, access,
+                                        Ci.nsIPermissionManager.DENY_ACTION,
+                                        Ci.nsIPermissionManager.EXPIRE_SESSION, 0);
       }
 
       request.cancel();
     });
 
     let principal = request.principal;
     let isApp = principal.appStatus != Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED;
     let remember = principal.appStatus == Ci.nsIPrincipal.APP_STATUS_PRIVILEGED
--- 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="1356125617000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1357164966000">
   <emItems>
       <emItem  blockID="i58" id="webmaster@buzzzzvideos.info">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
                         <versionRange  minVersion="0.1" maxVersion="4.3.1.00" severity="1">
                     </versionRange>
@@ -374,17 +374,17 @@
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i84" id="pink@rosaplugin.info">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i220" id="pricepeep@getpricepeep.com">
-                        <versionRange  minVersion="0" maxVersion="*" severity="1">
+                        <versionRange  minVersion="0" maxVersion="2.1.0.19.99" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i226" id="{462be121-2b54-4218-bf00-b9bf8135b23f}">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i218" id="ffxtlbr@claro.com">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
@@ -571,24 +571,24 @@
                                 <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="4.0" maxVersion="16.*" />
                           </targetApplication>
                   </versionRange>
                   </pluginItem>
       <pluginItem  blockID="p176">
                   <match name="filename" exp="(NPSWF32\.dll)|(Flash\ Player\.plugin)" />                                    <versionRange  minVersion="0" maxVersion="10.3.183.18.999" severity="0" vulnerabilitystatus="1">
                                 <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
-                              <versionRange  minVersion="18.0a1" maxVersion="*" />
+                              <versionRange  minVersion="19.0a1" maxVersion="*" />
                           </targetApplication>
                   </versionRange>
                   </pluginItem>
       <pluginItem  blockID="p178">
                   <match name="filename" exp="(NPSWF[0-9_]*\.dll)|(Flash\ Player\.plugin)" />                                    <versionRange  minVersion="11.0" maxVersion="11.4.402.286.999" severity="0" vulnerabilitystatus="1">
                                 <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
-                              <versionRange  minVersion="18.0a1" maxVersion="*" />
+                              <versionRange  minVersion="19.0a1" maxVersion="*" />
                           </targetApplication>
                   </versionRange>
                   </pluginItem>
       <pluginItem  blockID="p180">
                   <match name="filename" exp="JavaAppletPlugin\.plugin" />                                    <versionRange  minVersion="Java 7 Update 07" maxVersion="Java 7 Update 08" severity="0" vulnerabilitystatus="1">
                                 <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="17.0" maxVersion="*" />
                           </targetApplication>
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -106,27 +106,29 @@ XRE_GetFileFromPathType XRE_GetFileFromP
 XRE_CreateAppDataType XRE_CreateAppData;
 XRE_FreeAppDataType XRE_FreeAppData;
 #ifdef XRE_HAS_DLL_BLOCKLIST
 XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
 #endif
 XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
 XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
 XRE_mainType XRE_main;
+XRE_DisableWritePoisoningType XRE_DisableWritePoisoning;
 
 static const nsDynamicFunctionLoad kXULFuncs[] = {
     { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
     { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
     { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
 #ifdef XRE_HAS_DLL_BLOCKLIST
     { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
 #endif
     { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
     { "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
     { "XRE_main", (NSFuncPtr*) &XRE_main },
+    { "XRE_DisableWritePoisoning", (NSFuncPtr*) &XRE_DisableWritePoisoning },
     { nullptr, nullptr }
 };
 
 static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
 {
   nsCOMPtr<nsIFile> appini;
   nsresult rv;
 
@@ -382,10 +384,24 @@ int main(int argc, char* argv[])
 
   int result;
   {
     ScopedLogging log;
     result = do_main(argc, argv, xreDirectory);
   }
 
   XPCOMGlueShutdown();
+
+
+#ifdef XP_MACOSX
+  // Allow writes again. While we would like to catch writes from static
+  // destructors to allow early exits to use _exit, we know that there is
+  // at least one such write that we don't control (see bug 826029). For
+  // now we enable writes again and early exits will have to use exit instead
+  // of _exit.
+
+  // Currently write poisoning is only available on OS X. Since on OS X we never
+  // unload XUL, it is safe to call this function after XPCOMGlueShutdown.
+  XRE_DisableWritePoisoning();
+#endif
+
   return result;
 }
rename from browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
rename to browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js.in
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js.in
@@ -167,18 +167,20 @@ let TestPilotSetup = {
 
     // Set up observation for task state changes
     var self = this;
     this._obs.add("testpilot:task:changed", this.onTaskStatusChanged, self);
     this._obs.add(
       "testpilot:task:dataAutoSubmitted", this._onTaskDataAutoSubmitted, self);
     // Set up observation for application shutdown.
     this._obs.add("quit-application", this.globalShutdown, self);
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
     // Set up observation for enter/exit private browsing:
     this._obs.add("private-browsing", this.onPrivateBrowsingMode, self);
+#endif
 
     // Set up timers to remind user x minutes after startup
     // and once per day thereafter.  Use nsITimer so it doesn't belong to
     // any one window.
     logger.trace("Setting interval for showing reminders...");
 
     this._shortTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     this._shortTimer.initWithCallback(
@@ -238,39 +240,43 @@ let TestPilotSetup = {
       self.taskList[i].onExperimentShutdown();
     }
     this.taskList = [];
     this._loader.unload();
     this._obs.remove("testpilot:task:changed", this.onTaskStatusChanged, self);
     this._obs.remove(
       "testpilot:task:dataAutoSubmitted", this._onTaskDataAutoSubmitted, self);
     this._obs.remove("quit-application", this.globalShutdown, self);
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
     this._obs.remove("private-browsing", this.onPrivateBrowsingMode, self);
+#endif
     this._loader.unload();
     this._shortTimer.cancel();
     this._longTimer.cancel();
     logger.trace("Done unregistering everything.");
   },
 
   _getFrontBrowserWindow: function TPS__getFrontWindow() {
     let wm = Cc["@mozilla.org/appshell/window-mediator;1"].
                getService(Ci.nsIWindowMediator);
     // TODO Is "most recent" the same as "front"?
     return wm.getMostRecentWindow("navigator:browser");
   },
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   onPrivateBrowsingMode: function TPS_onPrivateBrowsingMode(topic, data) {
     for (let i = 0; i < this.taskList.length; i++) {
       if (data == "enter") {
         this.taskList[i].onEnterPrivateBrowsing();
       } else if (data == "exit") {
         this.taskList[i].onExitPrivateBrowsing();
       }
     }
   },
+#endif
 
   onWindowUnload: function TPS__onWindowRegistered(window) {
     this._logger.trace("Called TestPilotSetup.onWindow unload!");
     for (let i = 0; i < this.taskList.length; i++) {
       this.taskList[i].onWindowClosed(window);
     }
   },
 
rename from browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js
rename to browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js.in
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js.in
@@ -157,21 +157,23 @@ var TestPilotTask = {
   onAppStartup: function TestPilotTask_onAppStartup() {
     // Called by extension core when Firefox startup is complete.
   },
 
   onAppShutdown: function TestPilotTask_onAppShutdown() {
     // Called by extension core when Firefox is shutting down.
   },
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   onEnterPrivateBrowsing: function TestPilotTask_onEnterPrivate() {
   },
 
   onExitPrivateBrowsing: function TestPilotTask_onExitPrivate() {
   },
+#endif
 
   onNewWindow: function TestPilotTask_onNewWindow(window) {
   },
 
   onWindowClosed: function TestPilotTask_onWindowClosed(window) {
   },
 
   onUrlLoad: function TestPilotTask_onUrlLoad(url) {
@@ -527,16 +529,17 @@ TestPilotExperiment.prototype = {
       try {
         this._handlers.doExperimentCleanup();
       } catch(e) {
         this._dataStore.logException("doExperimentCleanup: " + e);
       }
     }
   },
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   onEnterPrivateBrowsing: function TestPilotExperiment_onEnterPrivate() {
     this._logger.trace("Task is entering private browsing.");
     if (this.experimentIsRunning()) {
       try {
         this._handlers.onEnterPrivateBrowsing();
       } catch(e) {
         this._dataStore.logException("onEnterPrivateBrowsing: " + e);
       }
@@ -548,16 +551,17 @@ TestPilotExperiment.prototype = {
     if (this.experimentIsRunning()) {
       try {
         this._handlers.onExitPrivateBrowsing();
       } catch(e) {
         this._dataStore.logException("onExitPrivateBrowsing: " + e);
       }
     }
   },
+#endif
 
   getStudyMetadata: function TestPilotExperiment_getStudyMetadata() {
     try {
       if (this._handlers.getStudyMetadata) {
         let metadata = this._handlers.getStudyMetadata();
         if (metadata.length) {
           // getStudyMetadata must return an array, otherwise it is invalid.
           return metadata;
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -531,16 +531,21 @@ pref("browser.gesture.tap", "cmd_fullZoo
 // scrolling to shift+wheel.
 pref("mousewheel.with_alt.action", 2);
 pref("mousewheel.with_shift.action", 1);
 // On MacOS X, control+wheel is typically handled by system and we don't
 // receive the event.  So, command key which is the main modifier key for
 // acceleration is the best modifier for zoom-in/out.  However, we should keep
 // the control key setting for backward compatibility.
 pref("mousewheel.with_meta.action", 3); // command key on Mac
+// Disable control-/meta-modified horizontal mousewheel events, since
+// those are used on Mac as part of modified swipe gestures (e.g.
+// Left swipe+Cmd = go back in a new tab).
+pref("mousewheel.with_control.action.override_x", 0);
+pref("mousewheel.with_meta.action.override_x", 0);
 #else
 pref("mousewheel.with_alt.action", 1);
 pref("mousewheel.with_shift.action", 2);
 pref("mousewheel.with_meta.action", 1); // win key on Win, Super/Hyper on Linux
 #endif
 pref("mousewheel.with_control.action",3);
 pref("mousewheel.with_win.action", 1);
 
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -59,35 +59,35 @@ var StarUI = {
       case "popuphidden":
         if (aEvent.originalTarget == this.panel) {
           if (!this._element("editBookmarkPanelContent").hidden)
             this.quitEditMode();
 
           this._restoreCommandsState();
           this._itemId = -1;
           if (this._batching) {
-            PlacesUtils.transactionManager.endBatch();
+            PlacesUtils.transactionManager.endBatch(false);
             this._batching = false;
           }
 
           switch (this._actionOnHide) {
             case "cancel": {
               PlacesUtils.transactionManager.undoTransaction();
               break;
             }
             case "remove": {
               // Remove all bookmarks for the bookmark's url, this also removes
               // the tags for the url.
-              PlacesUtils.transactionManager.beginBatch();
+              PlacesUtils.transactionManager.beginBatch(null);
               let itemIds = PlacesUtils.getBookmarksForURI(this._uriForRemoval);
               for (let i = 0; i < itemIds.length; i++) {
                 let txn = new PlacesRemoveItemTransaction(itemIds[i]);
                 PlacesUtils.transactionManager.doTransaction(txn);
               }
-              PlacesUtils.transactionManager.endBatch();
+              PlacesUtils.transactionManager.endBatch(false);
               break;
             }
           }
           this._actionOnHide = "";
         }
         break;
       case "keypress":
         if (aEvent.defaultPrevented) {
@@ -230,17 +230,17 @@ var StarUI = {
   removeBookmarkButtonCommand: function SU_removeBookmarkButtonCommand() {
     this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
     this._actionOnHide = "remove";
     this.panel.hidePopup();
   },
 
   beginBatch: function SU_beginBatch() {
     if (!this._batching) {
-      PlacesUtils.transactionManager.beginBatch();
+      PlacesUtils.transactionManager.beginBatch(null);
       this._batching = true;
     }
   }
 }
 
 var PlacesCommandHook = {
   /**
    * Adds a bookmark to the page loaded in the given browser.
--- a/browser/build.mk
+++ b/browser/build.mk
@@ -9,18 +9,16 @@ endif
 TIERS += app
 
 ifdef MOZ_EXTENSIONS
 tier_app_dirs += extensions
 endif
 
 tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
 
-tier_app_dirs += services
-
 ifdef MOZ_WEBAPP_RUNTIME
 tier_app_dirs += webapprt
 endif
 
 tier_app_dirs += browser
 # Never add other tier_app_dirs after browser. They won't get packaged
 # properly on mac.
 
--- a/browser/components/downloads/content/allDownloadsViewOverlay.css
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.css
@@ -21,14 +21,13 @@ richlistitem.download {
                               [state="9"]) /* Blocked (policy)   */)
                                            .downloadRemoveFromHistoryMenuItem,
 .download-state:not(:-moz-any([state="-1"],/* Starting (initial) */
                               [state="0"], /* Downloading        */
                               [state="1"], /* Finished           */
                               [state="4"], /* Paused             */
                               [state="5"]) /* Starting (queued)  */)
                                            .downloadShowMenuItem,
-
-.download-state[state="7"]                 .downloadCommandsSeparator
-
+.download-state[state="7"]                 .downloadCommandsSeparator,
+.download-state:not([state])                 .downloadCommandsSeparator
 {
   display: none;
 }
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -7,33 +7,38 @@
  * IT IS HIGHLY RECOMMENDED NOT TO EXTEND IT FOR ANY OTHER USE CASES OR RELY
  * ON IT AS AN API.
  */
 
 let Cu = Components.utils;
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/DownloadUtils.jsm");
 Cu.import("resource:///modules/DownloadsCommon.jsm");
 Cu.import("resource://gre/modules/PlacesUtils.jsm");
+Cu.import("resource://gre/modules/osfile.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
+                                  "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 const nsIDM = Ci.nsIDownloadManager;
 
 const DESTINATION_FILE_URI_ANNO  = "downloads/destinationFileURI";
 const DESTINATION_FILE_NAME_ANNO = "downloads/destinationFileName";
 const DOWNLOAD_STATE_ANNO        = "downloads/state";
 
 const DOWNLOAD_VIEW_SUPPORTED_COMMANDS =
  ["cmd_delete", "cmd_copy", "cmd_paste", "cmd_selectAll",
   "downloadsCmd_pauseResume", "downloadsCmd_cancel",
   "downloadsCmd_open", "downloadsCmd_show", "downloadsCmd_retry",
-  "downloadsCmd_openReferrer"];
+  "downloadsCmd_openReferrer", "downloadsCmd_clearDownloads"];
 
 const NOT_AVAILABLE = Number.MAX_VALUE;
 
 function GetFileForFileURI(aFileURI)
   Cc["@mozilla.org/network/protocol;1?name=file"]
     .getService(Ci.nsIFileProtocolHandler)
     .getFileFromURLSpec(aFileURI);
 
@@ -88,40 +93,49 @@ DownloadElementShell.prototype = {
   // The data item for the download
   _dataItem: null,
   get dataItem() this._dataItem,
 
   set dataItem(aValue) {
     if ((this._dataItem = aValue)) {
       this._wasDone = this._dataItem.done;
       this._wasInProgress = this._dataItem.inProgress;
+      this._targetFileInfoFetched = false;
+      this._fetchTargetFileInfo();
     }
     else if (this._placesNode) {
       this._wasInProgress = false;
       this._wasDone = this.getDownloadState(true) == nsIDM.DOWNLOAD_FINISHED;
+      this._targetFileInfoFetched = false;
+      this._fetchTargetFileInfo();
     }
 
     this._updateStatusUI();
     return aValue;
   },
 
   _placesNode: null,
   get placesNode() this._placesNode,
   set placesNode(aNode) {
     if (this._placesNode != aNode) {
       // Preserve the annotations map if this is the first loading and we got
       // cached values.
       if (this._placesNode || !this._annotations) {
         this._annotations = new Map();
       }
       this._placesNode = aNode;
+
+      // We don't need to update the UI if we had a data item, because
+      // the places information isn't used in this case.
       if (!this._dataItem && this._placesNode) {
         this._wasInProgress = false;
         this._wasDone = this.getDownloadState(true) == nsIDM.DOWNLOAD_FINISHED;
+        this._targetFileInfoFetched = false;
         this._updateStatusUI();
+        this._fetchTargetFileInfo();
       }
     }
     return aNode;
   },
 
   // The download uri (as a string)
   get downloadURI() {
     if (this._dataItem)
@@ -172,106 +186,118 @@ DownloadElementShell.prototype = {
       }
       value = aDefaultValue;
     }
 
     this._annotations.set(aAnnotation, value);
     return value;
   },
 
-  // The uri (as a string) of the target file, if any.
-  get _targetFileURI() {
-    if (this._dataItem)
-      return this._dataItem.file;
-
-    return this._getAnnotation(DESTINATION_FILE_URI_ANNO, "");
-  },
-
   // The label for the download
   get _displayName() {
     if (this._dataItem)
       return this._dataItem.target;
 
     try {
       return this._getAnnotation(DESTINATION_FILE_NAME_ANNO);
     }
     catch(ex) { }
 
     // Fallback to the places title, or, at last, to the download uri.
     return this._placesNode.title || this.downloadURI;
   },
 
-  // If there's a target file for the download, this is its nsIFile object.
-  get _file() {
-    if (!("__file" in this)) {
-      if (this._dataItem) {
-        this.__file = this._dataItem.localFile;
-      }
-      else {
-        this.__file = this._targetFileURI ?
-          GetFileForFileURI(this._targetFileURI) : null;
-      }
-    }
-    return this.__file;
+  // The uri (as a string) of the target file, if any.
+  get _targetFileURI() {
+    if (this._dataItem)
+      return this._dataItem.file;
+
+    return this._getAnnotation(DESTINATION_FILE_URI_ANNO, "");
+  },
+
+  get _targetFilePath() {
+    let fileURI = this._targetFileURI;
+    if (fileURI)
+      return GetFileForFileURI(fileURI).path;
+    return "";
   },
 
-  // The target's file size in bytes. If there's no target file, or If we
-  // cannot determine its size, 0 is returned.
-  get _fileSize() {
-    if (!("__fileSize" in this)) {
-      if (!this._file || !this._file.exists())
-        this.__fileSize = 0;
-      try {
-        this.__fileSize = this._file.fileSize;
-      }
-      catch(ex) {
-        Cu.reportError(ex);
-        this.__fileSize = 0;
-      }
+  _fetchTargetFileInfo: function DES__fetchTargetFileInfo() {
+    if (this._targetFileInfoFetched)
+      throw new Error("_fetchTargetFileInfo should not be called if the information was already fetched");
+
+    let path = this._targetFilePath;
+
+    // In previous version, the target file annotations were not set,
+    // so we cannot where is the file.
+    if (!path) {
+      this._targetFileInfoFetched = true;
+      this._targetFileExists = false;
+      return;
     }
-    return this.__fileSize;
+
+    OS.File.stat(path).then(
+      function onSuccess(fileInfo) {
+        this._targetFileInfoFetched = true;
+        this._targetFileExists = true;
+        this._targetFileSize = fileInfo.size;
+        delete this._state;
+        this._updateDownloadStatusUI();
+      }.bind(this),
+
+      function onFailure(aReason) {
+        if (reason instanceof OS.File.Error && reason.becauseNoSuchFile) {
+          this._targetFileInfoFetched = true;
+          this._targetFileExists = false;
+        }
+        else {
+          Cu.reportError("Could not fetch info for target file (reason: " +
+                         aReason + ")");
+        }
+
+        this._updateDownloadStatusUI();
+      }.bind(this)
+    );
   },
 
   /**
-   * Get the state of the download
+   * Get the state of the download (see nsIDownloadManager).
+   * For past downloads, for which we don't know the state at first,
+   * |undefined| is returned until we have info for the target file,
+   * indicating the state is unknown. |undefined| is also returned
+   * if the file was not found at last.
+   *
    * @param [optional] aForceUpdate
    *        Whether to force update the cached download state. Default: false.
+   * @return the download state if available, |undefined| otherwise.
    */
-  // The download state (see nsIDownloadManager).
   getDownloadState: function DES_getDownloadState(aForceUpdate = false) {
     if (aForceUpdate || !("_state" in this)) {
       if (this._dataItem) {
         this._state = this._dataItem.state;
       }
       else {
         try {
           this._state = this._getAnnotation(DOWNLOAD_STATE_ANNO);
         }
         catch (ex) {
-          // The state annotation didn't exist in past releases.
-          if (!this._file) {
+          if (!this._targetFileInfoFetched || !this._targetFileExists)
+            this._state = undefined;
+          else if (this._targetFileSize > 0)
+            this._state = nsIDM.DOWNLOAD_FINISHED;
+          else
             this._state = nsIDM.DOWNLOAD_FAILED;
-          }
-          else if (this._file.exists()) {
-            this._state = this._fileSize > 0 ?
-              nsIDM.DOWNLOAD_FINISHED : nsIDM.DOWNLOAD_FAILED;
-          }
-          else {
-            // XXXmano I'm not sure if this right. We should probably show no
-            // status text at all in this case.
-            this._state = nsIDM.DOWNLOAD_CANCELED;
-          }
         }
       }
     }
     return this._state;
   },
 
   // The status text for the download
-  get _statusText() {
+  _getStatusText: function DES__getStatusText() {
     let s = DownloadsCommon.strings;
     if (this._dataItem && this._dataItem.inProgress) {
       if (this._dataItem.paused) {
         let transfer =
           DownloadUtils.getTransferTotal(this._dataItem.currBytes,
                                          this._dataItem.maxBytes);
 
          // We use the same XUL label to display both the state and the amount
@@ -311,25 +337,25 @@ DownloadElementShell.prototype = {
       case nsIDM.DOWNLOAD_BLOCKED_PARENTAL:
         return s.stateBlockedParentalControls;
       case nsIDM.DOWNLOAD_BLOCKED_POLICY:
         return s.stateBlockedPolicy;
       case nsIDM.DOWNLOAD_DIRTY:
         return s.stateDirty;
       case nsIDM.DOWNLOAD_FINISHED:{
         // For completed downloads, show the file size (e.g. "1.5 MB")
-        if (this._fileSize > 0) {
-          let [size, unit] = DownloadUtils.convertByteUnits(this._fileSize);
+        if (this._targetFileInfoFetched && this._targetFileExists) {
+          let [size, unit] = DownloadUtils.convertByteUnits(this._targetFileSize);
           return s.sizeWithUnits(size, unit);
         }
         break;
       }
     }
 
-    return "";
+    return s.sizeUnknown;
   },
 
   // The progressmeter element for the download
   get _progressElement() {
     let progressElement = document.getAnonymousElementByAttribute(
       this._element, "anonid", "progressmeter");
     if (progressElement) {
       delete this._progressElement;
@@ -337,18 +363,21 @@ DownloadElementShell.prototype = {
     }
     return null;
   },
 
   // Updates the download state attribute (and by that hide/unhide the
   // appropriate buttons and context menu items), the status text label,
   // and the progress meter.
   _updateDownloadStatusUI: function  DES__updateDownloadStatusUI() {
-    this._element.setAttribute("state", this.getDownloadState(true));
-    this._element.setAttribute("status", this._statusText);
+    let state = this.getDownloadState(true);
+    if (state !== undefined)
+      this._element.setAttribute("state", state);
+
+    this._element.setAttribute("status", this._getStatusText());
 
     // For past-downloads, we're done. For session-downloads, we may also need
     // to update the progress-meter.
     if (!this._dataItem)
       return;
 
     // Copied from updateProgress in downloads.js.
     if (this._dataItem.starting) {
@@ -369,24 +398,22 @@ DownloadElementShell.prototype = {
     }
 
     // Dispatch the ValueChange event for accessibility, if possible.
     if (this._progressElement) {
       let event = document.createEvent("Events");
       event.initEvent("ValueChange", true, true);
       this._progressElement.dispatchEvent(event);
     }
-
-    goUpdateDownloadCommands();
   },
 
   _updateStatusUI: function DES__updateStatusUI() {
-    this._updateDownloadStatusUI();
+    this._element.setAttribute("displayName", this._displayName);
     this._element.setAttribute("image", this._icon);
-    this._element.setAttribute("displayName", this._displayName);
+    this._updateDownloadStatusUI();
   },
 
   placesNodeIconChanged: function DES_placesNodeIconChanged() {
     if (!this._dataItem)
       this._element.setAttribute("image", this._icon);
   },
 
   placesNodeTitleChanged: function DES_placesNodeTitleChanged() {
@@ -401,102 +428,122 @@ DownloadElementShell.prototype = {
         this._element.setAttribute("image", this._icon);
         this._updateDownloadStatusUI();
       }
       else if (aAnnoName == DESTINATION_FILE_NAME_ANNO) {
         this._element.setAttribute("displayName", this._displayName);
       }
       else if (aAnnoName == DOWNLOAD_STATE_ANNO) {
         this._updateDownloadStatusUI();
+        if (this._element.selected)
+          goUpdateDownloadCommands();
       }
     }
   },
 
   /* DownloadView */
   onStateChange: function DES_onStateChange() {
-    // See comment in DVI_onStateChange in downloads.js (the panel-view)
-    if (!this._wasDone && this._dataItem.done)
+    if (!this._wasDone && this._dataItem.done) {
+      // See comment in DVI_onStateChange in downloads.js (the panel-view)
       this._element.setAttribute("image", this._icon + "&state=normal");
 
+      this._targetFileInfoFetched = false;
+      this._fetchTargetFileInfo();
+    }
+
     this._wasDone = this._dataItem.done;
 
     // Update the end time using the current time if required.
     if (this._wasInProgress && !this._dataItem.inProgress) {
       this._endTime = Date.now();
     }
 
     this._wasDone = this._dataItem.done;
     this._wasInProgress = this._dataItem.inProgress;
 
     this._updateDownloadStatusUI();
+    if (this._element.selected)
+      goUpdateDownloadCommands();
   },
 
   /* DownloadView */
   onProgressChange: function DES_onProgressChange() {
     this._updateDownloadStatusUI();
   },
 
   /* nsIController */
   isCommandEnabled: function DES_isCommandEnabled(aCommand) {
     switch (aCommand) {
       case "downloadsCmd_open": {
-        return this._file.exists() &&
-               ((this._dataItem && this._dataItem.openable) ||
-                (this.getDownloadState() == nsIDM.DOWNLOAD_FINISHED));
+        // We cannot open a session dowload file unless it's done ("openable").
+        // If it's finished, we need to make sure the file was not removed,
+        // as we do for past downloads.
+        if (this._dataItem && !this._dataItem.openable)
+          return false;
+
+        // Disable the command until we can yet tell whether
+        // or not the file is there.
+        if (!this._targetFileInfoFetched)
+          return false;
+
+        return this._targetFileExists;
       }
       case "downloadsCmd_show": {
-        return this._getTargetFileOrPartFileIfExists() != null;
+        // TODO: Bug 827010 - Handle part-file asynchronously. 
+        if (this._dataItem &&
+            this._dataItem.partFile && this._dataItem.partFile.exists())
+          return true;
+
+        // Disable the command until we can yet tell whether
+        // or not the file is there.
+        if (!this._targetFileInfoFetched)
+          return false;
+
+        return this._targetFileExists;
       }
       case "downloadsCmd_pauseResume":
         return this._dataItem && this._dataItem.inProgress && this._dataItem.resumable;
       case "downloadsCmd_retry":
-        return ((this._dataItem && this._dataItem.canRetry) ||
-                (!this._dataItem && this._file))
+        // Disable the retry command for past downloads until it's fully implemented.
+        return this._dataItem && this._dataItem.canRetry;
       case "downloadsCmd_openReferrer":
         return this._dataItem && !!this._dataItem.referrer;
       case "cmd_delete":
         // The behavior in this case is somewhat unexpected, so we disallow that.
         if (this._placesNode && this._dataItem && this._dataItem.inProgress)
           return false;
         return true;
       case "downloadsCmd_cancel":
         return this._dataItem != null;
     }
     return false;
   },
 
-  _getTargetFileOrPartFileIfExists: function DES__getTargetFileOrPartFileIfExists() {
-    if (this._file && this._file.exists())
-      return this._file;
-    if (this._dataItem &&
-        this._dataItem.partFile && this._dataItem.partFile.exists())
-      return this._dataItem.partFile;
-    return null;
-  },
-
   _retryAsHistoryDownload: function DES__retryAsHistoryDownload() {
     // TODO: save in the right location (the current saveURL api does not allow this)
     saveURL(this.downloadURI, this._displayName, null, true, true, undefined, document);
   },
 
   /* nsIController */
   doCommand: function DES_doCommand(aCommand) {
     switch (aCommand) {
       case "downloadsCmd_open": {
         if (this._dateItem)
           this._dataItem.openLocalFile(window);
         else
-          DownloadsCommon.openDownloadedFile(this._file, null, window);
+          DownloadsCommon.openDownloadedFile(
+            GetFileForFileURI(this._targetFileURI), null, window);
         break;
       }
       case "downloadsCmd_show": {
         if (this._dataItem)
           this._dataItem.showLocalFile();
         else
-          DownloadsCommon.showDownloadedFile(this._getTargetFileOrPartFileIfExists());
+          DownloadsCommon.showDownloadedFile(
+            GetFileForFileURI(this._targetFileURI));
         break;
       }
       case "downloadsCmd_openReferrer": {
         openURL(this._dataItem.referrer);
         break;
       }
       case "downloadsCmd_cancel": {
         this._dataItem.cancel();
@@ -821,17 +868,17 @@ DownloadsPlacesView.prototype = {
     else {
       shell.dataItem = null;
       // Move it below the session-download items;
       if (this._lastSessionDownloadElement == shell.dataItem) {
         this._lastSessionDownloadElement = shell.dataItem.previousSibling;
       }
       else {
         let before = this._lastSessionDownloadElement ?
-          this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstchild;
+          this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild;
         this._richlistbox.insertBefore(shell.element, before);
       }
     }
   },
 
   _place: "",
   get place() this._place,
   set place(val) {
@@ -960,16 +1007,17 @@ DownloadsPlacesView.prototype = {
   nodeDateAddedChanged: function() {},
   nodeLastModifiedChanged: function() {},
   nodeReplaced: function() {},
   nodeHistoryDetailsChanged: function() {},
   nodeTagsChanged: function() {},
   sortingChanged: function() {},
   nodeMoved: function() {},
   nodeURIChanged: function() {},
+  batching: function() {},
 
   get controller() this._richlistbox.controller,
 
   get searchTerm() this._searchTerm,
   set searchTerm(aValue) {
     if (this._searchTerm != aValue) {
       for (let element of this._richlistbox.childNodes) {
         element.hidden = !element._shell.matchesSearchTerm(aValue);
@@ -1007,16 +1055,18 @@ DownloadsPlacesView.prototype = {
     let selectedElements = this._richlistbox.selectedItems;
     switch (aCommand) {
       case "cmd_copy":
         return selectedElements && selectedElements.length > 0;
       case "cmd_selectAll":
         return true;
       case "cmd_paste":
         return this._canDownloadClipboardURL();
+      case "downloadsCmd_clearDownloads":
+        return !!this._richlistbox.firstChild;
       default:
         return Array.every(selectedElements, function(element) {
           return element._shell.isCommandEnabled(aCommand);
         });
     }
   },
 
   _copySelectedDownloadsToClipboard:
@@ -1068,16 +1118,28 @@ DownloadsPlacesView.prototype = {
         this._copySelectedDownloadsToClipboard();
         break;
       case "cmd_selectAll":
         this._richlistbox.selectAll();
         break;
       case "cmd_paste":
         this._downloadURLFromClipboard();
         break;
+      case "downloadsCmd_clearDownloads":
+        if (PrivateBrowsingUtils.isWindowPrivate(window)) {
+          Services.downloads.cleanUpPrivate();
+        } else {
+          Services.downloads.cleanUp();
+        }
+        if (this.result) {
+          Cc["@mozilla.org/browser/download-history;1"]
+            .getService(Ci.nsIDownloadHistory)
+            .removeAllDownloads();
+        }
+        break;
       default: {
         let selectedElements = this._richlistbox.selectedItems;
         for (let element of selectedElements) {
           element._shell.doCommand(aCommand);
         }
       }
     }
   },
@@ -1087,17 +1149,22 @@ DownloadsPlacesView.prototype = {
   onContextMenu: function DPV_onContextMenu(aEvent)
   {
     let element = this._richlistbox.selectedItem;
     if (!element || !element._shell)
       return false;
 
     // Set the state attribute so that only the appropriate items are displayed.
     let contextMenu = document.getElementById("downloadsContextMenu");
-    contextMenu.setAttribute("state", element._shell.getDownloadState());
+    let state = element._shell.getDownloadState();
+    if (state !== undefined)
+      contextMenu.setAttribute("state", state);
+    else
+      contextMenu.removeAttribute("state");
+
     return true;
   },
 
   onKeyPress: function DPV_onKeyPress(aEvent) {
     let selectedElements = this._richlistbox.selectedItems;
     if (!selectedElements)
       return;
 
@@ -1113,16 +1180,29 @@ DownloadsPlacesView.prototype = {
     }
     else if (aEvent.charCode == " ".charCodeAt(0)) {
       // Pausue/Resume every selected download
       for (let element of selectedElements) {
         if (element._shell.isCommandEnabled("downloadsCmd_pauseResume"))
           element._shell.doCommand("downloadsCmd_pauseResume");
       }
     }
+  },
+
+  onDoubleClick: function DPV_onDoubleClick(aEvent) {
+    if (aEvent.button != 0)
+      return;
+
+    let selectedElements = this._richlistbox.selectedItems;
+    if (!selectedElements || selectedElements.length != 1)
+      return;
+
+    let element = selectedElements[0];
+    if (element._shell)
+      element._shell.doDefaultCommand();
   }
 };
 
 function goUpdateDownloadCommands() {
   for (let command of DOWNLOAD_VIEW_SUPPORTED_COMMANDS) {
     goUpdateCommand(command);
   }
 }
--- a/browser/components/downloads/content/allDownloadsViewOverlay.xul
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.xul
@@ -38,17 +38,21 @@
           src="chrome://browser/content/downloads/allDownloadsViewOverlay.js"/>
   <script type="application/javascript"
           src="chrome://global/content/contentAreaUtils.js"/>
 
   <richlistbox flex="1"
                seltype="multiple"
                id="downloadsRichListBox" context="downloadsContextMenu"
                onkeypress="return this._placesView.onKeyPress(event);"
-               oncontextmenu="return this._placesView.onContextMenu(event);"/>
+               ondblclick="return this._placesView.onDoubleClick(event);"
+               oncontextmenu="return this._placesView.onContextMenu(event);"
+               onfocus="goUpdateDownloadCommands();"
+               onselect="goUpdateDownloadCommands();"
+               onblur="goUpdateDownloadCommands();"/>
 
   <commandset id="downloadCommands"
               commandupdater="true"
               events="focus,select,contextmenu"
               oncommandupdate="goUpdateDownloadCommands();">
     <command id="downloadsCmd_pauseResume"
              oncommand="goDoCommand('downloadsCmd_pauseResume')"/>
     <command id="downloadsCmd_cancel"
@@ -56,16 +60,18 @@
     <command id="downloadsCmd_open"
              oncommand="goDoCommand('downloadsCmd_open')"/>
     <command id="downloadsCmd_show"
              oncommand="goDoCommand('downloadsCmd_show')"/>
     <command id="downloadsCmd_retry"
              oncommand="goDoCommand('downloadsCmd_retry')"/>
     <command id="downloadsCmd_openReferrer"
              oncommand="goDoCommand('downloadsCmd_openReferrer')"/>
+    <command id="downloadsCmd_clearDownloads"
+             oncommand="goDoCommand('downloadsCmd_clearDownloads')"/>
   </commandset>
 
   <menupopup id="downloadsContextMenu" class="download-state">
     <menuitem command="downloadsCmd_pauseResume"
               class="downloadPauseMenuItem"
               label="&cmd.pause.label;"
               accesskey="&cmd.pause.accesskey;"/>
     <menuitem command="downloadsCmd_pauseResume"
@@ -94,10 +100,16 @@
     <menuseparator class="downloadCommandsSeparator"/>
 
     <menuitem command="downloadsCmd_openReferrer"
               label="&cmd.goToDownloadPage.label;"
               accesskey="&cmd.goToDownloadPage.accesskey;"/>
     <menuitem command="cmd_copy"
               label="&cmd.copyDownloadLink.label;"
               accesskey="&cmd.copyDownloadLink.accesskey;"/>
+
+    <menuseparator/>
+
+    <menuitem command="downloadsCmd_clearDownloads"
+              label="&cmd.clearDownloads.label;"
+              accesskey="&cmd.clearDownloads.accesskey;"/>
   </menupopup>
 </overlay>
--- a/browser/components/downloads/content/download.css
+++ b/browser/components/downloads/content/download.css
@@ -34,12 +34,14 @@ richlistitem.download button {
                               [state="4"]) /* Paused             */)
                                            .downloadCancel,
 
 .download-state:not(:-moz-any([state="2"], /* Failed             */
                               [state="3"]) /* Canceled           */)
                                            .downloadRetry,
 
 .download-state:not(          [state="1"]  /* Finished           */)
-                                           .downloadShow
+                                           .downloadShow,
+
+.download-state:not([state]) > button
 {
   display: none;
 }
--- a/browser/components/downloads/content/indicator.js
+++ b/browser/components/downloads/content/indicator.js
@@ -344,34 +344,37 @@ const DownloadsIndicatorView = {
   /**
    * Set while we are waiting for a notification to fade out.
    */
   _notificationTimeout: null,
 
   /**
    * If the status indicator is visible in its assigned position, shows for a
    * brief time a visual notification of a relevant event, like a new download.
+   *
+   * @param aType
+   *        Set to "start" for new downloads, "finish" for completed downloads.
    */
-  showEventNotification: function DIV_showEventNotification()
+  showEventNotification: function DIV_showEventNotification(aType)
   {
     if (!this._initialized) {
       return;
     }
 
     function DIV_SEN_callback() {
       if (this._notificationTimeout) {
         clearTimeout(this._notificationTimeout);
       }
 
       // Now that the overlay is loaded, place the indicator in its final
       // position.
       DownloadsButton.updatePosition();
 
       let indicator = this.indicator;
-      indicator.setAttribute("notification", "true");
+      indicator.setAttribute("notification", aType);
       this._notificationTimeout = setTimeout(
         function () indicator.removeAttribute("notification"), 1000);
     }
 
     this._ensureOperational(DIV_SEN_callback.bind(this));
   },
 
   //////////////////////////////////////////////////////////////////////////////
@@ -481,17 +484,17 @@ const DownloadsIndicatorView = {
   {
     if (!this._operational) {
       return this._attention;
     }
 
     if (this._attention != aValue) {
       this._attention = aValue;
       if (aValue) {
-        this.indicator.setAttribute("attention", "true")
+        this.indicator.setAttribute("attention", "true");
       } else {
         this.indicator.removeAttribute("attention");
       }
     }
     return aValue;
   },
   _attention: false,
 
--- a/browser/components/downloads/src/DownloadsCommon.jsm
+++ b/browser/components/downloads/src/DownloadsCommon.jsm
@@ -980,17 +980,22 @@ DownloadsDataCtor.prototype = {
     }
 
     this._views.forEach(
       function (view) view.getViewItem(dataItem).onStateChange()
     );
 
     if (isNew && !dataItem.newDownloadNotified) {
       dataItem.newDownloadNotified = true;
-      this._notifyNewDownload();
+      this._notifyDownloadEvent("start");
+    }
+
+    // This is a final state of which we are only notified once.
+    if (dataItem.done) {
+      this._notifyDownloadEvent("finish");
     }
   },
 
   onProgressChange: function DD_onProgressChange(aWebProgress, aRequest,
                                                   aCurSelfProgress,
                                                   aMaxSelfProgress,
                                                   aCurTotalProgress,
                                                   aMaxTotalProgress, aDownload)
@@ -1037,36 +1042,39 @@ DownloadsDataCtor.prototype = {
   },
 
   set panelHasShownBefore(aValue) {
     Services.prefs.setBoolPref("browser.download.panel.shown", aValue);
     return aValue;
   },
 
   /**
-   * Displays a new download notification in the most recent browser window, if
-   * one is currently available.
+   * Displays a new or finished download notification in the most recent browser
+   * window, if one is currently available with the required privacy type.
+   *
+   * @param aType
+   *        Set to "start" for new downloads, "finish" for completed downloads.
    */
-  _notifyNewDownload: function DD_notifyNewDownload()
+  _notifyDownloadEvent: function DD_notifyDownloadEvent(aType)
   {
     if (DownloadsCommon.useToolkitUI) {
       return;
     }
 
     // Show the panel in the most recent browser window, if present.
     let browserWin = RecentWindow.getMostRecentBrowserWindow({ private: this._isPrivate });
     if (!browserWin) {
       return;
     }
 
     if (this.panelHasShownBefore) {
       // For new downloads after the first one, don't show the panel
       // automatically, but provide a visible notification in the topmost
       // browser window, if the status indicator is already visible.
-      browserWin.DownloadsIndicatorView.showEventNotification();
+      browserWin.DownloadsIndicatorView.showEventNotification(aType);
       return;
     }
     this.panelHasShownBefore = true;
     browserWin.DownloadsPanel.showPanel();
   }
 };
 
 XPCOMUtils.defineLazyGetter(this, "PrivateDownloadsData", function() {
--- a/browser/components/downloads/test/browser/browser_first_download_panel.js
+++ b/browser/components/downloads/test/browser/browser_first_download_panel.js
@@ -14,29 +14,29 @@ function gen_test()
     // Ensure that state is reset in case previous tests didn't finish.
     for (let yy in gen_resetState(DownloadsCommon.getData(window))) yield;
 
     // With this set to false, we should automatically open the panel
     // the first time a download is started.
     DownloadsCommon.getData(window).panelHasShownBefore = false;
 
     prepareForPanelOpen();
-    DownloadsCommon.getData(window)._notifyNewDownload();
+    DownloadsCommon.getData(window)._notifyDownloadEvent("start");
     yield;
 
     // If we got here, that means the panel opened.
     DownloadsPanel.hidePanel();
 
     ok(DownloadsCommon.getData(window).panelHasShownBefore,
        "Should have recorded that the panel was opened on a download.")
 
     // Next, make sure that if we start another download, we don't open
     // the panel automatically.
     panelShouldNotOpen();
-    DownloadsCommon.getData(window)._notifyNewDownload();
+    DownloadsCommon.getData(window)._notifyDownloadEvent("start");
     yield waitFor(2);
   } catch(e) {
     ok(false, e);
   } finally {
     // Clean up when the test finishes.
     for (let yy in gen_resetState(DownloadsCommon.getData(window))) yield;
   }
 }
--- a/browser/components/places/content/bookmarkProperties.js
+++ b/browser/components/places/content/bookmarkProperties.js
@@ -400,25 +400,25 @@ var BookmarkPropertiesPanel = {
         break;
     }
   },
 
   _beginBatch: function BPP__beginBatch() {
     if (this._batching)
       return;
 
-    PlacesUtils.transactionManager.beginBatch();
+    PlacesUtils.transactionManager.beginBatch(null);
     this._batching = true;
   },
 
   _endBatch: function BPP__endBatch() {
     if (!this._batching)
       return;
 
-    PlacesUtils.transactionManager.endBatch();
+    PlacesUtils.transactionManager.endBatch(false);
     this._batching = false;
   },
 
   _fillEditProperties: function BPP__fillEditProperties() {
     gEditItemOverlay.initPanel(this._itemId,
                                { hiddenRows: this._hiddenRows,
                                  forceReadOnly: this._readOnly });
   },
--- a/browser/components/places/content/downloadsViewOverlay.xul
+++ b/browser/components/places/content/downloadsViewOverlay.xul
@@ -1,29 +1,44 @@
 <!-- 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/. -->
 
 <?xul-overlay href="chrome://browser/content/downloads/allDownloadsViewOverlay.xul"?>
 
+<!DOCTYPE overlay [
+<!ENTITY % downloadsDTD SYSTEM "chrome://browser/locale/downloads/downloads.dtd">
+%downloadsDTD;
+]>
+
 <overlay id="downloadsViewOverlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"><![CDATA[
     const DOWNLOADS_QUERY = "place:transition=" +
       Components.interfaces.nsINavHistoryService.TRANSITION_DOWNLOAD +
       "&sort=" +
       Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
 
     ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY,
       function() new DownloadsPlacesView(document.getElementById("downloadsRichListBox")),
-      { showDetailsPane: false });
+      { showDetailsPane: false,
+        toolbarSet: "back-button, forward-button, organizeButton, clearDownloadsButton, libraryToolbarSpacer, searchFilter" });
   ]]></script>
 
   <window id="places">
     <commandset id="downloadCommands"/>
     <menupopup id="downloadsContextMenu"/>
   </window>
 
   <deck id="placesViewsDeck">
     <richlistbox id="downloadsRichListBox"/>
   </deck>
+
+  <toolbar id="placesToolbar">
+    <toolbarbutton id="clearDownloadsButton"
+                   insertbefore="libraryToolbarSpacer"
+                   label="&clearDownloadsButton.label;"
+                   command="downloadsCmd_clearDownloads"
+                   tooltiptext="&clearDownloadsButton.tooltip;"/>
+  </toolbar>
+
 </overlay>
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -1247,16 +1247,17 @@ let gPrivateBrowsingListener = {
 };
 #endif
 
 let ContentArea = {
   _specialViews: new Map(),
 
   init: function CA_init() {
     this._deck = document.getElementById("placesViewsDeck");
+    this._toolbar = document.getElementById("placesToolbar");
     ContentTree.init();
   },
 
   /**
    * Gets the content view to be used for loading the given query.
    * If a custom view was set by setContentViewForQueryString, that
    * view would be returned, else the default tree view is returned
    *
@@ -1310,19 +1311,35 @@ let ContentArea = {
       this._deck.selectedPanel = aView.associatedElement;
     return aView;
   },
 
   get currentPlace() this.currentView.place,
   set currentPlace(aQueryString) {
     this.currentView = this.getContentViewForQueryString(aQueryString);
     this.currentView.place = aQueryString;
+    this._updateToolbarSet();
     return aQueryString;
   },
 
+  _updateToolbarSet: function CA__updateToolbarSet() {
+    let toolbarSet = this.currentViewOptions.toolbarSet;
+    for (let elt of this._toolbar.childNodes) {
+      // On Windows and Linux the menu buttons are menus wrapped in a menubar.
+      if (elt.id == "placesMenu") {
+        for (let menuElt of elt.childNodes) {
+          menuElt.hidden = toolbarSet.indexOf(menuElt.id) == -1;
+        }
+      }
+      else {
+        elt.hidden = toolbarSet.indexOf(elt.id) == -1;
+      }
+    }
+  },
+
   /**
    * Options for the current view.
    *
    * @see ContentTree.viewOptions for supported options and default values.
    */
   get currentViewOptions() {
     // Use ContentTree options as default.
     let viewOptions = ContentTree.viewOptions;
@@ -1342,17 +1359,20 @@ let ContentArea = {
 
 let ContentTree = {
   init: function CT_init() {
     this._view = document.getElementById("placeContent");
   },
 
   get view() this._view,
 
-  get viewOptions() Object.seal({ showDetailsPane: true }),
+  get viewOptions() Object.seal({
+    showDetailsPane: true,
+    toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter"
+  }),
 
   openSelectedNode: function CT_openSelectedNode(aEvent) {
     let view = this.view;
     PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);
   },
 
   onClick: function CT_onClick(aEvent) {
     // Only handle clicks on tree children.
--- a/browser/components/places/content/places.xul
+++ b/browser/components/places/content/places.xul
@@ -321,17 +321,17 @@
           </menupopup>
 #ifdef XP_MACOSX
         </toolbarbutton>
 #else
         </menu>
       </menubar>
 #endif
 
-      <spacer flex="1"/>
+      <spacer id="libraryToolbarSpacer" flex="1"/>
 
       <textbox id="searchFilter"
                clickSelectsAll="true"
                type="search"
                aria-controls="placeContent"
                oncommand="PlacesSearchBox.search(this.value);"
                collection="bookmarks">
       </textbox>
--- a/browser/components/places/src/PlacesUIUtils.jsm
+++ b/browser/components/places/src/PlacesUIUtils.jsm
@@ -1148,20 +1148,20 @@ XPCOMUtils.defineLazyGetter(PlacesUIUtil
                       expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
       return new PlacesSetItemAnnotationTransaction(aItemId, annoObj);
     },
 
     ////////////////////////////////////////////////////////////////////////////
     //// nsITransactionManager forwarders.
 
     beginBatch: function()
-      PlacesUtils.transactionManager.beginBatch(),
+      PlacesUtils.transactionManager.beginBatch(null),
 
     endBatch: function()
-      PlacesUtils.transactionManager.endBatch(),
+      PlacesUtils.transactionManager.endBatch(false),
 
     doTransaction: function(txn)
       PlacesUtils.transactionManager.doTransaction(txn),
 
     undoTransaction: function()
       PlacesUtils.transactionManager.undoTransaction(),
 
     redoTransaction: function()
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js
+++ b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js
@@ -40,18 +40,18 @@ function testVariablesFiltering()
     is(innerScope.querySelectorAll(".variable:not([non-match])").length, 1,
       "There should be 1 variable displayed in the inner scope");
     is(mathScope.querySelectorAll(".variable:not([non-match])").length, 0,
       "There should be 0 variables displayed in the math scope");
     is(testScope.querySelectorAll(".variable:not([non-match])").length, 0,
       "There should be 0 variables displayed in the test scope");
     is(loadScope.querySelectorAll(".variable:not([non-match])").length, 1,
       "There should be 1 variable displayed in the load scope");
-    is(globalScope.querySelectorAll(".variable:not([non-match])").length, 3,
-      "There should be 3 variables displayed in the global scope");
+    is(globalScope.querySelectorAll(".variable:not([non-match])").length, 8,
+      "There should be 8 variables displayed in the global scope");
 
     is(innerScope.querySelectorAll(".property:not([non-match])").length, 0,
       "There should be 0 properties displayed in the inner scope");
     is(mathScope.querySelectorAll(".property:not([non-match])").length, 0,
       "There should be 0 properties displayed in the math scope");
     is(testScope.querySelectorAll(".property:not([non-match])").length, 0,
       "There should be 0 properties displayed in the test scope");
     is(loadScope.querySelectorAll(".property:not([non-match])").length, 0,
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -73,16 +73,17 @@
 #endif
 #ifdef XP_MACOSX
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
 @BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
 #else
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 #endif
 #ifdef XP_WIN32
+@BINPATH@/plugin-hang-ui@BIN_SUFFIX@
 #ifndef MOZ_DEBUG
 #if MOZ_MSVC_REDIST == 1400
 @BINPATH@/Microsoft.VC80.CRT.manifest
 @BINPATH@/msvcm80.dll
 @BINPATH@/msvcp80.dll
 @BINPATH@/msvcr80.dll
 #elif MOZ_MSVC_REDIST == 1500
 @BINPATH@/Microsoft.VC90.CRT.manifest
--- a/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
+++ b/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
@@ -59,16 +59,21 @@
 <!ENTITY cmd.goToDownloadPage.label       "Go To Download Page">
 <!ENTITY cmd.goToDownloadPage.accesskey   "G">
 <!ENTITY cmd.copyDownloadLink.label       "Copy Download Link">
 <!ENTITY cmd.copyDownloadLink.accesskey   "L">
 <!ENTITY cmd.removeFromHistory.label      "Remove From History">
 <!ENTITY cmd.removeFromHistory.accesskey  "e">
 <!ENTITY cmd.clearList.label              "Clear List">
 <!ENTITY cmd.clearList.accesskey          "a">
+<!ENTITY cmd.clearDownloads.label         "Clear Downloads">
+<!ENTITY cmd.clearDownloads.accesskey     "D">
 
 <!-- LOCALIZATION NOTE (downloadsHistory.label, downloadsHistory.accesskey):
      This string is shown at the bottom of the Downloads Panel when all the
      downloads fit in the available space, or when there are no downloads in
      the panel at all.
      -->
 <!ENTITY downloadsHistory.label           "Show All Downloads">
 <!ENTITY downloadsHistory.accesskey       "S">
+
+<!ENTITY clearDownloadsButton.label       "Clear Downloads">
+<!ENTITY clearDownloadsButton.tooltip     "Clears completed, canceled and failed downloads">
--- a/browser/themes/gnomestripe/browser.css
+++ b/browser/themes/gnomestripe/browser.css
@@ -50,17 +50,17 @@
 }
 
 #nav-bar:not(:-moz-lwtheme),
 #nav-bar[collapsed=true] + toolbar:not(:-moz-lwtheme),
 #nav-bar[collapsed=true] + #customToolbars + #PersonalToolbar:not(:-moz-lwtheme),
 #nav-bar[tabsontop=true],
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + toolbar,
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + #customToolbars + #PersonalToolbar {
-  background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
+  background-image: linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
 }
 
 #personal-bookmarks {
   min-height: 29px;
 }
 
 #browser-bottombox {
   /* opaque for layers optimization */
@@ -1052,20 +1052,20 @@ toolbar[iconsize="small"] #feed-button {
   -moz-padding-start: 2px;
   -moz-padding-end: 5px;
 }
 
 #urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity {
   background-color: #fff;
   color: hsl(92,100%,30%);
   -moz-margin-end: 4px;
-  background-image: -moz-linear-gradient(hsla(92,81%,16%,0),
-                                         hsla(92,81%,16%,.2) 25%,
-                                         hsla(92,81%,16%,.2) 75%,
-                                         hsla(92,81%,16%,0));
+  background-image: linear-gradient(hsla(92,81%,16%,0),
+                                    hsla(92,81%,16%,.2) 25%,
+                                    hsla(92,81%,16%,.2) 75%,
+                                    hsla(92,81%,16%,0));
   background-position: right;
   background-size: 1px;
   background-repeat: no-repeat;
 }
 
 #identity-box.verifiedIdentity:-moz-locale-dir(rtl) {
   background-position: left;
 }
@@ -1476,17 +1476,17 @@ richlistitem[type~="action"][actiontype=
 #editBMPanel_folderTree {
   min-width: 27em;
 }
 
 .panel-promo-box {
   margin: 8px -10px -10px -10px;
   padding: 8px 10px;
   border-top: 1px solid ThreeDShadow;
-  background-image: -moz-linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
+  background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
 }
 
 .panel-promo-icon {
   list-style-image: url("chrome://browser/skin/sync-notification-24.png");
   -moz-margin-end: 10px;
   vertical-align: middle;
 }
 
@@ -1535,87 +1535,86 @@ richlistitem[type~="action"][actiontype=
   box-shadow: 0 -1px 0 rgba(0,0,0,.1) inset;
 }
 
 #TabsToolbar[tabsontop=true]:not(:-moz-lwtheme):-moz-system-metric(menubar-drag) {
   -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-drag");
 }
 
 #TabsToolbar[tabsontop=false] {
-  background-image:
-    -moz-linear-gradient(bottom, rgba(0,0,0,.3) 1px, rgba(0,0,0,.05) 1px, transparent 50%);
+  background-image: linear-gradient(to top, rgba(0,0,0,.3) 1px, rgba(0,0,0,.05) 1px, transparent 50%);
 }
 
 .tabbrowser-tab,
 .tabs-newtab-button {
   position: static;
   -moz-appearance: none;
-  background: -moz-linear-gradient(hsla(0,0%,100%,.2), hsla(0,0%,45%,.2) 2px, hsla(0,0%,32%,.2) 80%);
+  background: linear-gradient(hsla(0,0%,100%,.2), hsla(0,0%,45%,.2) 2px, hsla(0,0%,32%,.2) 80%);
   background-origin: border-box;
   background-position: 1px 2px;
   background-size: 100% calc(100% - 2px);
   background-repeat: no-repeat;
   color: inherit;
   margin: 0;
   padding: 0;
   border-width: 4px 5px 3px 6px;
   border-style: solid;
   -moz-border-image: url(tabbrowser/tab.png) 4 5 3 6 fill repeat stretch;
   border-radius: 10px 8px 0 0;
   min-height: 25px; /* reserve space for the sometimes hidden close button */
 }
 
 .tabbrowser-tab:hover,
 .tabs-newtab-button:hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.2) 4px, hsla(0,0%,75%,.2) 80%);
+  background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.2) 4px, hsla(0,0%,75%,.2) 80%);
 }
 
 .tabbrowser-tab[selected="true"] {
-  background-image: -moz-linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 32%),
-                    -moz-linear-gradient(-moz-dialog, -moz-dialog);
+  background-image: linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 32%),
+                    linear-gradient(-moz-dialog, -moz-dialog);
   color: -moz-dialogtext;
 }
 
 #main-window[tabsontop=false]:not([disablechrome]) .tabbrowser-tab[selected=true]:not(:-moz-lwtheme) {
-  background-image: -moz-linear-gradient(bottom, rgba(0,0,0,.3) 1px, transparent 1px),
-                    -moz-linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 32%),
-                    -moz-linear-gradient(-moz-dialog, -moz-dialog);
+  background-image: linear-gradient(to top, rgba(0,0,0,.3) 1px, transparent 1px),
+                    linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 32%),
+                    linear-gradient(-moz-dialog, -moz-dialog);
 }
 
 .tabbrowser-tab[selected="true"]:-moz-lwtheme {
-  background-image: -moz-linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 32%);
+  background-image: linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 32%);
   color: inherit;
 }
 
 .tabbrowser-tab:-moz-lwtheme-brighttext:not([selected="true"]),
 .tabs-newtab-button:-moz-lwtheme-brighttext {
-  background-image: -moz-linear-gradient(hsla(0,0%,60%,.6), hsla(0,0%,40%,.6) 4px, hsla(0,0%,30%,.6) 80%);
+  background-image: linear-gradient(hsla(0,0%,60%,.6), hsla(0,0%,40%,.6) 4px, hsla(0,0%,30%,.6) 80%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-brighttext:not([selected="true"]):hover,
 .tabs-newtab-button:-moz-lwtheme-brighttext:hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,80%,.6), hsla(0,0%,60%,.6) 4px, hsla(0,0%,45%,.6) 80%);
+  background-image: linear-gradient(hsla(0,0%,80%,.6), hsla(0,0%,60%,.6) 4px, hsla(0,0%,45%,.6) 80%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-darktext:not([selected="true"]),
 .tabs-newtab-button:-moz-lwtheme-darktext {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.5), hsla(0,0%,60%,.5) 4px, hsla(0,0%,45%,.5) 80%);
+  background-image: linear-gradient(hsla(0,0%,100%,.5), hsla(0,0%,60%,.5) 4px, hsla(0,0%,45%,.5) 80%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-darktext:not([selected="true"]):hover,
 .tabs-newtab-button:-moz-lwtheme-darktext:hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.5), hsla(0,0%,80%,.5) 4px, hsla(0,0%,60%,.5) 80%);
+  background-image: linear-gradient(hsla(0,0%,100%,.5), hsla(0,0%,80%,.5) 4px, hsla(0,0%,60%,.5) 80%);
 }
 
 .tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
-  background-image: -moz-radial-gradient(center 3px, circle cover, rgba(233,242,252,1) 3%, rgba(172,206,255,.75) 40%, rgba(87,151,201,.5) 80%, rgba(87,151,201,0));
+  background-image: radial-gradient(circle farthest-corner at 50% 3px, rgba(233,242,252,1) 3%, rgba(172,206,255,.75) 40%, rgba(87,151,201,.5) 80%, rgba(87,151,201,0));
 }
 .tabbrowser-tab[pinned][titlechanged]:not([selected="true"]):hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.8), hsla(0,0%,100%,.6) 2px, hsla(0,0%,75%,.2) 80%),
-                    -moz-radial-gradient(center 3px, circle cover, rgba(233,242,252,1) 3%, rgba(172,206,255,.75) 40%, rgba(87,151,201,.5) 80%, rgba(87,151,201,0));
+  background-image: linear-gradient(hsla(0,0%,100%,.8), hsla(0,0%,100%,.6) 2px, hsla(0,0%,75%,.2) 80%),
+                    radial-gradient(circle farthest-corner at 50% 3px, rgba(233,242,252,1) 3%, rgba(172,206,255,.75) 40%, rgba(87,151,201,.5) 80%, rgba(87,151,201,0));
 }
 
 #tabbrowser-tabs[positionpinnedtabs] > .tabbrowser-tab > .tab-stack > .tab-content[pinned] {
   min-height: 18px; /* corresponds to the max. height of non-textual tab contents, i.e. the tab close button */
 }
 
 .tabbrowser-tab:focus > .tab-stack {
   outline: 1px dotted;
@@ -1934,19 +1933,19 @@ toolbar[mode="text"] toolbarbutton.chevr
   min-height: 0;
   -moz-appearance: none;
   background-color: transparent;
   border: none;
 }
 
 #addon-bar[customizing] > #status-bar {
   opacity: .5;
-  background-image: -moz-repeating-linear-gradient(-45deg,
-                                                   rgba(255,255,255,.3), rgba(255,255,255,.3) 5px,
-                                                   rgba(0,0,0,.3) 5px, rgba(0,0,0,.3) 10px);
+  background-image: repeating-linear-gradient(135deg,
+                                              rgba(255,255,255,.3), rgba(255,255,255,.3) 5px,
+                                              rgba(0,0,0,.3) 5px, rgba(0,0,0,.3) 10px);
 }
 
 #status-bar > statusbarpanel {
   border-width: 0;
   -moz-appearance: none;
 }
 
 #addonbar-closebutton {
@@ -1958,17 +1957,17 @@ toolbar[mode="text"] toolbarbutton.chevr
   margin-bottom: -2px;
 }
 
 /* Status panel */
 
 .statuspanel-label {
   margin: 0;
   padding: 2px 4px;
-  background: -moz-linear-gradient(white, #ddd);
+  background: linear-gradient(#fff, #ddd);
   border: 1px none #ccc;
   border-top-style: solid;
   color: #333;
   text-shadow: none;
 }
 
 .statuspanel-label:-moz-locale-dir(ltr):not([mirror]),
 .statuspanel-label:-moz-locale-dir(rtl)[mirror] {
@@ -2004,17 +2003,17 @@ toolbar[mode="text"] toolbarbutton.chevr
 }
 
 /* Highlighter - Node Infobar */
 
 .highlighter-nodeinfobar {
   color: hsl(200, 100%, 65%);
   border: 1px solid hsla(210, 19%, 63%, .5);
   border-radius: 3px;
-  background: -moz-linear-gradient(hsl(209, 18%, 30%), hsl(210, 24%, 16%)) no-repeat padding-box;
+  background: linear-gradient(hsl(209, 18%, 30%), hsl(210, 24%, 16%)) no-repeat padding-box;
 }
 
 /* Highlighter - Node Infobar - text */
 
 .highlighter-nodeinfobar-text {
   /* 100% - size of the buttons and margins */
   max-width: calc(100% - 2 * (26px + 6px));
   padding-bottom: 1px;
@@ -2088,25 +2087,25 @@ html|*.highlighter-nodeinfobar-pseudo-cl
   background-repeat: no-repeat;
 }
 
 .highlighter-nodeinfobar-arrow-top {
   margin-bottom: -8px;
   margin-top: 8px;
   border-right-color: hsla(210, 19%, 63%, .5);
   border-top-color: hsla(210, 19%, 63%, .5);
-  background-image: -moz-linear-gradient(bottom left, transparent 50%, hsl(209, 18%, 30%) 50%);
+  background-image: linear-gradient(to top right, transparent 50%, hsl(209, 18%, 30%) 50%);
 }
 
 .highlighter-nodeinfobar-arrow-bottom {
   margin-top: -8px;
   margin-bottom: 8px;
   border-left-color: hsla(210, 19%, 63%, .5);
   border-bottom-color: hsla(210, 19%, 63%, .5);
-  background-image: -moz-linear-gradient(top right, transparent 50%, hsl(210, 24%, 16%) 50%);
+  background-image: linear-gradient(to bottom left, transparent 50%, hsl(210, 24%, 16%) 50%);
 }
 
 .highlighter-nodeinfobar-container[position="top"] > .highlighter-nodeinfobar,
 .highlighter-nodeinfobar-container[position="overlap"] > .highlighter-nodeinfobar {
   box-shadow: 0 1px 0 hsla(0, 0%, 100%, .1) inset;
 }
 
 .highlighter-nodeinfobar-container[hide-arrow] > .highlighter-nodeinfobar {
@@ -2335,17 +2334,17 @@ html|*#gcli-output-frame {
 }
 
 /* Error counter */
 
 #developer-toolbar-toolbox-button[error-count]:before {
   color: #FDF3DE;
   min-width: 16px;
   text-shadow: none;
-  background-image: -moz-linear-gradient(top, #B4211B, #8A1915);
+  background-image: linear-gradient(#B4211B, #8A1915);
   border-radius: 1px;
   -moz-margin-end: 2px;
 }
 
 #social-toolbar-item {
   -moz-box-orient: horizontal;
 }
 
new file mode 100755
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7bcc7f569999b5e24184f8745d7618ed5cd7cd91
GIT binary patch
literal 3626
zc$_s?c{tSF7yr&Qma!X^HI%U=%S1`<V3Z|;EM*yM^dc{1GQ?moMz&-vTe6f&Z`LAY
zlo=CcYf;w9jCHbP#+H%6Z~T7G?~i-Vz2~0K=X}n6?(^K|ra9Q16BUvZ0suf1ZDoFe
z=ZSkmke_F1CceEqCmU{o3BQO92#@r|`2%PCu$TRn(bs&h_+Rk%^@|Ga_BY~z`_SfR
zobY46N}@1MGjbH+{dbFe9q-<-G?f(W|7CK+S#N#z!ciU7Vv<~5aEPFGG<nJG-d4yH
z!4~1sAonFA@utUY?qn{Gd{jkftn(+C9)q{<pZP3fsNY9mmolSvSE8nknHyU}`pg)m
znA<w7KOd&=nckkd!D`x+jDgYB<MVEY(?(aPxv6)fDBl?Snx{S!&zUJ|io8rZyR#*F
zTpii>IoTYcjrSn5h#8$Q^2E2S1oqG}QpiaiqG8uN@1H1CN%NU>p#w@Ge=8~)g&T44
zoK-=F<a?E;{3;SEKp2~L-w1I|bk-K8Az_*<{-a8&$)HSj6BG->#pbFX8uThHd=N`X
zbTeG)<SlOA5AX~cmBzjGEI~w~!AIQJhp_22f{Ksc4QyRYoD7R?vVH$4U)4L!FJ`R*
z6W#3>u@-l~^T?{V0@BkcC$>h33ac|e{$6_r)9@>u)$~u&>jbIsMD2C3Gj=;-B(D|3
zZPD@?S_#|6Sav(jO;qkT?#<uNU!T<MjyaJp&2RI{)K0dO_2K|i08tujFn!xNfuEHW
zouJvc6Kz;TTK=lOQ~1$^Smw53V52jCIrL}Ntw#?fN~e%lH%H?{a9tDS$H#4q=lO0+
zn}%#FB5LidhV%XR+rJFr;7l_=Ntu2yRA(c8@>u~Y<X!%j>Vf6_yZ7;@&(2@2IrK&W
zamuPssc$ljkQ;h~LE12<5hcMRlZ&!LLvd1i;hQmQDx<RxLplV3Fw&2t3Xag3NXdfK
zTD*Oe`G_INsf9X;+DUCX@fx0~tt|qxBp&$VGB8hMdXu&w=a)-)B_U5!#DxPsfu^$X
zt2#GcAlSPK{4km6%wmfWy#0D=eJJ>8Xw}K<Twm;iu3Z#g>XmHdl1%HAaSq_TUpW=>
zbP9Z13PTK?0Yh>CYltDd9!RkQU_^+6Cb575#`A)F_^I+1u;~&UfSQ6eU<@J!te_0q
zFN|>U0d?g9Pb4T8eLzNNpcA|(jUjHsiI+iLf?5<A7zF}e<Z;LT54fM<As))dcy$L5
z;*-&?2P)A2D?>R27G{e=%P~YpurT5l1d#y5{OCMDWZLmCK94Bi+i;MrGDR_gZ^R6o
z4Zw+dAWOn8wQ3+6$)n8%Zb3$PY~;QAZ94Tp-5o$pf>HHkQiu|!4&t?9ng-Ox9<BX<
zx-|s9E*#27{JsY`A&DWX?FlyFDgU?^c`Kx4ss;4{gG|B>xB{g}Xt@K?)r2>FUjk9)
z(OG~OVHl#<9wwO;r1f7F<xWI<$U%k_%=9@xgB<k1T$3n2TVqlz_jFL;-81AWds5O!
z>%0$W01hH8d*2roLKih8Kgd7_$+&2Yx|F3DD@HB(%(};Zz_;irG>k`J+*K0z0wLhW
z&X`bIjQ$l-GXX!ptiG#N&M*6bxY$OQ48H7gE?P=|cz(4*fM2_k_Q`3lqX|W}H<vx$
z=SHiC>fz1?h-N=nhB*;+3$6x}y3IuIALM`er_ZrYSH|OfiaXp?psmtJe;9E!;dWbg
zk!R}%JXGYCLAUC+?^nE_fhb(vH^Q6eImRbymir4!GJ5d!g(p_ueP1l?5CUEeztzvh
zTvwy;%YcsgBpWB*p?;@nfTnY=eM&l!(L3;4skOmzf^^4tG?PTVN-xRLni_v3SMyO|
zu*F;oz}0qNf!GrJGf5i!)kN8PT99f`h0X8-;J2ag@~l*m@Ph6et?e9p)^Gpd^<Om)
zy_Gt51rQ(uiXaB0?;{|R^ElQSLe#1F+*V8l(IO3IUb3HjGCO!paI%kh2m#5rbk)}1
zPdwL9cqn6SD@5HYul^_XmLx@}5QOx>90E-rHkIFc72K0MwS80TyVDg9R2fmnWV~!|
zcknPH)YE|SmU?Y0OZzViY~)evo~(m71MdySDmpAqWM2S9Y(wDd`>#L!%RSp9HNAt>
z{qXO^M&~{6MNb{brQF&#@@O2Nw|6KtbPFAKx4eGkC>5(Dd7(Fd|Bh)piLVNC3j(2i
zYS>?dF3TdoE)<c`f2T9bpM~&!n{0VNeffx97`wz08J~1&n(A`MrSvdZZO89}<Ua)7
zqLKwf^%`rIwg5NqIj(qd)@eqL#LLb(YSY4TctRe99v7=IW!q!Pij0?%IehG05G_6x
zA}XRP6GKta32L}Fmmh3q1s0~!e_s@t(o$rH#N+rlUD#chi60atSX=0)Fv3^0%7OE)
z6}&7eJzD!7Xy3T9dJ$ioDlLKDLMyGPFhK6y!>Q)NpZao&qiE^hr!jy1E`Nt_=s0zj
zB<WbJz*3({$$^}N#7kkX=N!%4oq5g1Btpwpj<?Iftf~^BbKcKANik^!{5g<-<T8RP
zDRL{bJrg;7`kCc~Ym@o3yg02TuXCl?3>*;6k&n{tEnAKi+r5!asWS)D(~8DF=N!F9
zUeFPNLv2NrqFr~cva(Q<vgzz%O?PIo4GHZw_CD3`{O7UNeO6#8DxDJJykl#_aX^08
zWVouG@ys;PIx_0mKI@5^<3IQ#2#u(M?oOrag1DE(Q2fo2HT!lhSpi!gO_tw<>sr81
zkGtP6aB7wObHH(MqHZe`NVgjJUQ#$={8n><$JP<q|0hK~IHZ>QAS>L=MmSNhHitdz
z{qtkTov#*mUbLyy$nBWHv*R5!(d+>4hBp)Fdu0V>QI4(8XOgIpS9%=g)^m1-oY*CK
z9SFAvj$gR>QJA1`4D)+ictHH1%TEu<MIq2CoY?-y^AfQxt9M9D5C1rLo4tD$?8@;P
z`&LPaSuSP#$^G(L73#9^4TcvfR046GnSbi*&HHP*Pq!v;5>hbiV|RRdWZM-9p5!Ku
zlWs1sZ`J~cpBa^Q8?jvP=XiR>@8bkb@J@&NRf*fWEdRPKHNFjiRex@-YGC`C!28qV
z@Cl;UPP@765}igc0eP6$JC)457dZp-bie*E1r8#7a&Vo{MXnlAc26I!b1QS_+m(bp
zbpZcpRN5|^xKkpmq^MiKP}!!>ix3JSHocRqnAPK#yeR73ABU|u@rOZ#j_TqZx*l8$
z9TpKc9+nGP2the7Ow@fvxxG0a(JI}@UBH&C%_S*eTZXJT2jKPpYEb)nwUH|mjJ`Hj
z>tHn0XF!-OUAENCf6ZZg?ZZFx(i`A7RahXCyPp%zv0U#K$B~EKp?;inyLEu$T1jAS
zd6tlNC7|>2*6i^NN@Yjx*C-Y<e*?0BMR^4?Xx8VV^`qxc6XT0?Q^<p8P97SuK|gb-
z!ypL9oDHuz38M%JFmw$!#SH>q&kvwJ8nA+ZOU_IN>MU4*OL9iC3e?Az`yW<s;7ar0
zBiG3l9JYOUVt)McC1!DCLX>?;%B3{O_$rpKc}j}5c6xLM20wTMCT5})4BAO~M}A%~
zT=ij9{G^#g+}|YZO^9$va|kVlWY*BoDyW_y5^qAGm;Z&_&fTRkzI~12sjFw(EesKE
z)MI};hQf&lL?~qi8(NKAeL`J@3bn2j!gg!en4DDiSZ+>@x#FLUc@0TsZ{B3BRab%R
zr3f=Hy!O`1YuE8F{#4<hY92HH`s#7TS6WS*<1ha{34Jrfdvi#2wj^~<mbFQ7k#8)F
zf;+%yFWV9c---&W6)>@2pI1*HTu2+fH4t$|^60%2Zs1_U7VBixsZ$UJ^MkhFJdrIg
zNzk{de^DK)T;Q{HdrczWTQA|-(fN>24(req8|C63&n{CRlchu|bDrEOSF{Eyy`pNl
zHL<|1Uc~C{wGWF9%b2EZyDYgBae1eB%B8v<IOn7mC@Vjw_|PdkCQN~G?$ML+Ij_Ij
zzN%n0b2^-#Gsi`AMc|L9Q|tbLayB7K_NalPU&o^JVsXv(8Pu|pFKN2#3Szn~Kc0zF
zn;Rh>3a<83u*Fx#wtpRKR%5I_9#2TJsPT{@^x80}w0O2l<>N16DfM;hpBK|769N)Z
z$H*#eBb)gQj|UL5rqkN@A~bHsx&@AfrTcO88+OHzgqVW6jZjOD4up<7GUB9h^)OoE
z^^Yj;c5^ZvMV1YL@ouC(u){wXGLrZ9mI8!str{r#`b(6ZMuE@pd4J}?ZVM$iCv9HW
z=Tt7kqaEU)_SnMqS#RGb(Fp&4QSDCJ(CH50FAZ=GS(AdbV%J<E&6<7je3D$-u%$g0
zw8@<7YD3>ejS#!1*VgQ~kz3D7>X&aG6C+_eVMdFlHuT{);fEw!yS!1lb;pn$&6yyb
zY8d03Jlj!?kSB~9`yN_Zu!d##L=A3^SF_y7bj}Lya0)BSEM1=}eGW`Z)C}idY_v<n
z+bofLYQqBpuH@tVCB9uW^o%aZ?oQW^^;nbp7N<hmB~&5Pe?0NuhYBj(>^dX9DeQGB
zaV2<N@Qn=YeP!O$&=N82k&Ry$O+K<+ws$C53Sud>jk-S@`j$XhbTiixx?KGeU!C~w
z#$+YJsJQ+3T89!gNW_i~=aA6K?db5gk*iCbjxOnRt){o^cVC*r4Ts2=t0EEHWi_g_
zJva&%m~tfWx>kV=!=N+Urna?QOKc?3p{mZ}h|x2_h|Y(-5y=c_+%MQfXyVFzlQ@)Q
jC+!vf*@9;V(-z_#x?8b_3wMw3K7Rn(!p^+*tPklw3@XZv
rename from browser/themes/gnomestripe/downloads/download-notification.png
rename to browser/themes/gnomestripe/downloads/download-notification-start.png
--- a/browser/themes/gnomestripe/downloads/downloads.css
+++ b/browser/themes/gnomestripe/downloads/downloads.css
@@ -225,44 +225,57 @@ toolbar[iconsize="large"] > #downloads-i
                               0, 16, 16, 0) center no-repeat;
   background-size: 12px;
 }
 
 #downloads-indicator:not([counter])[attention] > #downloads-indicator-anchor > #downloads-indicator-progress-area > #downloads-indicator-counter {
   background-image: url("chrome://browser/skin/downloads/download-glow.png");
 }
 
-/*** Event notification ***/
+/*** Download notifications ***/
 
 #downloads-indicator-notification {
   opacity: 0;
-  background: url("chrome://browser/skin/downloads/download-notification.png")
-              center no-repeat;
   background-size: 16px;
+  background-position: center;
+  background-repeat: no-repeat;
 }
 
-@keyframes downloadsIndicatorNotificationRight {
+@keyframes downloadsIndicatorNotificationStartRight {
   from { opacity: 0; transform: translate(-128px, 128px) scale(8); }
   20%  { opacity: .85; animation-timing-function: ease-out; }
   to   { opacity: 0; transform: translate(0) scale(1); }
 }
 
-@keyframes downloadsIndicatorNotificationLeft {
+@keyframes downloadsIndicatorNotificationStartLeft {
   from { opacity: 0; transform: translate(128px, 128px) scale(8); }
   20%  { opacity: .85; animation-timing-function: ease-out; }
   to   { opacity: 0; transform: translate(0) scale(1); }
 }
 
-#downloads-indicator[notification] > #downloads-indicator-anchor > #downloads-indicator-notification {
-  animation-name: downloadsIndicatorNotificationRight;
+#downloads-indicator[notification="start"] > #downloads-indicator-anchor > #downloads-indicator-notification {
+  background-image: url("chrome://browser/skin/downloads/download-notification-start.png");
+  animation-name: downloadsIndicatorNotificationStartRight;
   animation-duration: 1s;
 }
 
-#downloads-indicator[notification]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
-  animation-name: downloadsIndicatorNotificationLeft;
+#downloads-indicator[notification="start"]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
+  animation-name: downloadsIndicatorNotificationStartLeft;
+}
+
+@keyframes downloadsIndicatorNotificationFinish {
+  from { opacity: 0; transform: scale(1); }
+  20%  { opacity: .65; animation-timing-function: ease-in; }
+  to   { opacity: 0; transform: scale(8); }
+}
+
+#downloads-indicator[notification="finish"] > #downloads-indicator-anchor > #downloads-indicator-notification {
+  background-image: url("chrome://browser/skin/downloads/download-notification-finish.png");
+  animation-name: downloadsIndicatorNotificationFinish;
+  animation-duration: 1s;
 }
 
 /*** Progress bar and text ***/
 
 #downloads-indicator-counter {
   height: 10px;
   margin: 0;
   color: hsl(0,0%,30%);
--- a/browser/themes/gnomestripe/jar.mn
+++ b/browser/themes/gnomestripe/jar.mn
@@ -44,17 +44,18 @@ browser.jar:
   skin/classic/browser/Toolbar.png
   skin/classic/browser/Toolbar-small.png
   skin/classic/browser/urlbar-arrow.png
   skin/classic/browser/webRTC-shareDevice-16.png
   skin/classic/browser/webRTC-shareDevice-64.png
   skin/classic/browser/downloads/buttons.png          (downloads/buttons.png)
   skin/classic/browser/downloads/download-glow.png    (downloads/download-glow.png)
   skin/classic/browser/downloads/download-glow-small.png (downloads/download-glow-small.png)
-  skin/classic/browser/downloads/download-notification.png (downloads/download-notification.png)
+  skin/classic/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png)
+  skin/classic/browser/downloads/download-notification-start.png (downloads/download-notification-start.png)
   skin/classic/browser/downloads/download-summary.png (downloads/download-summary.png)
   skin/classic/browser/downloads/downloads.css        (downloads/downloads.css)
   skin/classic/browser/downloads/allDownloadsViewOverlay.css   (downloads/allDownloadsViewOverlay.css)
   skin/classic/browser/downloads/contentAreaDownloadsView.css  (downloads/contentAreaDownloadsView.css)
   skin/classic/browser/feeds/feedIcon.png             (feeds/feedIcon.png)
   skin/classic/browser/feeds/feedIcon16.png           (feeds/feedIcon16.png)
   skin/classic/browser/feeds/videoFeedIcon.png        (feeds/feedIcon.png)
   skin/classic/browser/feeds/videoFeedIcon16.png      (feeds/feedIcon16.png)
index 0c8eafda08acf20c21eeef8ae63cc6630590084b..8bc5b3acaed5f864dd06c36ae9350dd15524df9a
GIT binary patch
literal 224
zc%17D@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`%ROBjLn>~qy==&JC_sSaLMDr}
zw6}Ku3r-b90S*?X#t)qLj$9IsxEWp9;c_hUh7yaD-A}RgGg4>dIT~^P+UNgqf8*?$
zR_=ZG8gHKtZ4hXZY}ICaFZcAJ`GVJ0hdt6OeT^<`TbsD#ybiPPWr;kNE2X(R1Oq~+
zCNBA|!<-r^<z{uVcv9mcjWY@{h85ox%J(x?&YP{UxZvOm*&TCZSWaxx@qA^zjQ<Zq
Y&ZE>XZOY%IfKF!cboFyt=akR{086x1>Hq)$
index a1a51b8d8f580a7c97b449aed9ae60207a6a5373..d125789fbce71eff4c4d5af890dd5ed6a862c50e
GIT binary patch
literal 1097
zc$@)A1h)H$P)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF000CKNkl<Zc-rln
zO-NKx7>2J<M35Cx;G$Iv>1WX@+|)K&xHF<fD~V{Kjzl>A>p1?8qvQBHo1st`+_Vs4
zCZR<Vf(#^5x-<g8n83)A%;|P}-<W|*I-WB_I>*~tJZR&5_rBkA&pr3tLxyEp|20~G
z7N7-a0a}0-pap0FT0pL}wzlRIEnvR{@Zcrw?d`GN-rjG0eSMbS?>|s@PMrIz*Xw<b
zEY}WF01tc*0g@vlBi8u%xD^V8@&eDz49tQ|cXJfL@0|p<K&enbOH0cYnBN{99c2I|
zU>0QBLbhUH*bp_(@053UcW?Cf_gftu9hOi)S65eLXlRHhRtjWd1Cx>h__qS!VdJTb
z$&n-$fG>UGup1j2QwnDC`Fx4y=4QjjZq4)aqZsbtfq?-w&w9dou>cG;Q?cgl4VVG}
z{H(C8t?fl15U@8dFQBKVhlNVQY)wr~h7Egm{<{cIt~Y3&BW6cEF0RxFP*wo4WfH*O
zFJb=rFgQ54SH08-pgkpFw#LRr!v-_+=XEr{j^;)6VgYz$Si{4^N`h=V1b{MpzJ=yx
z>K!M*g{x`?gF)GPsdWIKxk|!p4Gj$jC_wXm-qX19+0=^#bar-HFsdZHhwJO>k72@_
zN;RKVJ$gIb0<fy%Fn)#Sxv2Tv1z@?!gDVN1?`d+WmwOk$LV_o7B<M{}0M^h>L<^7-
zfE^f4HjV_ni3Q+Iid#~S1igs`csw3%95@p6CKSN^Grl)F67;48$ZU%8z1fkVH=zJ-
zDRIs1NYI;50C!fn-c}L5&2c@?pE=c|x5F)f&+%|L9LK#(3Hu^|n+!a-ilm2d>BPju
zOWe<Vxyh;?y$J<yvw_1*Ntms=x|%s}Oixcg!xjCBQISo(lmMDllC*%7gsZc&vriyl
z3oAUCdglnRNw~1MxERFkuz^+HzY%~fC%!c)3A4FeF2e>h7p<(UcrgkR5W$IZuX?e7
zy1F_ZL`j&fs;bJck<NW8kw`qoME9OEJ!E967YnGZtyNY4vSkuLj&E*m-p6b2JIwZ!
zkh1`j#R|d(%*x72!^YqFkC>);Clm_JVYqYcZ?C67sfEzzRH0HJ6W0Oj0s*7|+>Asb
zQAqfOy6gmC>u8Qc2(zkEFcY%9uBfOmY%p^sN}|!|6q-&#+@E8(-EOgfcs%|9McbHB
zm1&+?km<+5!a{i#0?6h0`S}p)Ki1UL@DVB$K+eQsu}KspX&v?$ATRLT$iOR?oSB(<
zifpH|6hO{{hihwVzSY%Lzl;EKacOBOh;5{|SUh~e<nuir@Z8L>yu2JhreZdnQGl2e
zpiou-IR|coN5GvYc<wTAmd);h{=dRnfEJ(yXaQP)7N7-a0a}0-kQ=`NqXz$3vl*3;
P00000NkvXXu0mjfSQP=H
--- a/browser/themes/pinstripe/browser.css
+++ b/browser/themes/pinstripe/browser.css
@@ -72,17 +72,17 @@ toolbar[mode="full"] toolbarseparator {
 #nav-bar[tabsontop=true],
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + toolbar,
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + #customToolbars + #PersonalToolbar {
   -moz-appearance: none;
   margin-top: 0; /* don't overlay the bottom border of the tabs toolbar */
   padding-top: 4px !important;
   border-bottom: 1px solid rgba(0, 0, 0, 0.57);
   background-color: -moz-mac-chrome-active;
-  background-image: -moz-linear-gradient(rgba(255,255,255,.43), rgba(255,255,255,0)) !important; /* override lwtheme style */
+  background-image: linear-gradient(rgba(255,255,255,.43), rgba(255,255,255,0)) !important; /* override lwtheme style */
   background-origin: border-box !important;
 }
 
 #PersonalToolbar:-moz-lwtheme,
 #nav-bar[tabsontop=true]:-moz-lwtheme,
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + toolbar:-moz-lwtheme,
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + #customToolbars + #PersonalToolbar:-moz-lwtheme {
   background-color: transparent;
@@ -366,26 +366,26 @@ toolbarbutton.bookmark-item > menupopup 
 .toolbarbutton-1:not([type="menu-button"]):-moz-lwtheme,
 .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-lwtheme,
 .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-lwtheme,
 #restore-button:-moz-lwtheme {
   -moz-appearance: none;
   padding: 0 3px;
   border: 1px solid rgba(0, 0, 0, 0.4);
   border-radius: @toolbarbuttonCornerRadius@;
-  background: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)) repeat-x;
+  background: linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)) repeat-x;
   background-origin: border-box;
   box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 1px rgba(255,255,255,0.2);
 }
 
 .toolbarbutton-1:not([type="menu-button"]):-moz-lwtheme-darktext,
 .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-lwtheme-darktext,
 .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-lwtheme-darktext,
 #restore-button:-moz-lwtheme-darktext {
-  background-image: -moz-linear-gradient(rgba(255,255,255,0.3), rgba(50,50,50,0.2) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.13));
+  background-image: linear-gradient(rgba(255,255,255,0.3), rgba(50,50,50,0.2) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.13));
 }
 
 .toolbarbutton-1[type="menu-button"] {
   padding: 0;
 }
 
 .toolbarbutton-1 > .toolbarbutton-menubutton-button,
 .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
@@ -645,17 +645,17 @@ toolbar[mode="icons"] #forward-button {
 
 #navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button {
   clip-path: url(chrome://browser/content/browser.xul#pinstripe-keyhole-forward-clip-path);
 }
 
 @conditionalForwardWithUrlbar@ > #forward-button:not(:-moz-lwtheme) {
   -moz-appearance: none;
   -moz-padding-start: 2px;
-  background: -moz-linear-gradient(hsl(0,0%,99%), hsl(0,0%,67%)) padding-box;
+  background: linear-gradient(hsl(0,0%,99%), hsl(0,0%,67%)) padding-box;
   border: 1px solid;
   border-color: hsl(0,0%,31%) hsla(0,0%,29%,.6) hsl(0,0%,27%);
   box-shadow: inset 0 1px 0 hsla(0,0%,100%,.35),
               0 1px 0 hsla(0,0%,100%,.2);
 }
 
 @conditionalForwardWithUrlbar@ > #forward-button {
   border-radius: 0;
@@ -667,44 +667,44 @@ toolbar[mode="icons"] #forward-button {
   -moz-padding-end: 0;
 }
 
 @conditionalForwardWithUrlbar@:not([switchingtabs]) > #forward-button {
   transition: opacity @forwardTransitionLength@ ease-out;
 }
 
 @conditionalForwardWithUrlbar@ > #forward-button:hover:active:not(:-moz-lwtheme) {
-  background-image: -moz-linear-gradient(hsl(0,0%,74%), hsl(0,0%,61%));
+  background-image: linear-gradient(hsl(0,0%,74%), hsl(0,0%,61%));
   box-shadow: inset rgba(0,0,0,.3) 0 -6px 10px,
               inset #000 0 1px 3px,
               inset rgba(0,0,0,.2) 0 1px 3px,
               0 1px 0 hsla(0,0%,100%,.2);
 }
 
 @conditionalForwardWithUrlbar@ > #forward-button:-moz-window-inactive:not(:-moz-lwtheme) {
   border-color: hsl(0,0%,64%) hsl(0,0%,65%) hsl(0,0%,66%);
-  background-image: -moz-linear-gradient(hsl(0,0%,99%), hsl(0,0%,82%));
+  background-image: linear-gradient(hsl(0,0%,99%), hsl(0,0%,82%));
   box-shadow: inset 0 1px 0 hsla(0,0%,100%,.35);
 }
 
 @conditionalForwardWithUrlbar@:not(:hover) > #forward-button[disabled] {
   opacity: 0;
 }
 
 @media (-moz-mac-lion-theme) {
   @conditionalForwardWithUrlbar@ > #forward-button:not(:-moz-lwtheme) {
-    background-image: -moz-linear-gradient(hsla(0,0%,100%,.73), hsla(0,0%,100%,.05) 85%);
+    background-image: linear-gradient(hsla(0,0%,100%,.73), hsla(0,0%,100%,.05) 85%);
     border-color: hsla(0,0%,0%,.35) hsla(0,0%,0%,.25) hsla(0,0%,0%,.2);
     box-shadow: inset 0 1px 0 hsla(0,0%,100%,.2),
                 inset 0 0 1px hsla(0,0%,100%,.1),
                 0 1px 0 hsla(0,0%,100%,.2);
   }
 
   @conditionalForwardWithUrlbar@ > #forward-button:hover:active:not(:-moz-lwtheme) {
-    background-image: -moz-linear-gradient(hsla(0,0%,60%,.37), hsla(0,0%,100%,.35) 95%);
+    background-image: linear-gradient(hsla(0,0%,60%,.37), hsla(0,0%,100%,.35) 95%);
     border-color: hsla(0,0%,0%,.43) hsla(0,0%,0%,.25) hsla(0,0%,0%,.37);
     box-shadow: inset 0 1px 0 hsla(0,0%,0%,.02),
                 inset 0 1px 2px hsla(0,0%,0%,.2),
                 0 1px 0 hsla(0,0%,100%,.2);
   }
 
   @conditionalForwardWithUrlbar@ > #forward-button:-moz-window-inactive:not(:-moz-lwtheme) {
     background-image: none;
@@ -1121,17 +1121,17 @@ toolbar[mode="icons"] #zoom-in-button {
   border: 1px solid;
   border-color: #626262 #787878 #8c8c8c;
   background-clip: padding-box;
 }
 
 @media (-moz-mac-lion-theme) {
   #urlbar,
   .searchbar-textbox {
-    background-image: -moz-linear-gradient(hsl(0,0%,97%), hsl(0,0%,100%));
+    background-image: linear-gradient(hsl(0,0%,97%), hsl(0,0%,100%));
     border-color: hsla(0,0%,0%,.35) hsla(0,0%,0%,.25) hsla(0,0%,0%,.15);
     box-shadow: 0 1px 0 hsla(0,0%,100%,.2),
                 inset 0 0 1px hsla(0,0%,0%,.05),
                 inset 0 1px 2px hsla(0,0%,0%,.1);
   }
 }
 
 @media not all and (-moz-mac-lion-theme) {
@@ -1252,20 +1252,20 @@ toolbar[mode="icons"] #zoom-in-button {
 
 @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) + #urlbar-container > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(rtl) {
   padding-right: 10.01px;
 }
 
 #urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity {
   color: hsl(92,100%,30%);
   -moz-padding-end: 4px;
-  background-image: -moz-linear-gradient(hsla(92,81%,16%,0),
-                                         hsla(92,81%,16%,.2) 25%,
-                                         hsla(92,81%,16%,.2) 75%,
-                                         hsla(92,81%,16%,0));
+  background-image: linear-gradient(hsla(92,81%,16%,0),
+                                    hsla(92,81%,16%,.2) 25%,
+                                    hsla(92,81%,16%,.2) 75%,
+                                    hsla(92,81%,16%,0));
   background-position: right;
   background-size: 1px;
   background-repeat: no-repeat;
 }
 
 #identity-box.verifiedIdentity:-moz-locale-dir(rtl) {
   background-position: left;
 }
@@ -1291,17 +1291,17 @@ toolbar[mode="icons"] #zoom-in-button {
   padding: 0 3px;
   list-style-image: url("chrome://browser/skin/urlbar-history-dropmarker.png");
   -moz-image-region: rect(0px, 11px, 14px, 0px);
 }
 
 .urlbar-history-dropmarker[open="true"],
 .urlbar-history-dropmarker:hover:active {
   -moz-image-region: rect(0px, 22px, 14px, 11px);
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
 }
 
 @media (min-resolution: 2dppx) {
   .urlbar-history-dropmarker {
     list-style-image: url("chrome://browser/skin/urlbar-history-dropmarker@2x.png");
     -moz-image-region: rect(0px, 22px, 28px, 0px);
   }
 
@@ -1320,17 +1320,17 @@ toolbar[mode="icons"] #zoom-in-button {
 }
 
 .urlbar-icon {
   padding: 0 3px;
 }
 
 .urlbar-icon[open="true"],
 .urlbar-icon:hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
 }
 
 #urlbar-search-splitter {
   min-width: 8px;
   width: 8px;
   background-image: none;
   margin: 0 -4px;
   position: relative;
@@ -1526,17 +1526,17 @@ window[tabsontop="false"] richlistitem[t
   margin: 0;
   -moz-padding-start: 2px;
   -moz-padding-end: 1px;
   background-origin: border-box;
   list-style-image: url("chrome://browser/skin/reload-stop-go.png");
 }
 
 #urlbar > toolbarbutton:not([disabled]):hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
 }
 
 #go-button {
   padding: 0 3px;
 }
 
 #go-button,
 #urlbar-go-button {
@@ -2266,37 +2266,37 @@ toolbarbutton.chevron > .toolbarbutton-m
 .tab-background-start[selected="true"]:not(:-moz-lwtheme):-moz-window-inactive,
 .tab-background-middle[selected="true"]:not(:-moz-lwtheme):-moz-window-inactive,
 .tab-background-end[selected="true"]:not(:-moz-lwtheme):-moz-window-inactive {
   background-color: -moz-mac-chrome-inactive;
 }
 
 .tab-background-start[pinned][titlechanged]:not([selected="true"]),
 .tab-background-end[pinned][titlechanged]:not([selected="true"]) {
-  background-image: -moz-linear-gradient(rgba(148,205,253,.2), rgba(148,205,253,.2)) !important;
+  background-image: linear-gradient(rgba(148,205,253,.2), rgba(148,205,253,.2)) !important;
 }
 
 @TABSONBOTTOM_TAB_STACK@ > .tab-background > .tab-background-middle[pinned][titlechanged]:not([selected="true"]) {
-  background-image: -moz-radial-gradient(center 99%, circle cover, rgba(254,254,255,1) 3%, rgba(210,235,255,.9) 12%, rgba(148,205,253,.6) 30%, rgba(148,205,253,.2) 70%);
+  background-image: radial-gradient(circle farthest-corner at 50% 99%, rgba(254,254,255,1) 3%, rgba(210,235,255,.9) 12%, rgba(148,205,253,.6) 30%, rgba(148,205,253,.2) 70%);
 }
 
 @TABSONTOP_TAB_STACK@ > .tab-background > .tab-background-middle[pinned][titlechanged]:not([selected="true"]) {
-  background-image: -moz-radial-gradient(center 2px, circle cover, rgba(254,254,255,1) 3%, rgba(210,235,255,.9) 12%, rgba(148,205,253,.6) 30%, rgba(148,205,253,.2) 70%);
+  background-image: radial-gradient(circle farthest-corner at 50% 2px, rgba(254,254,255,1) 3%, rgba(210,235,255,.9) 12%, rgba(148,205,253,.6) 30%, rgba(148,205,253,.2) 70%);
 }
 
 .tabbrowser-tab > .tab-stack > .tab-background > .tab-background-start:-moz-lwtheme-brighttext:not([selected="true"]),
 .tabbrowser-tab > .tab-stack > .tab-background > .tab-background-middle:-moz-lwtheme-brighttext:not([selected="true"]),
 .tabbrowser-tab > .tab-stack > .tab-background > .tab-background-end:-moz-lwtheme-brighttext:not([selected="true"]) {
-  background-image: -moz-linear-gradient(hsla(0,0%,40%,.6), hsla(0,0%,30%,.6) 50%);
+  background-image: linear-gradient(hsla(0,0%,40%,.6), hsla(0,0%,30%,.6) 50%);
 }
 
 .tabbrowser-tab > .tab-stack > .tab-background > .tab-background-start:-moz-lwtheme-darktext:not([selected="true"]),
 .tabbrowser-tab > .tab-stack > .tab-background > .tab-background-middle:-moz-lwtheme-darktext:not([selected="true"]),
 .tabbrowser-tab > .tab-stack > .tab-background > .tab-background-end:-moz-lwtheme-darktext:not([selected="true"]) {
-  background-image: -moz-linear-gradient(hsla(0,0%,60%,.5), hsla(0,0%,45%,.5) 50%);
+  background-image: linear-gradient(hsla(0,0%,60%,.5), hsla(0,0%,45%,.5) 50%);
 }
 
 @TABSONTOP_TAB_STACK@ > .tab-content,
 @TABSONTOP_NEWTAB_BUTTON@ > .toolbarbutton-icon {
   -moz-border-image: url(chrome://browser/skin/tabbrowser/tab-top-normal-active.png) 0 11 fill repeat stretch;
 }
 
 @TABSONTOP_TAB@:hover > .tab-stack > .tab-content:not([selected="true"]),
@@ -2418,22 +2418,22 @@ toolbarbutton.chevron > .toolbarbutton-m
 
 /* For tabs-on-top, only fill the bottom 2px with the chrome background
  * color, so that the borders in tabbar-top-bg-*.png can mix with it.
  * In the top 24px the unified toolbar (from the ::before above) will show.
  */
 #TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme) {
   padding-bottom: 2px;
   background: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-active.png),
-              -moz-linear-gradient(bottom, -moz-mac-chrome-active 2px, transparent 2px);
+              linear-gradient(to top, -moz-mac-chrome-active 2px, transparent 2px);
 }
 
 #TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme):-moz-window-inactive {
   background: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-inactive.png),
-              -moz-linear-gradient(bottom, -moz-mac-chrome-inactive 2px, transparent 2px);
+              linear-gradient(to top, -moz-mac-chrome-inactive 2px, transparent 2px);
 }
 
 /* In tabs-on-bottom mode, fill the whole toolbar with the chrome
  * background color.
  */
 #TabsToolbar[tabsontop="false"]:not(:-moz-lwtheme) {
   background: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-active.png) -moz-mac-chrome-active;
 }
@@ -2663,26 +2663,26 @@ toolbarbutton.chevron > .toolbarbutton-m
   padding: 0 1px;
 }
 
 .tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):hover,
 .tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):hover,
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1:not([type="menu-button"]):not([disabled]):not([open]):hover,
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover,
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1:not([disabled]):not([buttonover]):hover > .toolbarbutton-menubutton-dropmarker {
-  background-image: -moz-linear-gradient(transparent, rgba(0,0,0,.15)) !important;
+  background-image: linear-gradient(transparent, rgba(0,0,0,.15)) !important;
 }
 
 .tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):hover:active,
 .tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):hover:active,
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1:not([type="menu-button"]):not([disabled]):hover:active,
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1[type="menu"][open],
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover:active,
 :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1[open]:not([disabled]):hover > .toolbarbutton-menubutton-dropmarker {
-  background-image: -moz-linear-gradient(transparent, rgba(0,0,0,.3)) !important;
+  background-image: linear-gradient(transparent, rgba(0,0,0,.3)) !important;
 }
 
 .tabs-newtab-button,
 #TabsToolbar > #new-tab-button,
 #TabsToolbar > toolbarpaletteitem > #new-tab-button {
   list-style-image: url(chrome://browser/skin/tabbrowser/newtab.png);
   -moz-image-region: rect(0, 18px, 20px, 0);
 }
@@ -3342,19 +3342,19 @@ toolbarbutton.chevron > .toolbarbutton-m
 
 #status-bar {
   -moz-appearance: none;
   padding-right: 0;
 }
 
 #addon-bar[customizing] > #status-bar {
   opacity: .5;
-  background-image: -moz-repeating-linear-gradient(-45deg,
-                                                   rgba(255,255,255,.3), rgba(255,255,255,.3) 5px,
-                                                   rgba(0,0,0,.3) 5px, rgba(0,0,0,.3) 10px);
+  background-image: repeating-linear-gradient(135deg,
+                                              rgba(255,255,255,.3), rgba(255,255,255,.3) 5px,
+                                              rgba(0,0,0,.3) 5px, rgba(0,0,0,.3) 10px);
 }
 
 #status-bar > statusbarpanel {
   border-width: 0;
   -moz-appearance: none;
 }
 
 #addonbar-closebutton {
@@ -3392,17 +3392,17 @@ toolbarbutton.chevron > .toolbarbutton-m
   }
 }
 
 /* Status panel */
 
 .statuspanel-label {
   margin: 0;
   padding: 2px 4px;
-  background: -moz-linear-gradient(white, #ddd);
+  background: linear-gradient(#fff, #ddd);
   border: 1px none #ccc;
   border-top-style: solid;
   color: #333;
   text-shadow: none;
 }
 
 .statuspanel-label:-moz-locale-dir(ltr):not([mirror]),
 .statuspanel-label:-moz-locale-dir(rtl)[mirror] {
@@ -3465,17 +3465,17 @@ toolbarbutton.chevron > .toolbarbutton-m
 }
 
 /* Highlighter - Node Infobar */
 
 .highlighter-nodeinfobar {
   color: hsl(200, 100%, 65%);
   border: 1px solid hsla(210, 19%, 63%, .5);
   border-radius: 3px;
-  background: -moz-linear-gradient(hsl(209, 18%, 30%), hsl(210, 24%, 16%)) no-repeat padding-box;
+  background: linear-gradient(hsl(209, 18%, 30%), hsl(210, 24%, 16%)) no-repeat padding-box;
 }
 
 /* Highlighter - Node Infobar - text */
 
 .highlighter-nodeinfobar-text {
   /* 100% - size of the buttons + margins */
   max-width: calc(100% - 2 * (26px + 6px));
   padding-bottom: 1px;
@@ -3550,25 +3550,25 @@ html|*.highlighter-nodeinfobar-pseudo-cl
   background-repeat: no-repeat;
 }
 
 .highlighter-nodeinfobar-arrow-top {
   margin-bottom: -8px;
   margin-top: 8px;
   border-right-color: hsla(210, 19%, 63%, .5);
   border-top-color: hsla(210, 19%, 63%, .5);
-  background-image: -moz-linear-gradient(bottom left, transparent 50%, hsl(209, 18%, 30%) 50%);
+  background-image: linear-gradient(to top right, transparent 50%, hsl(209, 18%, 30%) 50%);
 }
 
 .highlighter-nodeinfobar-arrow-bottom {
   margin-top: -8px;
   margin-bottom: 8px;
   border-left-color: hsla(210, 19%, 63%, .5);
   border-bottom-color: hsla(210, 19%, 63%, .5);
-  background-image: -moz-linear-gradient(top right, transparent 50%, hsl(210, 24%, 16%) 50%);
+  background-image: linear-gradient(to bottom left, transparent 50%, hsl(210, 24%, 16%) 50%);
 }
 
 .highlighter-nodeinfobar-container[position="top"] > .highlighter-nodeinfobar,
 .highlighter-nodeinfobar-container[position="overlap"] > .highlighter-nodeinfobar {
   box-shadow: 0 1px 0 hsla(0, 0%, 100%, .1) inset;
 }
 
 .highlighter-nodeinfobar-container[hide-arrow] > .highlighter-nodeinfobar {
@@ -3792,17 +3792,17 @@ html|*#gcli-output-frame {
 }
 
 /* Error counter */
 
 #developer-toolbar-toolbox-button[error-count]:before {
   color: #FDF3DE;
   min-width: 16px;
   text-shadow: none;
-  background-image: -moz-linear-gradient(top, #B4211B, #8A1915);
+  background-image: linear-gradient(#B4211B, #8A1915);
   border-radius: 1px;
 }
 
 /* === social toolbar button === */
 
 /* button icon for the service */
 #social-toolbar-item {
   -moz-box-orient: horizontal;
--- a/browser/themes/pinstripe/downloads/contentAreaDownloadsView.css
+++ b/browser/themes/pinstripe/downloads/contentAreaDownloadsView.css
@@ -1,6 +1,16 @@
 /* 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/. */
 
 @import url("chrome://global/skin/inContentUI.css");
 
+.downloadButton {
+  box-shadow: none;
+}
+
+.downloadButton:not([disabled="true"]):hover:active,
+.downloadButton:not([disabled]):hover:active {
+  background: transparent;
+  border: none;
+  box-shadow: none;
+}
new file mode 100755
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..139bf0b539e3d978b05396f78269043275223b2f
GIT binary patch
literal 4066
zc$__#dpy(MAIG<u%glYU_=aMQD3XvwENsiIawi!HA^W<8xy{^D3?-Lxja*`+xnCof
zBIHh(2+3u9i_zjY-^=fh&pGFDKCk!t{d~XQ=Z|yZt{J0wxy85v001u*qkDrj6AwQw
z4%XPN<?w+uiTdhU`I_RLef=H0?*Me1@Q!zmWA8b*+_`bb!70$I=guVnfIkwet78^0
zx%S-O%xp{~rhP#81uu`$J5XAlBeqiaQS*<YN`!u8hv(_XKw;?zM6uIx(;X5<CZ_`f
zx37xi430atr8TCFS8_Duw65+<E!3vUL$@MDaSE#qqxen9)rOXhRG(<|r6lwM`3j%<
zzeBrCVuE`&$KZ)=%#jXJFTKwKJKhg6OWLeQoG5N@1RYb^@$na=6k^qGK#OCB(I~P$
zX8xS9^v{~_r8Xe5dkQ5Mwt{Wv=xYKp9Rq=9*ke3jxNv&pD_k*krB!U43TEsGM`bH@
zcc0@qXgd0{rhOKh3oI&D9_v(*6MSa2CKaAeFFmn8t@g<@qS|yv!5}mXF0^f}|5L)p
z^Jx9YZZ+TM*ctp|69)cQqq;oBdHI?935RTnZ?754jXG0BoMZ1*N+<P5Lfp90a;bv>
zqhW7);c9HOw3g-yyuMXfxH23i#5a&)nlLmpWSn|?Kc}##<pzcs`X!^bnxj2c@{fxB
z)T9lLs~{~-+Y>g-((LSfj^>P`p}3Z)^l%4vXig1t`6AWY`)QV~b6)j_;$yc_yt~5$
zFJm2}o3^;|izQQd9pu=nbufpYf;U_?8o)%Zz3n$`UW<tg^Lmrz1y#xRiOc$Rf$}UD
zE?)k~eZi*AIrLbOKPXgb7%~w9C&rl01pl%2dSSeAGQu(~qpzOGv1B@R$7y6vtj?l5
z-Q6+~6ng3n{58KKAhFneb1HOb*&NNv=|*NjVC{4=@-5Z7&nVAQVs0>8Ov*y=P-pUL
zcs}>mz`&8Q%)a^}QN~WY3McRHMX~7E-y@g8tH>b%z<~Q@T8Wix=vO^>s;sRK=#5Q4
z4C(FY;+JD@hn<p2|CT&ZiIlM+<yT+NOf(vf#+Qj*b#D~l5Uml)j>u5*g&jufuTuLm
zQB7N36Cj>H3iDbE=5w1Ix9b)$A$DF`6Fc^tR2p|)wA>CdU<EE}1U(c6_6p}5$tZpo
z3rH0>&J8+!(kR*;4%7t*wjKkL20B~@4bLDkU;);SGCP+p%r-CG#xREq2LwJ8z(MYw
zyV-EKw#iAid3d;3$&2e_SrnFY;Z6WWQjpRhD{bOMS4ZXZrt!tnpjdzuF&#9l56jk3
zrlw6w5u?CXx)~1-#aa5w)T4r}DA1)SXE!A&;z@99Bmjy{nVZyOMJ|d$YQ?eksVp#U
z@L5wLF;>{Eo_LrExPk~U8ZbPg|2L!$dy!}s>d{gPvYi?aaOS?oX5<mcGF187kR?4K
znRG~nAx66viu^-V2QuR~$mNhs{?~?<h#W<;Xu<?rgMrL}4jGpBP7`ni8Sob-MG$xz
z(K`RPt(7*w{`{sAE49rdz|+TDxwy_g{f{Uy@86094|EV%>Uox2pGZ@G(Q_D)3s(-9
zadi}6)jc2{un5H+%|eA&9VV-Crj;$|=S1;6lV`*0aL<B9dr3TWOw6FH%iRv3#i<4N
zGcKqL%guD0e_=I|PL0VW;VGfH62%E%sYGdBgFuRwr<K1)-MMymEAEl!dKo-pAD3E}
z@;(-y-#P11G!B-tAiVq7JT4^5;A`v*dFp2d%am04R`cYRcrvP~GOqpX=TWIj9)j=P
zwXrTsUNwbFPxj}<E8|yK4gSZ~+a)ubprdjkNxjjcO7hN~tHU!;zIVym_a+v%IteAy
zcqsLI)rzCXP@4I-k)XcI8#8|Qt9`oCkxOGPH|}<ojae>8hLPOz|M7QCq{$KapQp53
z!ufF#G(ffU*V>uk*S|miuA08s|Neehkc#MA|785?^)1O?8pi8R#V-k;*tyeEji@e%
zJ^M@ju^uH2QstoE`ygFO!?{Sc%v&}Az+5eQWP4R@LjqdG)2V3|^5srR9E>|H3r%&-
z5J<K%H)Qun6RdJ{?oALqXW(pe4EU^a)~+f1JD$(ydqaksVY3d9$vN&8$Kfc4W5J!M
zIz3uw?lx9_yz%A_HJ*tyQ=b)a?lc`C-l)T%-KXQ_0UJ~Bvw!~K=O)mw8;f^Djy!Wf
zVe;bAVh;sYt0B;l@xjtAeL~^bdjnXb^rwwIlR7;W`iGOFlFsjX)5MjXQr}J1ne`pt
z4AK^F)T<8j+pnZFIr1(2GHHW$`X*a>{Rdovt}jPa5hd)#24Um-Z-S=2UB0K<A)&Hs
z(wC%fD<53(UoEUYO=v&QFx@8jXhzZC+in`aX%>|0Xrs`I-UGH|tLx0d1%WCc^BzlG
zY};}>&R@Y&hz`vKDqnp>j}NNJ3=F7pF^ukk3o$k&Qy&MVMaj@=GQC`(%8nMjhLuC<
zzv5^ikj7p3&g@mq?CcPy2rZ=atc$nmt~W5*JD#5w5%q1?Iz~+kFgqnhhc>|IWl<*s
zyw(S)dqr1vwR-%!cS3kHW@NCUT{5EdeB~|sw3N#5^vB%HJVdLEajs%mz^X>bkK9We
z3sVbhkl<QbY<fonV1JGYUvz$To3WCPmp#IW!V(k3{y>o=D8WBI)a(^yZ}Dt6tU@4-
zbr-OwI(0cd`)TI!e{DIxv7{1wA{D|!A?R<<<^#37gTGVR5A1RiFQ&Pqfgy!Dq`Qby
zPXPNtH9c%iiw%nQM3!8Xg|gfbRZq45F*Qb*55K91!O>9HD>{;ulHlvFC2FU(?BMWQ
z{_L}*hI8<9CNv0S<qAnn<FwX(0eZOkW<OS~CmyOlCuGo}o5eHBFqK%ZmftP^0KZk&
zrg#-(sCj?w$7WprkIs;tOENRZDaB-*9JZI6X2OJOt-qe7RnM*g83|uGTDTxtvSi#u
z&sW0yOalQ!Q)ibU!jc{%ke}eKv)NOjgPRn_^$&2dok=+wTq<0GU2Dcg*>9cMQ(Umu
zt*I^n^CU|MEqkGozjWwI!0^cpUiO|b?^?pz60J%j?H_|{VZMa<A?0`|0#k3i*F(l}
zV<qH>m*<dyy6X*HiDu2ECH(ha!S-hnv@qF``P<#-AbjE2EQ9$O)E_HZHJwtP#EGD{
zLay$gLV9=E4T;n3?eA~F`dSrrLHwzJ#E69H=5FSIviFX7O^5peALO%FUNVX_Q+ra0
z+2pTr<}#Is-XO~$7_};*NCXy5!1wP^AI*0E>H7w?SJzoU=dcnygfFRF48b7p`e1Lu
zsTTBRzL^glx_duK1HlyyUTX;R@k({+;IFv}d)<9TJ^S;YUxdJPI~WDty76EK85;KK
zJTr_;qYgZI>Jp&0+W769R{YHq;qqeFirE+nJeQeWtL53x?YcLNn9F7dJ@Yx%3_Xm%
zusf_tsDA4`Cz%%g;R1#(fxr~LPu~Gt1}b*VHB`+qnV*^5oGs)7C0|pa#?RlUUKK}o
zKOZZ7)PPbTx3cpVn*o__^HAFCx9zXH{JVFoL&EbN+gMq)W|4FHTPVic35G2zJdhF{
zlAEhx0T)e!)lt7+WfX<puRHnNya$qqfZ~4tG2~p>c-6Cc1yd?E(3Q`8)eyvFl=2){
z>`)XwTF@g#Q2cx+Zw=_=3k^qs6}Rnzd`Kovdq-Z@#xL+do(&dpr(<^)gtPVb=#rj4
zt-S6cTZAp;7*QD7d!b0r7fZj&>(Xg|q~D*oYsmhDI5%G~29wSiIP&!6yyo)ARS4_+
ztyF-2k4`7-#2Yr4`Sr4UlfcHVH>0>{mg1Rux8^kPKRUQ#(J1D*n|J5nNT6a~<VGcx
zb({NW6?S_vs$>I2f{<}ScQs(Z%j+gvJhNU+ODmUOY651<bZ5tlbA-l=?-*K<s@YVX
zx<<|xI$MZ_WR;*uC9W@!Yz*@+<z&l_1ox(vri)Q%E#{Uy{lJ<8z|cRp8u_Eg9vW*d
zUAUN1qD_)>Eh+>t64>cOl<m$xpQ0~;S{OnPxnr>!^GBhOWbZ+<Px{AS&8Nv*QDijZ
zW9klnn_USAtXGXtosBO(l0tazFl_A|2~KdWFz2L;&%6`U6#N#}+_cyUmRQ`vplMHU
zl13wH7WKwN(+O`^PRbI)1ml%o*tJ!tLZma{!oil|_TCUTZIT7~c!{US<i>XXM=~4Y
zPwn<HIU=5)p(S|tX`pdL4AsqxBODKb%uH(c^Ub763LeYc&J5|j>y2rQDNON0K<H?D
zgrSq&m%4`oMn4q8@z#)lxRe!g&R5!6VFe+7D3ltnj@>4=N&w!g#05IRgTm+RR}<BF
zqA8<aVT=NV4m6ck=|7Y(p_eUd4-pQ&e0wsmHE~{@hbmVaUt&$Oy#|`%M7U}>Y48R~
zDQLE<?(x4is72og+$aPFPmTXY%+Bb6S%O+TPSQ83vodr@{ws;oUgM(-jfqDwV62%c
z7QjqOH=9l)B*?r9_=qZdCqw^$0m+<fQ;w(^B9j@<Iqyj)ULiHy;b_q}Td~e65@LLn
z4`-caF(Dq$XSMDv3R`NgqrlYwb2)4`JJTof)XES~woD1Q`3dH%s|K$}#+#r-g)c1y
z(!lmabpzmF@k@?-J&!Et?j;T-t%@#?;D&oSFDsP0h%b?A69w^%DBpP>4CkLB5ZZTu
zr0FM_K#OD-8TRI%vGg3UiKExTem`PkIu{xN-XtGS>irPVny7V!iZ1-!R+V%~z6WLs
zn%zSbJz(I9-xQK_@PGCEGWB!lGOYJ<#t@UD6!y-Kh(93&4~#Zq!YSgA4BTKxjjf?(
zg}ItkyOZ*^>I5RKo8y|~#ZCX7&Hxe!U9i8$hs+8Pxj}PBlSt-9oVX)pOG^^AUoWh7
z9m^ayaEg%MJ0MABqg8L0r+6|1P3JqN8#wXGyg;V2o4l$^IE5FoPQi5=jQTE9FS?^}
z9($DPcK)R)91mW3vD4l%0JU%L&mkhcE;8|ugmCEU9;=nEn(vZ<Z$6j`pt!!3=4GF?
zpt)Zm{VIJz9~=6PdtJz`&y}lbaSQ8t(F<R1Km4)EynTDRTGZ>pLDC$$TWM80!E%BB
z=}O|SIqjEUT^4UgS6<!^tP%$k%+7S0nbX`&K|w!zx91MpmTcAWdBiyB8Gw)M_D~#6
z*rT@g`JQ9X$VbMp7W0=>cKg0<%j{)!i*bsZd0rie^CamhA*rE--IMLette@$zLh|E
zy7@v0#Y&190$X+Cep8z9-p^uSt#8uT`u`7M*6`{#Lvk5V*X-H9|Ah5u2VnJ#b<0sW
G(*FP&3#p+1
rename from browser/themes/pinstripe/downloads/download-notification.png
rename to browser/themes/pinstripe/downloads/download-notification-start.png
--- a/browser/themes/pinstripe/downloads/downloads.css
+++ b/browser/themes/pinstripe/downloads/downloads.css
@@ -233,44 +233,57 @@ richlistitem[type="download"][state="1"]
   }
 
   #downloads-indicator:not([counter])[attention] > #downloads-indicator-anchor >
   #downloads-indicator-progress-area > #downloads-indicator-counter {
     background-image: url("chrome://browser/skin/downloads/download-glow@2x.png");
   }
 }
 
-/*** Event notification ***/
+/*** Download notifications ***/
 
 #downloads-indicator-notification {
   opacity: 0;
-  background: url("chrome://browser/skin/downloads/download-notification.png")
-              center no-repeat;
   background-size: 16px;
+  background-position: center;
+  background-repeat: no-repeat;
 }
 
-@keyframes downloadsIndicatorNotificationRight {
+@keyframes downloadsIndicatorNotificationStartRight {
   from { opacity: 0; transform: translate(-128px, 128px) scale(8); }
   20%  { opacity: .85; animation-timing-function: ease-out; }
   to   { opacity: 0; transform: translate(0) scale(1); }
 }
 
-@keyframes downloadsIndicatorNotificationLeft {
+@keyframes downloadsIndicatorNotificationStartLeft {
   from { opacity: 0; transform: translate(128px, 128px) scale(8); }
   20%  { opacity: .85; animation-timing-function: ease-out; }
   to   { opacity: 0; transform: translate(0) scale(1); }
 }
 
-#downloads-indicator[notification] > #downloads-indicator-anchor > #downloads-indicator-notification {
-  animation-name: downloadsIndicatorNotificationRight;
+#downloads-indicator[notification="start"] > #downloads-indicator-anchor > #downloads-indicator-notification {
+  background-image: url("chrome://browser/skin/downloads/download-notification-start.png");
+  animation-name: downloadsIndicatorNotificationStartRight;
   animation-duration: 1s;
 }
 
-#downloads-indicator[notification]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
-  animation-name: downloadsIndicatorNotificationLeft;
+#downloads-indicator[notification="start"]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
+  animation-name: downloadsIndicatorNotificationStartLeft;
+}
+
+@keyframes downloadsIndicatorNotificationFinish {
+  from { opacity: 0; transform: scale(1); }
+  20%  { opacity: .65; animation-timing-function: ease-in; }
+  to   { opacity: 0; transform: scale(8); }
+}
+
+#downloads-indicator[notification="finish"] > #downloads-indicator-anchor > #downloads-indicator-notification {
+  background-image: url("chrome://browser/skin/downloads/download-notification-finish.png");
+  animation-name: downloadsIndicatorNotificationFinish;
+  animation-duration: 1s;
 }
 
 /*** Progress bar and text ***/
 
 #downloads-indicator-counter {
   height: 9px;
   margin: -3px 0 0;
   color: hsl(0,0%,30%);
--- a/browser/themes/pinstripe/jar.mn
+++ b/browser/themes/pinstripe/jar.mn
@@ -68,17 +68,18 @@ browser.jar:
   skin/classic/browser/urlbar-popup-blocked.png
   skin/classic/browser/urlbar-popup-blocked@2x.png
   skin/classic/browser/webRTC-shareDevice-16.png
   skin/classic/browser/webRTC-shareDevice-16@2x.png
   skin/classic/browser/webRTC-shareDevice-64.png
   skin/classic/browser/downloads/buttons.png                (downloads/buttons.png)
   skin/classic/browser/downloads/download-glow.png          (downloads/download-glow.png)
   skin/classic/browser/downloads/download-glow@2x.png       (downloads/download-glow@2x.png)
-  skin/classic/browser/downloads/download-notification.png  (downloads/download-notification.png)
+  skin/classic/browser/downloads/download-notification-finish.png  (downloads/download-notification-finish.png)
+  skin/classic/browser/downloads/download-notification-start.png  (downloads/download-notification-start.png)
   skin/classic/browser/downloads/download-summary.png       (downloads/download-summary.png)
   skin/classic/browser/downloads/downloads.css              (downloads/downloads.css)
   skin/classic/browser/downloads/allDownloadsViewOverlay.css (downloads/allDownloadsViewOverlay.css)
   skin/classic/browser/downloads/contentAreaDownloadsView.css (downloads/contentAreaDownloadsView.css)
   skin/classic/browser/feeds/subscribe.css                  (feeds/subscribe.css)
   skin/classic/browser/feeds/subscribe-ui.css               (feeds/subscribe-ui.css)
   skin/classic/browser/feeds/feedIcon.png                   (feeds/feedIcon.png)
   skin/classic/browser/feeds/feedIcon16.png                 (feeds/feedIcon16.png)
index 0c8eafda08acf20c21eeef8ae63cc6630590084b..8bc5b3acaed5f864dd06c36ae9350dd15524df9a
GIT binary patch
literal 224
zc%17D@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`%ROBjLn>~qy==&JC_sSaLMDr}
zw6}Ku3r-b90S*?X#t)qLj$9IsxEWp9;c_hUh7yaD-A}RgGg4>dIT~^P+UNgqf8*?$
zR_=ZG8gHKtZ4hXZY}ICaFZcAJ`GVJ0hdt6OeT^<`TbsD#ybiPPWr;kNE2X(R1Oq~+
zCNBA|!<-r^<z{uVcv9mcjWY@{h85ox%J(x?&YP{UxZvOm*&TCZSWaxx@qA^zjQ<Zq
Y&ZE>XZOY%IfKF!cboFyt=akR{086x1>Hq)$
index d13fb930a397810c8884b9882bbd5f6cb8ef8fcd..72d53e6d99366fab0c2b65044554b8c74e97e9a8
GIT binary patch
literal 367
zc$@)m0g(QQP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F80003tNkl<Zc-rmO
zJxat-6vc7D&Q_;Za0eEy!Nx_{xDE4RLPA19hI|z+KoD^X3oDo40^ESuh%kyGj>l6x
z;gK7s7%tHwfnPHR?)#Us2H;PP0b{`b3257PLf5n)tY|?uH2Lj8ZtJuy0-C0o5tLl^
zJ<i{E=#C%)>bia-D0ww^?fZN5V0IZ$RTVVxvu_{J+}dS8S(eab-94g@&MpI{(<wBW
zn<w<uv&(>@D4^_Y$tDBxJjZ}!K$c|~kPJxE6a$h0Ns?edG9Zp)3`hn<QG@}>fG`Z9
z>~zT{1A-ucCUf(cK6`c<;QKx_S$7ZVrL)Tb&-0*(pM86u9<5ylxUTz5Q1WC4nEShQ
zZ+02rIL-w@$$2-xys<^MBm>NNMRUT6-f2dgBEZ6ZWBgY<28;nez5z0dDd6-7ujl{(
N002ovPDHLkV1m(6ohASP
index a1a51b8d8f580a7c97b449aed9ae60207a6a5373..d125789fbce71eff4c4d5af890dd5ed6a862c50e
GIT binary patch
literal 1097
zc$@)A1h)H$P)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF000CKNkl<Zc-rln
zO-NKx7>2J<M35Cx;G$Iv>1WX@+|)K&xHF<fD~V{Kjzl>A>p1?8qvQBHo1st`+_Vs4
zCZR<Vf(#^5x-<g8n83)A%;|P}-<W|*I-WB_I>*~tJZR&5_rBkA&pr3tLxyEp|20~G
z7N7-a0a}0-pap0FT0pL}wzlRIEnvR{@Zcrw?d`GN-rjG0eSMbS?>|s@PMrIz*Xw<b
zEY}WF01tc*0g@vlBi8u%xD^V8@&eDz49tQ|cXJfL@0|p<K&enbOH0cYnBN{99c2I|
zU>0QBLbhUH*bp_(@053UcW?Cf_gftu9hOi)S65eLXlRHhRtjWd1Cx>h__qS!VdJTb
z$&n-$fG>UGup1j2QwnDC`Fx4y=4QjjZq4)aqZsbtfq?-w&w9dou>cG;Q?cgl4VVG}
z{H(C8t?fl15U@8dFQBKVhlNVQY)wr~h7Egm{<{cIt~Y3&BW6cEF0RxFP*wo4WfH*O
zFJb=rFgQ54SH08-pgkpFw#LRr!v-_+=XEr{j^;)6VgYz$Si{4^N`h=V1b{MpzJ=yx
z>K!M*g{x`?gF)GPsdWIKxk|!p4Gj$jC_wXm-qX19+0=^#bar-HFsdZHhwJO>k72@_
zN;RKVJ$gIb0<fy%Fn)#Sxv2Tv1z@?!gDVN1?`d+WmwOk$LV_o7B<M{}0M^h>L<^7-
zfE^f4HjV_ni3Q+Iid#~S1igs`csw3%95@p6CKSN^Grl)F67;48$ZU%8z1fkVH=zJ-
zDRIs1NYI;50C!fn-c}L5&2c@?pE=c|x5F)f&+%|L9LK#(3Hu^|n+!a-ilm2d>BPju
zOWe<Vxyh;?y$J<yvw_1*Ntms=x|%s}Oixcg!xjCBQISo(lmMDllC*%7gsZc&vriyl
z3oAUCdglnRNw~1MxERFkuz^+HzY%~fC%!c)3A4FeF2e>h7p<(UcrgkR5W$IZuX?e7
zy1F_ZL`j&fs;bJck<NW8kw`qoME9OEJ!E967YnGZtyNY4vSkuLj&E*m-p6b2JIwZ!
zkh1`j#R|d(%*x72!^YqFkC>);Clm_JVYqYcZ?C67sfEzzRH0HJ6W0Oj0s*7|+>Asb
zQAqfOy6gmC>u8Qc2(zkEFcY%9uBfOmY%p^sN}|!|6q-&#+@E8(-EOgfcs%|9McbHB
zm1&+?km<+5!a{i#0?6h0`S}p)Ki1UL@DVB$K+eQsu}KspX&v?$ATRLT$iOR?oSB(<
zifpH|6hO{{hihwVzSY%Lzl;EKacOBOh;5{|SUh~e<nuir@Z8L>yu2JhreZdnQGl2e
zpiou-IR|coN5GvYc<wTAmd);h{=dRnfEJ(yXaQP)7N7-a0a}0-kQ=`NqXz$3vl*3;
P00000NkvXXu0mjfSQP=H
--- a/browser/themes/winstripe/browser-aero.css
+++ b/browser/themes/winstripe/browser-aero.css
@@ -45,34 +45,34 @@
   #navigator-toolbox > toolbar:not(:-moz-lwtheme),
   #browser-bottombox:not(:-moz-lwtheme) {
     background-color: @customToolbarColor@;
   }
 
   .tabbrowser-tab:not(:-moz-lwtheme),
   .tabs-newtab-button:not(:-moz-lwtheme) {
     background-image: @toolbarShadowOnTab@, @bgTabTexture@,
-                      -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
+                      linear-gradient(@customToolbarColor@, @customToolbarColor@);
   }
 
   .tabbrowser-tab:not(:-moz-lwtheme):hover,
   .tabs-newtab-button:not(:-moz-lwtheme):hover {
     background-image: @toolbarShadowOnTab@, @bgTabTextureHover@,
-                      -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
+                      linear-gradient(@customToolbarColor@, @customToolbarColor@);
   }
 
   .tabbrowser-tab[selected="true"]:not(:-moz-lwtheme) {
-    background-image: -moz-linear-gradient(white, @toolbarHighlight@ 50%),
-                      -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
+    background-image: linear-gradient(#fff, @toolbarHighlight@ 50%),
+                      linear-gradient(@customToolbarColor@, @customToolbarColor@);
   }
 
   #main-window[tabsontop=false]:not([disablechrome]) .tabbrowser-tab[selected=true]:not(:-moz-lwtheme) {
     background-image: @toolbarShadowOnTab@,
-                      -moz-linear-gradient(white, @toolbarHighlight@ 50%),
-                      -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
+                      linear-gradient(#fff, @toolbarHighlight@ 50%),
+                      linear-gradient(@customToolbarColor@, @customToolbarColor@);
   }
 
   #navigator-toolbox:not(:-moz-lwtheme)::after {
     background-color: #aabccf;
   }
 
   #navigator-toolbox[tabsontop=true] #urlbar:not(:-moz-lwtheme),
   #navigator-toolbox[tabsontop=true] .searchbar-textbox:not(:-moz-lwtheme) {
@@ -241,34 +241,34 @@
   }
 
   #navigator-toolbox[tabsontop=false] > #PersonalToolbar {
     margin-top: 3px;
   }
   #navigator-toolbox[tabsontop=false] > #PersonalToolbar:not(:-moz-lwtheme) {
     margin-top: 2px;
     border-top: 1px solid @toolbarShadowColor@;
-    background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
+    background-image: linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
   }
 
   #main-window[sizemode=normal] #TabsToolbar[tabsontop=true] {
     padding-left: 4px;
     padding-right: 4px;
   }
 
   #main-window[sizemode=normal] #TabsToolbar[tabsontop=false] {
     padding-left: 2px;
     padding-right: 2px;
   }
 
   /* Rounded corners for when chrome is disabled */
   #main-window[sizemode=normal][disablechrome] #navigator-toolbox[tabsontop=true]:not(:-moz-lwtheme)::after {
     visibility: visible;
     background-color: @customToolbarColor@;
-    background-image: -moz-linear-gradient(@toolbarHighlight@, @toolbarHighlight@);
+    background-image: linear-gradient(@toolbarHighlight@, @toolbarHighlight@);
     height: 4px;
   }
 
   /* Make the window draggable by glassed toolbars (bug 555081) */
   #toolbar-menubar:not([autohide="true"]),
   #TabsToolbar[tabsontop="true"],
   #nav-bar[tabsontop=false],
   #nav-bar + #customToolbars + #PersonalToolbar[collapsed="true"] + #TabsToolbar[tabsontop="false"]:last-child,
@@ -326,17 +326,17 @@
     border: none;
     font: normal 1.2em "Segoe UI";
     color: black;
     text-shadow: white -1px -1px .35em, white -1px 1px .35em, white 1px 1px .35em, white 1px -1px .35em;
   }
 
   #tab-view:-moz-lwtheme {
     background-image: url("chrome://browser/skin/tabview/grain.png"),
-                      -moz-linear-gradient(rgba(255,255,255,0), #CCD9EA 200px, #C7D5E7);
+                      linear-gradient(rgba(255,255,255,0), #CCD9EA 200px, #C7D5E7);
     background-attachment: fixed;
   }
 }
 
 @media not all and (-moz-windows-compositor) {
   @media (-moz-windows-default-theme) {
     #main-window {
       background-color: rgb(185,209,234);
@@ -439,22 +439,22 @@
   }
   .splitmenu-menu[iconic] > .menu-right {
     margin-top: -1px;
   }
 
   .splitmenu-menuitem[_moz-menuactive],
   .splitmenu-menu[_moz-menuactive] {
     background-color: transparent;
-    background-image: -moz-linear-gradient(#fafbfd, #ebf3fd);
+    background-image: linear-gradient(#fafbfd, #ebf3fd);
     border-color: #aeccf1;
   }
 
   .splitmenu-menuitem[disabled][_moz-menuactive],
   .splitmenu-menu[disabled][_moz-menuactive] {
-    background-image: -moz-linear-gradient(#f8f9f9, #eaeaea);
+    background-image: linear-gradient(#f8f9f9, #eaeaea);
     border-color: #d8d7d7;
   }
 
   .splitmenu-menu[_moz-menuactive]:not(:hover):not([open]) {
     background-image: none;
   }
 }
--- a/browser/themes/winstripe/browser.css
+++ b/browser/themes/winstripe/browser.css
@@ -7,19 +7,19 @@
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 @namespace html url("http://www.w3.org/1999/xhtml");
 
 %include ../browserShared.inc
 %filter substitution
 %define toolbarHighlight rgba(255,255,255,.5)
 %define selectedTabHighlight rgba(255,255,255,.7)
 %define toolbarShadowColor rgba(10%,10%,10%,.4)
-%define toolbarShadowOnTab -moz-linear-gradient(bottom, rgba(10%,10%,10%,.4) 1px, transparent 1px)
-%define bgTabTexture -moz-linear-gradient(transparent, hsla(0,0%,45%,.1) 1px, hsla(0,0%,32%,.2) 80%, hsla(0,0%,0%,.2))
-%define bgTabTextureHover -moz-linear-gradient(hsla(0,0%,100%,.3) 1px, hsla(0,0%,75%,.2) 80%, hsla(0,0%,60%,.2))
+%define toolbarShadowOnTab linear-gradient(to top, rgba(10%,10%,10%,.4) 1px, transparent 1px)
+%define bgTabTexture linear-gradient(transparent, hsla(0,0%,45%,.1) 1px, hsla(0,0%,32%,.2) 80%, hsla(0,0%,0%,.2))
+%define bgTabTextureHover linear-gradient(hsla(0,0%,100%,.3) 1px, hsla(0,0%,75%,.2) 80%, hsla(0,0%,60%,.2))
 %define navbarTextboxCustomBorder border-color: rgba(0,0,0,.32);
 %define navbarLargeIcons #navigator-toolbox[iconsize=large][mode=icons] > #nav-bar
 %define forwardTransitionLength 150ms
 %define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) #navigator-toolbox[iconsize=large][mode=icons] > :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"],#nav-bar:not([currentset])) > #unified-back-forward-button
 %define conditionalForwardWithUrlbarWidth 27
 
 %ifdef MOZ_OFFICIAL_BRANDING
 %define appMenuButtonBorderColor rgba(255,255,255,.5) rgba(83,42,6,.9)
@@ -62,23 +62,23 @@
   border-style: none;
   background-color: -moz-Dialog;
 }
 
 %ifdef WINSTRIPE_AERO
 @media not all and (-moz-windows-compositor) {
 %endif
   #main-window[tabsintitlebar]:not([inFullscreen]) #toolbar-menubar[inactive] ~ #TabsToolbar:not(:-moz-lwtheme) {
-    background: -moz-linear-gradient(bottom, @toolbarShadowColor@ 1px, transparent 1px),
-                -moz-linear-gradient(rgba(50%,50%,50%,0), ActiveCaption 85%);
+    background: linear-gradient(to top, @toolbarShadowColor@ 1px, transparent 1px),
+                linear-gradient(rgba(50%,50%,50%,0), ActiveCaption 85%);
     color: CaptionText;
   }
   #main-window[tabsintitlebar]:not([inFullscreen]) #toolbar-menubar[inactive] ~ #TabsToolbar:not(:-moz-lwtheme):-moz-window-inactive {
-    background: -moz-linear-gradient(bottom, @toolbarShadowColor@ 1px, transparent 1px),
-                -moz-linear-gradient(rgba(50%,50%,50%,0), InactiveCaption 85%);
+    background: linear-gradient(to top, @toolbarShadowColor@ 1px, transparent 1px),
+                linear-gradient(rgba(50%,50%,50%,0), InactiveCaption 85%);
     color: InactiveCaptionText;
   }
 
   #main-window[tabsintitlebar] #titlebar:-moz-lwtheme {
     visibility: hidden;
   }
   #main-window[tabsintitlebar] #titlebar-content:-moz-lwtheme {
     -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
@@ -86,17 +86,17 @@
   }
 %ifdef WINSTRIPE_AERO
 }
 %endif
 
 #nav-bar[tabsontop=true],
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + toolbar,
 #nav-bar[tabsontop=true][collapsed=true]:not([customizing]) + #customToolbars + #PersonalToolbar {
-  background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
+  background-image: linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
 }
 
 #personal-bookmarks {
   min-height: 24px;
 }
 
 #print-preview-toolbar:not(:-moz-lwtheme) {
   -moz-appearance: toolbox;
@@ -138,102 +138,102 @@
 
 #appmenu-button:hover:active,
 #appmenu-button[open] {
   border-radius: 0;
 }
 
 %ifdef MOZ_OFFICIAL_BRANDING
 #appmenu-button {
-  background-image: -moz-linear-gradient(rgb(247,182,82), rgb(215,98,10) 95%);
+  background-image: linear-gradient(rgb(247,182,82), rgb(215,98,10) 95%);
   border-color: rgba(83,42,6,.9);
   box-shadow: 0 1px 0 rgba(255,255,255,.25) inset,
               0 0 0 1px rgba(255,255,255,.25) inset;
 }
 #appmenu-button:hover:not(:active):not([open]) {
-  background-image: -moz-radial-gradient(center bottom, farthest-side, rgba(252,240,89,.5) 10%, rgba(252,240,89,0) 70%),
-                    -moz-radial-gradient(center bottom, farthest-side, rgb(236,133,0), rgba(255,229,172,0)),
-                    -moz-linear-gradient(rgb(246,170,69), rgb(209,74,0) 95%);
+  background-image: radial-gradient(farthest-side at bottom, rgba(252,240,89,.5) 10%, rgba(252,240,89,0) 70%),
+                    radial-gradient(farthest-side at bottom, rgb(236,133,0), rgba(255,229,172,0)),
+                    linear-gradient(rgb(246,170,69), rgb(209,74,0) 95%);
   border-color: rgba(83,42,6,.9);
   box-shadow: 0 1px 0 rgba(255,255,255,.1) inset,
               0 0 2px 1px rgba(250,234,169,.7) inset,
               0 -1px 0 rgba(250,234,169,.5) inset;
 }
 #appmenu-button:hover:active,
 #appmenu-button[open] {
-  background-image: -moz-linear-gradient(rgb(246,170,69), rgb(209,74,0) 95%);
+  background-image: linear-gradient(rgb(246,170,69), rgb(209,74,0) 95%);
   box-shadow: 0 2px 3px rgba(0,0,0,.4) inset,
               0 1px 1px rgba(0,0,0,.2) inset;
 }
 %else
 %if MOZ_UPDATE_CHANNEL == aurora
 #appmenu-button {
-  background-image: -moz-linear-gradient(hsl(208,99%,37%), hsl(214,90%,23%) 95%);
+  background-image: linear-gradient(hsl(208,99%,37%), hsl(214,90%,23%) 95%);
   border-color: hsla(214,89%,21%,.9);
   box-shadow: 0 1px 0 hsla(205,100%,72%,.2) inset,
               0 0 2px 1px hsla(205,100%,72%,.25) inset;
 }
 #appmenu-button:hover:not(:active):not([open]) {
-  background-image: -moz-radial-gradient(center bottom, farthest-side, hsla(202,100%,85%,.5) 10%, hsla(202,100%,85%,0) 70%),
-                    -moz-radial-gradient(center bottom, farthest-side, hsla(205,100%,72%,.7), hsla(205,100%,72%,0)),
-                    -moz-linear-gradient(hsl(208,98%,34%), hsl(213,87%,20%) 95%);
+  background-image: radial-gradient(farthest-side at bottom, hsla(202,100%,85%,.5) 10%, hsla(202,100%,85%,0) 70%),
+                    radial-gradient(farthest-side at bottom, hsla(205,100%,72%,.7), hsla(205,100%,72%,0)),
+                    linear-gradient(hsl(208,98%,34%), hsl(213,87%,20%) 95%);
   border-color: hsla(214,89%,21%,.9);
   box-shadow: 0 1px 0 hsla(205,100%,72%,.15) inset,
               0 0 2px 1px hsla(205,100%,72%,.5) inset,
               0 -1px 0 hsla(205,100%,72%,.2) inset;
 }
 #appmenu-button:hover:active,
 #appmenu-button[open] {
-  background-image: -moz-linear-gradient(hsl(208,95%,30%), hsl(214,85%,17%) 95%);
+  background-image: linear-gradient(hsl(208,95%,30%), hsl(214,85%,17%) 95%);
   box-shadow: 0 2px 3px rgba(0,0,0,.4) inset,
               0 1px 1px rgba(0,0,0,.2) inset;
 }
 %else
 #appmenu-button {
-  background-image: -moz-linear-gradient(hsl(211,33%,32%), hsl(209,53%,10%) 95%);
+  background-image: linear-gradient(hsl(211,33%,32%), hsl(209,53%,10%) 95%);
   border-color: hsla(210,59%,13%,.9);
   box-shadow: 0 1px 0 hsla(210,48%,90%,.15) inset,
               0 0 2px 1px hsla(211,65%,85%,.15) inset;
 }
 #appmenu-button:hover:not(:active):not([open]) {
-  background-image: -moz-radial-gradient(center bottom, farthest-side, hsla(210,48%,90%,.5) 10%, hsla(210,48%,90%,0) 70%),
-                    -moz-radial-gradient(center bottom, farthest-side, hsla(211,70%,83%,.5), hsla(211,70%,83%,0)),
-                    -moz-linear-gradient(hsl(211,33%,32%), hsl(209,53%,10%) 95%);
+  background-image: radial-gradient(farthest-side at bottom, hsla(210,48%,90%,.5) 10%, hsla(210,48%,90%,0) 70%),
+                    radial-gradient(farthest-side at bottom, hsla(211,70%,83%,.5), hsla(211,70%,83%,0)),
+                    linear-gradient(hsl(211,33%,32%), hsl(209,53%,10%) 95%);
   border-color: hsla(210,59%,13%,.9);
   box-shadow: 0 1px 0 hsla(210,48%,90%,.15) inset,
               0 0 2px 1px hsla(210,48%,90%,.4) inset,
               0 -1px 0 hsla(210,48%,90%,.2) inset;
 }
 #appmenu-button:hover:active,
 #appmenu-button[open] {
-  background-image: -moz-linear-gradient(hsl(211,33%,26%), hsl(209,53%,6%) 95%);
+  background-image: linear-gradient(hsl(211,33%,26%), hsl(209,53%,6%) 95%);
   box-shadow: 0 2px 3px rgba(0,0,0,.4) inset,
               0 1px 1px rgba(0,0,0,.2) inset;
 }
 %endif
 %endif
 
 #main-window[privatebrowsingmode=temporary] #appmenu-button {
-  background-image: -moz-linear-gradient(rgb(153,38,211), rgb(105,19,163) 95%);
+  background-image: linear-gradient(rgb(153,38,211), rgb(105,19,163) 95%);
   border-color: rgba(43,8,65,.9);
 }
 
 #main-window[privatebrowsingmode=temporary] #appmenu-button:hover:not(:active):not([open]) {
-  background-image: -moz-radial-gradient(center bottom, farthest-side, rgba(240,193,255,.5) 10%, rgba(240,193,255,0) 70%),
-                    -moz-radial-gradient(center bottom, farthest-side, rgb(192,81,247), rgba(236,172,255,0)),
-                    -moz-linear-gradient(rgb(144,20,207), rgb(95,0,158) 95%);
+  background-image: radial-gradient(farthest-side at bottom, rgba(240,193,255,.5) 10%, rgba(240,193,255,0) 70%),
+                    radial-gradient(farthest-side at bottom, rgb(192,81,247), rgba(236,172,255,0)),
+                    linear-gradient(rgb(144,20,207), rgb(95,0,158) 95%);
   border-color: rgba(43,8,65,.9);
   box-shadow: 0 1px 0 rgba(255,255,255,.1) inset,
               0 0 2px 1px rgba(240,193,255,.7) inset,
               0 -1px 0 rgba(240,193,255,.5) inset;
 }
 
 #main-window[privatebrowsingmode=temporary] #appmenu-button:hover:active,
 #main-window[privatebrowsingmode=temporary] #appmenu-button[open] {
-  background-image: -moz-linear-gradient(rgb(144,20,207), rgb(95,0,158) 95%);
+  background-image: linear-gradient(rgb(144,20,207), rgb(95,0,158) 95%);
 }
 
 #appmenu-button > .button-box {
   border-style: none;
   padding: 0;
 }
 
 #appmenu-button > .button-box > .button-menu-dropmarker {
@@ -294,55 +294,55 @@
   }
   #appmenuSecondaryPane:-moz-locale-dir(rtl) {
     box-shadow: -1px 0 2px rgb(204,214,234) inset;
   }
 
 %ifdef WINSTRIPE_AERO
   #appmenuPrimaryPane menupopup {
     -moz-appearance: none;
-    background-image: -moz-linear-gradient(left, white 26px, ThreeDLightShadow 26px,
-                                           ThreeDLightShadow 27px, ThreeDHighlight 27px,
-                                           ThreeDHighlight 28px, white 28px);
+    background-image: linear-gradient(to right, white 26px, ThreeDLightShadow 26px,
+                                      ThreeDLightShadow 27px, ThreeDHighlight 27px,
+                                      ThreeDHighlight 28px, white 28px);
     border: 3px solid;
     -moz-border-top-colors: ThreeDShadow white;
     -moz-border-bottom-colors: ThreeDShadow white;
     -moz-border-left-colors: ThreeDShadow white;
     -moz-border-right-colors: ThreeDShadow white;
   }
 %endif
 
   #appmenuSecondaryPane menupopup {
     -moz-appearance: none;
 %ifdef WINSTRIPE_AERO
-    background-image: -moz-linear-gradient(left, #f1f5fb 26px, ThreeDLightShadow 26px,
-                                           ThreeDLightShadow 27px, ThreeDHighlight 27px,
-                                           ThreeDHighlight 28px, #f1f5fb 28px);
+    background-image: linear-gradient(to right, #f1f5fb 26px, ThreeDLightShadow 26px,
+                                      ThreeDLightShadow 27px, ThreeDHighlight 27px,
+                                      ThreeDHighlight 28px, #f1f5fb 28px);
     border: 3px solid;
     -moz-border-top-colors: ThreeDShadow #f1f5fb;
     -moz-border-bottom-colors: ThreeDShadow #f1f5fb;
     -moz-border-left-colors: ThreeDShadow #f1f5fb;
     -moz-border-right-colors: ThreeDShadow #f1f5fb;
 %else
     background-color: #f1f5fb;
     border: 1px solid ThreeDShadow;
     padding: 2px;
 %endif
   }
 
 %ifdef WINSTRIPE_AERO
   #appmenuPrimaryPane menupopup:-moz-locale-dir(rtl) {
-    background-image: -moz-linear-gradient(right, white 26px, ThreeDLightShadow 26px,
-                                           ThreeDLightShadow 27px, ThreeDHighlight 27px,
-                                           ThreeDHighlight 28px, white 28px);
+    background-image: linear-gradient(to left, white 26px, ThreeDLightShadow 26px,
+                                      ThreeDLightShadow 27px, ThreeDHighlight 27px,
+                                      ThreeDHighlight 28px, white 28px);
   }
   #appmenuSecondaryPane menupopup:-moz-locale-dir(rtl) {
-    background-image: -moz-linear-gradient(right, #f1f5fb 26px, ThreeDLightShadow 26px,
-                                           ThreeDLightShadow 27px, ThreeDHighlight 27px,
-                                           ThreeDHighlight 28px, #f1f5fb 28px);
+    background-image: linear-gradient(to left, #f1f5fb 26px, ThreeDLightShadow 26px,
+                                      ThreeDLightShadow 27px, ThreeDHighlight 27px,
+                                      ThreeDHighlight 28px, #f1f5fb 28px);
   }
 %endif
 
   .appmenu-menuseparator {
     -moz-appearance: none;
     margin-top: 3px;
     margin-bottom: 3px;
 %ifdef WINSTRIPE_AERO
@@ -353,17 +353,17 @@
     padding: 0;
     border-top: 1px solid #d6e5f5;
     border-bottom: none;
   }
 
   .appmenu-edit-button:not([disabled]):hover {
     border: 1px solid #b8d6fb;
     box-shadow: inset 0 0 1px white;
-    background: -moz-linear-gradient(#fafbfd, #ebf3fd);
+    background: linear-gradient(#fafbfd, #ebf3fd);
     transition: .2s ease-in;
   }
 }
 
 #appmenuSecondaryPane-spacer {
   min-height: 1em;
 }
 
@@ -752,17 +752,17 @@ toolbar[mode=full] .toolbarbutton-1 > .t
   border-top-left-radius: 0;
   border-bottom-left-radius: 0;
 }
 
 @navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
 @navbarLargeIcons@ .toolbarbutton-1:not([disabled]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
 @navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-icon,
 @conditionalForwardWithUrlbar@ > .toolbarbutton-1:-moz-any([disabled],:not([open]):not([disabled]):not(:active)) > .toolbarbutton-icon {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
+  background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
   border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.2) hsla(210,54%,20%,.25);
   box-shadow: 0 1px hsla(0,0%,100%,.3) inset,
               0 1px hsla(210,54%,20%,.03),
               0 0 2px hsla(210,54%,20%,.1);
 }
 
 @navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):not([open]):not(:active):hover > .toolbarbutton-icon,
 @navbarLargeIcons@ .toolbarbutton-1:not([buttonover]):not([open]):not(:active):hover > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon,
@@ -771,17 +771,17 @@ toolbar[mode=full] .toolbarbutton-1 > .t
   background-color: hsla(210,48%,96%,.75);
   box-shadow: 0 0 1px hsla(210,54%,20%,.03),
               0 0 2px hsla(210,54%,20%,.1);
 }
 
 @navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover:active > .toolbarbutton-icon,
 @navbarLargeIcons@ .toolbarbutton-1[open] > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon,
 @navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-icon {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
+  background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
   background-color: hsla(210,54%,20%,.15);
   border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
   box-shadow: 0 1px 1px hsla(210,54%,20%,.1) inset,
               0 0 1px hsla(210,54%,20%,.2) inset,
               /* allows winstripe-keyhole-forward-clip-path to be used for non-hover as well as hover: */
               0 1px 0 hsla(210,54%,20%,0),
               0 0 2px hsla(210,54%,20%,0);
   text-shadow: none;
@@ -806,30 +806,30 @@ toolbar[mode=full] .toolbarbutton-1 > .t
   padding: 0 3px;
 }
 
 #TabsToolbar .toolbarbutton-1:not([disabled]):hover,
 #TabsToolbar .toolbarbutton-1[open],
 #TabsToolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover,
 .tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):hover,
 .tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):hover {
-  background-image: -moz-linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.5)),
-                    -moz-linear-gradient(transparent, rgba(0,0,0,.25) 30%),
-                    -moz-linear-gradient(transparent, rgba(0,0,0,.25) 30%);
+  background-image: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.5)),
+                    linear-gradient(transparent, rgba(0,0,0,.25) 30%),
+                    linear-gradient(transparent, rgba(0,0,0,.25) 30%);
   background-position: 1px -1px, 0 -1px, 100% -1px;
   background-size: calc(100% - 2px) 100%, 1px 100%, 1px 100%;
   background-repeat: no-repeat;
 }
 
 #addon-bar .toolbarbutton-1:not([disabled]):hover,
 #addon-bar .toolbarbutton-1[open],
 #addon-bar .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover {
-  background-image: -moz-linear-gradient(bottom, transparent, rgba(0,0,0,.15)),
-                    -moz-linear-gradient(bottom, transparent, rgba(0,0,0,.15) 30%),
-                    -moz-linear-gradient(bottom, transparent, rgba(0,0,0,.15) 30%);
+  background-image: linear-gradient(to top, transparent, rgba(0,0,0,.15)),
+                    linear-gradient(to top, transparent, rgba(0,0,0,.15) 30%),
+                    linear-gradient(to top, transparent, rgba(0,0,0,.15) 30%);
   background-position: left, left, right;
   background-size: auto, 1px 100%, 1px 100%;
   background-repeat: no-repeat;
 }
 
 /* unified back/forward button */
 
 #back-button {
@@ -894,17 +894,17 @@ toolbar[mode=full] .toolbarbutton-1 > .t
 @conditionalForwardWithUrlbar@ > #back-button > menupopup {
   margin-top: -1px;
 }
 
 @conditionalForwardWithUrlbar@ > #back-button > .toolbarbutton-icon {
   border-radius: 10000px;
   padding: 5px;
   border: none;
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
+  background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
   box-shadow: 0 1px 0 hsla(0,0%,100%,.3) inset,
               0 0 0 1px hsla(0,0%,100%,.3) inset,
               0 0 0 1px hsla(210,54%,20%,.25),
               0 1px 0 hsla(210,54%,20%,.35);
   transition-property: background-color, box-shadow;
   transition-duration: 250ms;
 }
 
@@ -1284,22 +1284,22 @@ html|*.urlbar-input:-moz-lwtheme::-moz-p
 }
 
 .urlbar-icon:-moz-system-metric(touch-enabled) {
   -moz-margin-end: 1px !important;
   padding: 0 3px !important;
 }
 
 .urlbar-icon:hover {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,70%,.3), hsla(200,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(200,100%,70%,.3), hsla(200,100%,70%,0));
 }
 
 .urlbar-icon[open="true"],
 .urlbar-icon:hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,70%,.1), hsla(200,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(200,100%,70%,.1), hsla(200,100%,70%,0));
 }
 
 #urlbar-search-splitter {
   min-width: 6px;
   -moz-margin-start: -3px;
   border: none;
   background: transparent;
 }
@@ -1370,20 +1370,20 @@ html|*.urlbar-input:-moz-lwtheme::-moz-p
 @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) + #urlbar-container > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(rtl) {
   /* when not hovered anymore, trigger a new non-delayed transition to react to the forward button hiding */
   padding-right: 5.01px;
 }
 
 #urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity {
   color: hsl(92,100%,30%);
   -moz-margin-end: 4px;
-  background-image: -moz-linear-gradient(hsla(92,81%,16%,0),
-                                         hsla(92,81%,16%,.2) 25%,
-                                         hsla(92,81%,16%,.2) 75%,
-                                         hsla(92,81%,16%,0));
+  background-image: linear-gradient(hsla(92,81%,16%,0),
+                                    hsla(92,81%,16%,.2) 25%,
+                                    hsla(92,81%,16%,.2) 75%,
+                                    hsla(92,81%,16%,0));
   background-position: right;
   background-size: 1px;
   background-repeat: no-repeat;
 }
 
 #identity-box.verifiedIdentity:-moz-locale-dir(rtl) {
   background-position: left;
 }
@@ -1414,23 +1414,23 @@ html|*.urlbar-input:-moz-lwtheme::-moz-p
   -moz-image-region: rect(0px, 11px, 14px, 0px);
 }
 
 .urlbar-history-dropmarker:-moz-system-metric(touch-enabled) {
   min-width: 6.4mozmm;
 }
 
 .urlbar-history-dropmarker:hover {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
   -moz-image-region: rect(0px, 22px, 14px, 11px);
 }
 
 .urlbar-history-dropmarker:hover:active,
 .urlbar-history-dropmarker[open="true"] {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.1), hsla(205,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(205,100%,70%,.1), hsla(205,100%,70%,0));
   -moz-image-region: rect(0px, 33px, 14px, 22px);
 }
 
 /* page proxy icon */
 
 #page-proxy-favicon {
   width: 16px;
   height: 16px;
@@ -1571,62 +1571,62 @@ richlistitem[type~="action"][actiontype=
   padding: 0 3px;
 }
 
 #urlbar-reload-button {
   -moz-image-region: rect(0, 14px, 14px, 0);
 }
 
 #urlbar-reload-button:not([disabled]):hover {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,70%,.2), hsla(200,100%,70%,0));
+  background-image: radial-gradient(circle closest-side, hsla(200,100%,70%,.2), hsla(200,100%,70%,0));
   -moz-image-region: rect(14px, 14px, 28px, 0);
 }
 
 #urlbar-reload-button:not([disabled]):hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,60%,.1), hsla(200,100%,60%,0));
+  background-image: radial-gradient(circle closest-side, hsla(200,100%,60%,.1), hsla(200,100%,60%,0));
   -moz-image-region: rect(28px, 14px, 42px, 0);
 }
 
 #urlbar-reload-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
   transform: scaleX(-1);
 }
 
 #go-button,
 #urlbar-go-button {
   -moz-image-region: rect(0, 42px, 14px, 28px);
 }
 
 #go-button:hover,
 #urlbar-go-button:hover {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(110,70%,50%,.2), hsla(110,70%,50%,0));
+  background-image: radial-gradient(circle closest-side, hsla(110,70%,50%,.2), hsla(110,70%,50%,0));
   -moz-image-region: rect(14px, 42px, 28px, 28px);
 }
 
 #go-button:hover:active,
 #urlbar-go-button:hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(110,70%,50%,.1), hsla(110,70%,50%,0));
+  background-image: radial-gradient(circle closest-side, hsla(110,70%,50%,.1), hsla(110,70%,50%,0));
   -moz-image-region: rect(28px, 42px, 42px, 28px);
 }
 
 #go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
 #urlbar-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
   transform: scaleX(-1);
 }
 
 #urlbar-stop-button {
   -moz-image-region: rect(0, 28px, 14px, 14px);
 }
 
 #urlbar-stop-button:not([disabled]):hover {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(5,100%,75%,.3), hsla(5,100%,75%,0));
+  background-image: radial-gradient(circle closest-side, hsla(5,100%,75%,.3), hsla(5,100%,75%,0));
   -moz-image-region: rect(14px, 28px, 28px, 14px);
 }
 
 #urlbar-stop-button:hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(5,100%,75%,.1), hsla(5,100%,75%,0));
+  background-image: radial-gradient(circle closest-side, hsla(5,100%,75%,.1), hsla(5,100%,75%,0));
   -moz-image-region: rect(28px, 28px, 42px, 14px);
 }
 
 /* popup blocker button */
 
 #page-report-button {
   list-style-image: url("chrome://browser/skin/urlbar-popup-blocked.png");
   -moz-image-region: rect(0, 16px, 16px, 0);
@@ -1689,22 +1689,22 @@ richlistitem[type~="action"][actiontype=
 /* star button */
 
 #star-button {
   list-style-image: url("chrome://browser/skin/places/bookmark.png");
   -moz-image-region: rect(0px 16px 16px 0px);
 }
 
 #star-button:hover {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(45,100%,73%,.3), hsla(45,100%,73%,0));
+  background-image: radial-gradient(circle closest-side, hsla(45,100%,73%,.3), hsla(45,100%,73%,0));
   -moz-image-region: rect(0px 32px 16px 16px);
 }
 
 #star-button:hover:active {
-  background-image: -moz-radial-gradient(center, circle closest-side, hsla(45,100%,73%,.1), hsla(45,100%,73%,0));
+  background-image: radial-gradient(circle closest-side, hsla(45,100%,73%,.1), hsla(45,100%,73%,0));
   -moz-image-region: rect(0px 48px 16px 32px);
 }
 
 #star-button[starred="true"] {
   list-style-image: url("chrome://browser/skin/places/editBookmark.png");
 }
 
 /* bookmarking panel */
@@ -1731,17 +1731,17 @@ richlistitem[type~="action"][actiontype=
 #editBMPanel_folderTree {
   min-width: 27em;
 }
 
 .panel-promo-box {
   margin: 10px -10px -10px;
   padding: 8px 10px;
   border-top: 1px solid ThreeDShadow;
-  background-image: -moz-linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
+  background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
   border-bottom-left-radius: 3px;
   border-bottom-right-radius: 3px;
 }
 
 @media (-moz-windows-default-theme) {
   .panel-promo-box {
     border-top-style: none;
     background: #f1f5fb;
@@ -1809,113 +1809,112 @@ richlistitem[type~="action"][actiontype=
 
 #TabsToolbar {
   min-height: 0;
   padding: 0;
 }
 
 #TabsToolbar:not(:-moz-lwtheme),
 #TabsToolbar[tabsontop=false] {
-  background-image:
-    -moz-linear-gradient(bottom, @toolbarShadowColor@ 1px, rgba(0,0,0,.05) 1px, transparent 50%);
+  background-image: linear-gradient(to top, @toolbarShadowColor@ 1px, rgba(0,0,0,.05) 1px, transparent 50%);
 }
 
 %ifndef WINSTRIPE_AERO
 @media (-moz-windows-default-theme) {
   #main-window[sizemode=normal] #TabsToolbar {
     padding-left: 2px;
     padding-right: 2px;
   }
 }
 %endif
 
 .tabbrowser-tab,
 .tabs-newtab-button {
   -moz-appearance: none;
   background: @toolbarShadowOnTab@, @bgTabTexture@,
-              -moz-linear-gradient(-moz-dialog, -moz-dialog);
+              linear-gradient(-moz-dialog, -moz-dialog);
   background-origin: border-box;
   background-position: 1px 2px;
   background-size: calc(100% - 2px) calc(100% - 2px);
   background-repeat: no-repeat;
   margin: 0;
   padding: 2px 0 4px;
   border-width: 4px 3px 0;
   border-style: solid;
   -moz-border-image: url(tabbrowser/tab.png) 4 3 0 fill repeat stretch;
   border-radius: 0;
 }
 
 .tabbrowser-tab:hover,
 .tabs-newtab-button:hover {
   background-image: @toolbarShadowOnTab@, @bgTabTextureHover@,
-                    -moz-linear-gradient(-moz-dialog, -moz-dialog);
+                    linear-gradient(-moz-dialog, -moz-dialog);
 }
 
 %ifndef WINSTRIPE_AERO
 @media (-moz-windows-theme: luna-blue) {
   .tabbrowser-tab,
   .tabs-newtab-button {
     background-image: @toolbarShadowOnTab@,
-                      -moz-linear-gradient(hsla(51,34%,89%,.9), hsla(51,15%,79%,.9) 1px, hsla(51,9%,68%,.9));
+                      linear-gradient(hsla(51,34%,89%,.9), hsla(51,15%,79%,.9) 1px, hsla(51,9%,68%,.9));
   }
 
   .tabbrowser-tab:hover,
   .tabs-newtab-button:hover {
     background-image: @toolbarShadowOnTab@,
-                      -moz-linear-gradient(hsla(51,34%,100%,.9), hsla(51,15%,94%,.9) 1px, hsla(51,9%,83%,.9));
+                      linear-gradient(hsla(51,34%,100%,.9), hsla(51,15%,94%,.9) 1px, hsla(51,9%,83%,.9));
   }
 }
 %endif
 
 .tabbrowser-tab[selected="true"] {
-  background-image: -moz-linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 50%),
-                    -moz-linear-gradient(-moz-dialog, -moz-dialog);
+  background-image: linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 50%),
+                    linear-gradient(-moz-dialog, -moz-dialog);
 }
 
 #main-window[tabsontop=false]:not([disablechrome]) .tabbrowser-tab[selected=true]:not(:-moz-lwtheme) {
   background-image: @toolbarShadowOnTab@,
-                    -moz-linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 50%),
-                    -moz-linear-gradient(-moz-dialog, -moz-dialog);
+                    linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 50%),
+                    linear-gradient(-moz-dialog, -moz-dialog);
 }
 
 .tabbrowser-tab:-moz-lwtheme {
   color: inherit;
 }
 
 .tabbrowser-tab[selected="true"]:-moz-lwtheme {
-  background-image: -moz-linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 50%);
+  background-image: linear-gradient(@selectedTabHighlight@, @toolbarHighlight@ 50%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-brighttext:not([selected="true"]),
 .tabs-newtab-button:-moz-lwtheme-brighttext {
-  background-image: -moz-linear-gradient(hsla(0,0%,40%,.6), hsla(0,0%,30%,.6) 80%);
+  background-image: linear-gradient(hsla(0,0%,40%,.6), hsla(0,0%,30%,.6) 80%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-brighttext:not([selected="true"]):hover,
 .tabs-newtab-button:-moz-lwtheme-brighttext:hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,60%,.6), hsla(0,0%,45%,.6) 80%);
+  background-image: linear-gradient(hsla(0,0%,60%,.6), hsla(0,0%,45%,.6) 80%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-darktext:not([selected="true"]),
 .tabs-newtab-button:-moz-lwtheme-darktext {
-  background-image: -moz-linear-gradient(hsla(0,0%,60%,.5), hsla(0,0%,45%,.5) 80%);
+  background-image: linear-gradient(hsla(0,0%,60%,.5), hsla(0,0%,45%,.5) 80%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-darktext:not([selected="true"]):hover,
 .tabs-newtab-button:-moz-lwtheme-darktext:hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,80%,.5), hsla(0,0%,60%,.5) 80%);
+  background-image: linear-gradient(hsla(0,0%,80%,.5), hsla(0,0%,60%,.5) 80%);
 }
 
 .tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
-  background-image: -moz-radial-gradient(center 3px, circle cover, rgba(255,255,255,1) 3%, rgba(186,221,251,.75) 40%, rgba(127,179,255,.5) 80%, rgba(127,179,255,.25));
+  background-image: radial-gradient(circle farthest-corner at 50% 3px, rgba(255,255,255,1) 3%, rgba(186,221,251,.75) 40%, rgba(127,179,255,.5) 80%, rgba(127,179,255,.25));
 }
 .tabbrowser-tab[pinned][titlechanged]:not([selected="true"]):hover {
-  background-image: -moz-linear-gradient(hsla(0,0%,100%,.4), hsla(0,0%,75%,.4) 80%),
-                    -moz-radial-gradient(center 3px, circle cover, rgba(255,255,255,1) 3%, rgba(186,221,251,.75) 40%, rgba(127,179,255,.5) 80%, rgba(127,179,255,.25));
+  background-image: linear-gradient(hsla(0,0%,100%,.4), hsla(0,0%,75%,.4) 80%),
+                    radial-gradient(circle farthest-corner at 50% 3px, rgba(255,255,255,1) 3%, rgba(186,221,251,.75) 40%, rgba(127,179,255,.5) 80%, rgba(127,179,255,.25));
 }
 
 .tab-throbber,
 .tab-icon-image {
   width: 16px;
   height: 16px;
   list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
   -moz-margin-start: 2px;
@@ -2591,33 +2590,33 @@ toolbarbutton.bookmark-item[dragover="tr
 /* Add-on bar */
 
 #addon-bar {
   -moz-appearance: none;
   min-height: 20px;
   border-top-style: none;
   border-bottom-style: none;
   padding-top: 1px;
-  background-image: -moz-linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
+  background-image: linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
   background-size: 100% 2px;
   background-repeat: no-repeat;
 }
 
 #status-bar {
   -moz-appearance: none;
   background-color: transparent;
   border: none;
   min-height: 0;
 }
 
 #addon-bar[customizing] > #status-bar {
   opacity: .5;
-  background-image: -moz-repeating-linear-gradient(-45deg,
-                                                   rgba(255,255,255,.3), rgba(255,255,255,.3) 5px,
-                                                   rgba(0,0,0,.3) 5px, rgba(0,0,0,.3) 10px);
+  background-image: repeating-linear-gradient(135deg,
+                                              rgba(255,255,255,.3), rgba(255,255,255,.3) 5px,
+                                              rgba(0,0,0,.3) 5px, rgba(0,0,0,.3) 10px);
 }
 
 #status-bar > statusbarpanel {
   border-width: 0;
   -moz-appearance: none;
 }
 
 #addonbar-closebutton {
@@ -2636,17 +2635,17 @@ toolbarbutton.bookmark-item[dragover="tr
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
 
 /* Status panel */
 
 .statuspanel-label {
   margin: 0;
   padding: 2px 4px;
-  background: -moz-linear-gradient(white, #ddd);
+  background: linear-gradient(#fff, #ddd);
   border: 1px none #ccc;
   border-top-style: solid;
   color: #333;
   text-shadow: none;
 }
 
 .statuspanel-label:-moz-locale-dir(ltr):not([mirror]),
 .statuspanel-label:-moz-locale-dir(rtl)[mirror] {
@@ -2686,17 +2685,17 @@ toolbarbutton.bookmark-item[dragover="tr
 }
 
 /* Highlighter - Node Infobar */
 
 .highlighter-nodeinfobar {
   color: hsl(200, 100%, 65%);
   border: 1px solid hsla(210, 19%, 63%, .5);
   border-radius: 3px;
-  background: -moz-linear-gradient(hsl(209, 18%, 30%), hsl(210, 24%, 16%)) no-repeat padding-box;
+  background: linear-gradient(hsl(209, 18%, 30%), hsl(210, 24%, 16%)) no-repeat padding-box;
 }
 
 /* Highlighter - Node Infobar - text */
 
 .highlighter-nodeinfobar-text {
   /* 100% - size of the buttons and margins */
   max-width: calc(100% - 2 * (26px + 6px));
   padding-bottom: 1px;
@@ -2771,25 +2770,25 @@ html|*.highlighter-nodeinfobar-pseudo-cl
   background-repeat: no-repeat;
 }
 
 .highlighter-nodeinfobar-arrow-top {
   margin-bottom: -8px;
   margin-top: 8px;
   border-right-color: hsla(210, 19%, 63%, .5);
   border-top-color: hsla(210, 19%, 63%, .5);
-  background-image: -moz-linear-gradient(bottom left, transparent 50%, hsl(209, 18%, 30%) 50%);
+  background-image: linear-gradient(to top right, transparent 50%, hsl(209, 18%, 30%) 50%);
 }
 
 .highlighter-nodeinfobar-arrow-bottom {
   margin-top: -8px;
   margin-bottom: 8px;
   border-left-color: hsla(210, 19%, 63%, .5);
   border-bottom-color: hsla(210, 19%, 63%, .5);
-  background-image: -moz-linear-gradient(top right, transparent 50%, hsl(210, 24%, 16%) 50%);
+  background-image: linear-gradient(to bottom left, transparent 50%, hsl(210, 24%, 16%) 50%);
 }
 
 .highlighter-nodeinfobar-container[position="top"] > .highlighter-nodeinfobar,
 .highlighter-nodeinfobar-container[position="overlap"] > .highlighter-nodeinfobar {
   box-shadow: 0 1px 0 hsla(0, 0%, 100%, .1) inset;
 }
 
 .highlighter-nodeinfobar-container[hide-arrow] > .highlighter-nodeinfobar {
@@ -3018,17 +3017,17 @@ html|*#gcli-output-frame {
 }
 
 /* Error counter */
 
 #developer-toolbar-toolbox-button[error-count]:before {
   color: #FDF3DE;
   min-width: 16px;
   text-shadow: none;
-  background-image: -moz-linear-gradient(top, #B4211B, #8A1915);
+  background-image: linear-gradient(#B4211B, #8A1915);
   border-radius: 1px;
   -moz-margin-end: 5px;
 }
 
 /* Social toolbar item */
 #social-provider-button {
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
--- a/browser/themes/winstripe/downloads/allDownloadsViewOverlay.css
+++ b/browser/themes/winstripe/downloads/allDownloadsViewOverlay.css
@@ -46,17 +46,17 @@
   min-width: 0;
   min-height: 0;
   margin: 3px;
   border: none;
   padding: 5px;
   list-style-image: url("chrome://browser/skin/downloads/buttons.png");
 }
 
- /*** Button icons ***/
+/*** Button icons ***/
 
 .downloadButton.downloadCancel {
   -moz-image-region: rect(0px, 16px, 16px, 0px);
 }
 
 .downloadButton.downloadShow {
   -moz-image-region: rect(16px, 16px, 32px, 0px);
 }
--- a/browser/themes/winstripe/downloads/contentAreaDownloadsView.css
+++ b/browser/themes/winstripe/downloads/contentAreaDownloadsView.css
@@ -1,6 +1,16 @@
 /* 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/. */
 
 @import url("chrome://global/skin/inContentUI.css");
 
+.downloadButton {
+  box-shadow: none;
+}
+
+.downloadButton:not([disabled="true"]):hover:active,
+.downloadButton:not([disabled]):hover:active {
+  background: transparent;
+  border: none;
+  box-shadow: none;
+}
new file mode 100755
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..5194f5d59a4328f984b99a8d76be18175b793345
GIT binary patch
literal 3755
zc$`&Nc{mhY7oVATkS&=ELxhZd$yh>zF=HJSvacD#h-@i4F{DXFl(i(XWU1^?WEo2e
zY3y4VN+dLv7);|+@B6*a_x*9tdG5LA{C>atoaa9GIkzm#jJY|4H~;_uH`c_!^1u^+
zuS2W{wq4h)=fDXD8QKR~1$YL9x?Ldv&>jJJf*97%?IOXF;N}q?_@1B*031GtH9%X3
zO|0aEUrw7B>8crD&iRmYS<>T&ME2AN&vvMZ*m#(Y(@U#6b!H+#m%b+&Lz8X452@tv
zPexEK4a<$kzY`ZLj!Q@ozH&3=x^O~W-R&2S0W3UWd%sq6A6T-#Tm3qwvD2hF6ZjVO
zZbLiw<DPTlp0=zkgVxT2`p2Z!e$>4K!Wvp9@FT<oO{DIt8@%TuC?}|t8VEwUp2v{o
zdAach94YvY*svp_bH?4QTG4CuI{6Bp4aXDnpPTYOiJ=yYN5EZ&mn)Mmah?qhwQ&_%
zE^YLjdvY}(D`@de_S($&yBF7CyOA}WGtE!lNC&BR2eGFob;}q~?o`)++1t#G-+ryz
zm47p(>d87{r(+#d(J1j*z)<v?zvxxxy^a2Xl=-{;_nCJQu7qg^I=bIEG;+M5?51hs
zMQ1ZYk;-q7K#n}Vfc~+5zxj0NO0WihU$Dr~l<HP|U^BMc(LJ-;H3+NaG^L-Z=r0?Y
zYSr!RmsxVwx-PKgYREaS7kh#~Suvn%g-VPL#@3+bL-T;6<d02VQSe`g)U>8?$@#hr
z({LSK*?pUqwEc-ABqq}>rcl9JO3rEbvy|-i@xgm04+?b9%_W@MAjBa(Rd0!;;-M7*
zCixm=43}|bJG_u#7p2en>nwV_B+=SdPL-PtZ-z@8x|LhQPt34l8A=++3dqu68uT4E
z|KfMXk=}$BEPZb6Dc1<&;5ZRHxA2@LPdym%VXJHZ{ov!*BjWQS>)7zcD+J!O^lt6w
z$Hh6eZ1`IxgvyI20e;Uly-G8G5_j4kO-ZiDp2QIPqABa>aPujJDsvp}cgjk6xL1;2
z)KHLi{h%}wcm>&Xf9?E6W=Z=`e2vU?^5Z5zZRb)!QpToHO<L&KNhEOn@J`WYr9=Md
z1d;Z$tdUzFif&_W$YkO<&mD5Ho}(Oc80~xPB4TU|EK}e&S_05@_zDMh+Y`fB?Dh1C
z<{3|_twihr{6v-nJ7SO;UP;L6F7_huPXzbdiA4h|dDG71R=-!a4*3&=@U{|-deQFP
z2-bg-+<-I|PA$^!9kGK&`3a(_nkzkrWswb7-Jf-Zi?bC}31H`>0Duv1{v6=`W=L=X
z=m;S=lVrOV9f;A8yh-_<N`M03?{xM&eF@Ke#5_!dlfnav7uT~ZRnRB=pEg}!tyf24
zpQVFQ59r@Q1w966C>#EnZ0SJi?)wwKgZK&%I{#%R#)GqXfTy+pD{<goi3bQNSpaiA
zVo35IDhQw6btARB0}V;bEc6+dYu<AcN1I;#I&qcw<9mV6Y}w^wqf=J|h)a6Gyum{6
z_Bd5pjy2)ZGsZ+n=jn25JYU5=ACaFkdh=J5ov8X)??CytZDX+4#yb`3kg~sq4TrqN
zekgBpoU$d$8CP0$DxvwBANIW(T@K}+f4TeDR$r+AI09p5D|~w4bdZn6ENs(>b*Wi5
z!lz`mjK{Usanb|hp79UXjU_dUP#6cl2JbPv!Se*cs-vMNOWae%A_&=trlJlHq`iYx
z)w8XTjqB5X4x!MNq9(uI^TW$=N4@L$P5u%Y{uFqBODnt3_@Ju?c<p($(5xf>AW4w$
zUKVdp00gaYTAD=zE!9^ZZ;kXD+iXKkg&3b48VBUON5?I+_K3#y<Ko}8UlZg3={ZZv
zFh8gp=u}67J+CU>n5(nMX2~9$SJkdIOVP?K+OJ;J`GBb@oSaMBjC8&qjUo!`%{yvg
zp?HjM>pvy82=U%rAlT)Z9Cyp_uSf5lYY<T)DX9t`NV=m8?io{haeI1#kiFi$Q?nU^
z5E=Xtc(tHgv4d+lLA)x_2GCF+5QVk-*?Ge}t<FcoO<U@jqgM5yzoFe*>XjQpdV2!o
zvtgfXkjA4prgP&UG@Y2bd8-oiH@UAyrcr1L*V3=Us-E`*GRiBQ^IiOP%Ju8pxF3B1
zO5hE96GRYv`Vp738;Ro$zsez@cEe{E%5EJ~lUJ0skNZM0PfUO!Btklrr>9!2tBN08
z^j)LVc$k#e5pzcBOd|go?iHYh^aGI8k_<!OAoZwAixe}vrvO5UR~AK@Ml;&&8b-_}
z^1_86%OtR(znKbHVMty<+Sx}+=MVPLWy_<#3@Yv7K)W|{at5QR5uWR(KV0bvTv5sp
z6QmAue!GAS|AnP-?y^OT>Hvck;pq1bvOelPCZOWNsgGhLco^`TVGs%#E`kt*(Tnc^
zay4CM9b8|VHubKjdrH?G7ms~<L)8lyrB3~97)7GqL7-xA)NS$Dkd_`!cBO4?yVsZv
zK6scQM6I#l#AQ~cp|@ePv^kM3&R3)h9pu=UGH|%PXWE=Z*N;s9tcEm67@Up-#FWm<
zFJ1e_QYa8eqvjfcd^MeI8v-XFE0CT{1u~$mxUTb#QIpbzHxEG3)6_OpaITmDB<wkx
ze9OX=^-GgR7{pf}y?qOF6~gm!eoH3m$HrjB`HC|qrzvDq5_pll`TL~vRH1{%4u+e3
zNaj_;gH($WZlG%ujHY20$uY$wNRvmoL>SGIGUDuv>}SVnITdrC)oWP*du_9|0&h(C
zH|h`M+5K!*_Cs*L+{{1kB+bUKl6;2-PIZc;Dy_9x>xe>xtpW(_bEK9eYBoC)BZN;q
z%JhaS2cK<z<@<fJ>!mp+PB8^nQNp*djG+lUXrcL)U&_B=6IGd7NZWS>?P9zSH<P{y
z&mh*2gvnx5nP2sB8#D+Cw^;cc<xcUr#P8VLYB3=rN-s7|IS0XM(nH33RF99SJLp<9
zbwC~=A`58!KGCZ)&QMmy85V|cc<T=*kg?ld{2dU|li^U`x+{C;vL`)kBRSo#^s)Jd
zjF9O(+y0QN009j`!e3QJUHou;mu1A<I(tQdJUZ*1FobJ1*pPaNdVlQT9x_W=^cStG
z5BIo}>XL0vV&Zi2*Cn)uSQnw*kFD$ccHPwi@}F2mr5Y=`(yyJt9UHw67`^lOAxcQd
zSF{Knr>3SiG0iJfh9tY<v~Is&muTl<md+r0;p`lf@_n4E&zdxv$Xjj`PkH5l!-A+|
zgNl_=q@DhDH3xna73N9X%V<5_@PhFMcXj1QB6r>P;Hhznn3-DdA@*VDhL}siywyYD
zL55dY`$4zeC$2BBX6v^gNPa(x{Nlll2A{bWmW`A*zX>VirmbWl%v<a4Tt7avCb}r5
z&rZt;=7eiXhl#0m!RlJF>)f)==+O{gz8zD{P5V(6PL%4D;AECUJW{{~6CiOD+Ox!n
zNu;SsUOc#4r(J<q(P2>>P#K+=PPvxF<*KYQyR8_jbpq|PxY`@BH`%>FdH`;swT~ow
zu^7mUKjcbwre8DByD2kYpD_%c{Jz@FF}V*-Z$)TRTX5}$10y^=+apXSoc>_#7ye?H
zX^PZcgzVd7!HeKYOsMBg5#uz?pP1K!ynY5+qzJ@We{Q!)Hv6^SqI8~f(Spnek}w|j
zr))?}=$H7M0J%|zdD&QE?(w=N^Bxz+HDv}&QU(QUP}Er7Enaspsnj=uP<;+0O3-Es
z2ukhAE^$GHGWEl*F4KY!b0(<~I#5U<CeB*zvLzeMs(`j{H4S;F-{b7~O_@QLEa3<l
zp1MCuWjZaXVwHg8t}ny(0Wlh5kX?1#Q^BBU*7juAIE-+FCbtgx0}J=6oz*BNE>j%%
zcC3&iy7FGbaoWP<^b;L!$C2CZg0Scqlay<%NOcOdA<(*DA$>?4D|H|}R)=e%r`5M5
zV|Kd&9Mth%)5Jn>@vsZ3p?@&7p&P`$44}d$C@Hnma)c2i^IRkh?E0vui^gUWCkrQ!
zu@t%J|5m1={%m@Uf5nAzoTLf;B-7nX+dB^;RDiW!G`}b4yc|vPSr3u1eIVHx(pU&c
zL32~(^J&S-400yU_iO9`mbp5S%XeyLf=^zYe9DB#U4Ul)D$4QPr22bKzyJxl;*d~7
zhcU&lc><8Lo57>bP7IH6VCQZ0eKF9?iTNSqbY7Ai2~`V8j0GQMOsS)kE(m+sYU{K@
zC>Av%C+0~x`w7dI_=4NB(zn3VtAe9h8Q?9MjBHk;xC`{3<)c;7fp>_m@QhNfm;^}}
zH@n<r)vn>MMe|5#j~LlDa=*>h{oZ=pYRh0be8o(K@r8HRgFQ}DI6NcR;c_G18-*34
zF5H}|==X=Om=3(<Yd6<r4|*q~e+K)y*k{*fWFG2d`B){#Bo-_S5VQlJ2<lXgG~vTR
zB!4_z<sM*Rp5>FvFsk}RR^|CB7=$W6CY#k%eDIsX58Lt=v`OlaR~x>23*4XWF^+pz
z`n0^StS9j9^m;ApU=^S5=u_MkdJ;A8gfT~RTamrTX*WmVu^Z60FUP_j!prfh%2DAa
zl*l+i5r?bicbX@(=toM8t0+O*EIxF;D75N2$*Mw69C4vzzrF7`iCeaY90+DpWu%*Z
z>N`#4rkLut+Nu0OaKxUvCU^5>wi%gYmLp1HyWU>Xx93t&^OFm>9kml3`FQNGhpwk@
zZHr4SrDdkRXqVSl^<!J6hR>#=f3apFwu^S~P)rlY3l@>|q4YsXj>VCR4nId!=Z!lW
zmWyqMzVfa&B<xO-7wCi5A3}D$x9rz$J@%wCt$n^MLrZQP3df%qjb!mJJ(SbtCeRqc
z0(z4%vpXx<HhPk5CXlDvVOx&Yvy%+@rh@vPIS#(F;c9>iEbhM>HE=L}0<eZ=2IUxB
G+<yS}K=FG3
rename from browser/themes/winstripe/downloads/download-notification.png
rename to browser/themes/winstripe/downloads/download-notification-start.png
--- a/browser/themes/winstripe/downloads/downloads.css
+++ b/browser/themes/winstripe/downloads/downloads.css
@@ -222,44 +222,57 @@ richlistitem[type="download"][state="1"]
                               0, 108, 18, 90) center no-repeat;
   background-size: 12px;
 }
 
 #downloads-indicator:not([counter])[attention] > #downloads-indicator-anchor > #downloads-indicator-progress-area > #downloads-indicator-counter {
   background-image: url("chrome://browser/skin/downloads/download-glow.png");
 }
 
-/*** Event notification ***/
+/*** Download notifications ***/
 
 #downloads-indicator-notification {
   opacity: 0;
-  background: url("chrome://browser/skin/downloads/download-notification.png")
-              center no-repeat;
   background-size: 16px;
+  background-position: center;
+  background-repeat: no-repeat;
 }
 
-@keyframes downloadsIndicatorNotificationRight {
+@keyframes downloadsIndicatorNotificationStartRight {
   from { opacity: 0; transform: translate(-128px, 128px) scale(8); }
   20%  { opacity: .85; animation-timing-function: ease-out; }
   to   { opacity: 0; transform: translate(0) scale(1); }
 }
 
-@keyframes downloadsIndicatorNotificationLeft {
+@keyframes downloadsIndicatorNotificationStartLeft {
   from { opacity: 0; transform: translate(128px, 128px) scale(8); }
   20%  { opacity: .85; animation-timing-function: ease-out; }
   to   { opacity: 0; transform: translate(0) scale(1); }
 }
 
-#downloads-indicator[notification] > #downloads-indicator-anchor > #downloads-indicator-notification {
-  animation-name: downloadsIndicatorNotificationRight;
+#downloads-indicator[notification="start"] > #downloads-indicator-anchor > #downloads-indicator-notification {
+  background-image: url("chrome://browser/skin/downloads/download-notification-start.png");
+  animation-name: downloadsIndicatorNotificationStartRight;
   animation-duration: 1s;
 }
 
-#downloads-indicator[notification]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
-  animation-name: downloadsIndicatorNotificationLeft;
+#downloads-indicator[notification="start"]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
+  animation-name: downloadsIndicatorNotificationStartLeft;
+}
+
+@keyframes downloadsIndicatorNotificationFinish {
+  from { opacity: 0; transform: scale(1); }
+  20%  { opacity: .65; animation-timing-function: ease-in; }
+  to   { opacity: 0; transform: scale(8); }
+}
+
+#downloads-indicator[notification="finish"] > #downloads-indicator-anchor > #downloads-indicator-notification {
+  background-image: url("chrome://browser/skin/downloads/download-notification-finish.png");
+  animation-name: downloadsIndicatorNotificationFinish;
+  animation-duration: 1s;
 }
 
 /*** Progress bar and text ***/
 
 #downloads-indicator-counter {
   height: 9px;
   margin: -3px 0px 0px 0px;
   color: hsl(0,0%,30%);
--- a/browser/themes/winstripe/jar.mn
+++ b/browser/themes/winstripe/jar.mn
@@ -58,17 +58,18 @@ browser.jar:
         skin/classic/browser/urlbar-popup-blocked.png
         skin/classic/browser/urlbar-history-dropmarker.png
         skin/classic/browser/webapps-16.png
         skin/classic/browser/webapps-64.png
         skin/classic/browser/webRTC-shareDevice-16.png
         skin/classic/browser/webRTC-shareDevice-64.png
         skin/classic/browser/downloads/buttons.png                   (downloads/buttons.png)
         skin/classic/browser/downloads/download-glow.png             (downloads/download-glow.png)
-        skin/classic/browser/downloads/download-notification.png     (downloads/download-notification.png)
+        skin/classic/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png)
+        skin/classic/browser/downloads/download-notification-start.png (downloads/download-notification-start.png)
         skin/classic/browser/downloads/download-summary.png          (downloads/download-summary.png)
 *       skin/classic/browser/downloads/downloads.css                 (downloads/downloads.css)
 *       skin/classic/browser/downloads/allDownloadsViewOverlay.css   (downloads/allDownloadsViewOverlay.css)
         skin/classic/browser/downloads/contentAreaDownloadsView.css  (downloads/contentAreaDownloadsView.css)
         skin/classic/browser/feeds/feedIcon.png                      (feeds/feedIcon.png)
         skin/classic/browser/feeds/feedIcon16.png                    (feeds/feedIcon16.png)
         skin/classic/browser/feeds/audioFeedIcon.png                 (feeds/feedIcon.png)
         skin/classic/browser/feeds/audioFeedIcon16.png               (feeds/feedIcon16.png)
@@ -279,17 +280,18 @@ browser.jar:
         skin/classic/aero/browser/urlbar-popup-blocked.png
         skin/classic/aero/browser/urlbar-history-dropmarker.png
         skin/classic/aero/browser/webapps-16.png
         skin/classic/aero/browser/webapps-64.png
         skin/classic/aero/browser/webRTC-shareDevice-16.png
         skin/classic/aero/browser/webRTC-shareDevice-64.png
         skin/classic/aero/browser/downloads/buttons.png              (downloads/buttons-aero.png)
         skin/classic/aero/browser/downloads/download-glow.png        (downloads/download-glow.png)
-        skin/classic/aero/browser/downloads/download-notification.png (downloads/download-notification.png)
+        skin/classic/aero/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png)
+        skin/classic/aero/browser/downloads/download-notification-start.png (downloads/download-notification-start.png)
         skin/classic/aero/browser/downloads/download-summary.png     (downloads/download-summary.png)
 *       skin/classic/aero/browser/downloads/downloads.css            (downloads/downloads-aero.css)
 *       skin/classic/aero/browser/downloads/allDownloadsViewOverlay.css (downloads/allDownloadsViewOverlay-aero.css)
         skin/classic/aero/browser/downloads/contentAreaDownloadsView.css (downloads/contentAreaDownloadsView.css)
         skin/classic/aero/browser/feeds/feedIcon.png                 (feeds/feedIcon-aero.png)
         skin/classic/aero/browser/feeds/feedIcon16.png               (feeds/feedIcon16-aero.png)
         skin/classic/aero/browser/feeds/audioFeedIcon.png            (feeds/feedIcon-aero.png)
         skin/classic/aero/browser/feeds/audioFeedIcon16.png          (feeds/feedIcon16-aero.png)
index 0c8eafda08acf20c21eeef8ae63cc6630590084b..df01b33515889863c9ef99d0daf650b13a104f2d
GIT binary patch
literal 233
zc%17D@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`8$4YcLn>~qy=={OC_#YbK_-i|
zw6}Ku3r-yoN0#|586As$FgXh7>e@C=-8;42<B%11bc=(>hwVSQBHLbyDLrE8K797*
ze>NvCk0O<8jVps@Gt}3I8hSRK*i~9}gZINWaaC2*ms3w2$f*qrx}-k2@#Lo^Puvd}
zSZMteH26^N<yDn#bm6<1msi#W<Ef4JN|q{3VwzZ*U9w&Jf^2)1pP^^p4J!lDEWrzs
gtbQ^3FV;Tbo^!wTieY|G3()Nhp00i_>zopr0MXD}761SM
index a1a51b8d8f580a7c97b449aed9ae60207a6a5373..d125789fbce71eff4c4d5af890dd5ed6a862c50e
GIT binary patch
literal 1097
zc$@)A1h)H$P)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF000CKNkl<Zc-rln
zO-NKx7>2J<M35Cx;G$Iv>1WX@+|)K&xHF<fD~V{Kjzl>A>p1?8qvQBHo1st`+_Vs4
zCZR<Vf(#^5x-<g8n83)A%;|P}-<W|*I-WB_I>*~tJZR&5_rBkA&pr3tLxyEp|20~G
z7N7-a0a}0-pap0FT0pL}wzlRIEnvR{@Zcrw?d`GN-rjG0eSMbS?>|s@PMrIz*Xw<b
zEY}WF01tc*0g@vlBi8u%xD^V8@&eDz49tQ|cXJfL@0|p<K&enbOH0cYnBN{99c2I|
zU>0QBLbhUH*bp_(@053UcW?Cf_gftu9hOi)S65eLXlRHhRtjWd1Cx>h__qS!VdJTb
z$&n-$fG>UGup1j2QwnDC`Fx4y=4QjjZq4)aqZsbtfq?-w&w9dou>cG;Q?cgl4VVG}
z{H(C8t?fl15U@8dFQBKVhlNVQY)wr~h7Egm{<{cIt~Y3&BW6cEF0RxFP*wo4WfH*O
zFJb=rFgQ54SH08-pgkpFw#LRr!v-_+=XEr{j^;)6VgYz$Si{4^N`h=V1b{MpzJ=yx
z>K!M*g{x`?gF)GPsdWIKxk|!p4Gj$jC_wXm-qX19+0=^#bar-HFsdZHhwJO>k72@_
zN;RKVJ$gIb0<fy%Fn)#Sxv2Tv1z@?!gDVN1?`d+WmwOk$LV_o7B<M{}0M^h>L<^7-
zfE^f4HjV_ni3Q+Iid#~S1igs`csw3%95@p6CKSN^Grl)F67;48$ZU%8z1fkVH=zJ-
zDRIs1NYI;50C!fn-c}L5&2c@?pE=c|x5F)f&+%|L9LK#(3Hu^|n+!a-ilm2d>BPju
zOWe<Vxyh;?y$J<yvw_1*Ntms=x|%s}Oixcg!xjCBQISo(lmMDllC*%7gsZc&vriyl
z3oAUCdglnRNw~1MxERFkuz^+HzY%~fC%!c)3A4FeF2e>h7p<(UcrgkR5W$IZuX?e7
zy1F_ZL`j&fs;bJck<NW8kw`qoME9OEJ!E967YnGZtyNY4vSkuLj&E*m-p6b2JIwZ!
zkh1`j#R|d(%*x72!^YqFkC>);Clm_JVYqYcZ?C67sfEzzRH0HJ6W0Oj0s*7|+>Asb
zQAqfOy6gmC>u8Qc2(zkEFcY%9uBfOmY%p^sN}|!|6q-&#+@E8(-EOgfcs%|9McbHB
zm1&+?km<+5!a{i#0?6h0`S}p)Ki1UL@DVB$K+eQsu}KspX&v?$ATRLT$iOR?oSB(<
zifpH|6hO{{hihwVzSY%Lzl;EKacOBOh;5{|SUh~e<nuir@Z8L>yu2JhreZdnQGl2e
zpiou-IR|coN5GvYc<wTAmd);h{=dRnfEJ(yXaQP)7N7-a0a}0-kQ=`NqXz$3vl*3;
P00000NkvXXu0mjfSQP=H
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -402,16 +402,17 @@ user_pref("test.mousescroll", true);
 user_pref("security.default_personal_cert", "Select Automatically"); // Need to client auth test be w/o any dialogs
 user_pref("network.http.prompt-temp-redirect", false);
 user_pref("media.cache_size", 100);
 user_pref("security.warn_viewing_mixed", false);
 user_pref("app.update.enabled", false);
 user_pref("app.update.staging.enabled", false);
 user_pref("browser.panorama.experienced_first_run", true); // Assume experienced
 user_pref("dom.w3c_touch_events.enabled", 1);
+user_pref("dom.undo_manager.enabled", true);
 // Set a future policy version to avoid the telemetry prompt.
 user_pref("toolkit.telemetry.prompted", 999);
 user_pref("toolkit.telemetry.notifiedOptOut", 999);
 // Existing tests assume there is no font size inflation.
 user_pref("font.size.inflation.emPerLine", 0);
 user_pref("font.size.inflation.minTwips", 0);
 
 // Only load extensions from the application and user profile
--- a/configure.in
+++ b/configure.in
@@ -2199,17 +2199,20 @@ ia64*-hpux*)
         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
         # MSVC warning C4800 warns when a value is implicitly cast to bool,
         # because this also forces narrowing to a single byte, which can be a
         # perf hit.  But this matters so little in practice (and often we want
         # that behavior) that it's better to turn it off.
-        CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800"
+        # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
+        # on non-Western system locales even if it is in a comment.
+        CFLAGS="$CFLAGS -wd4819"
+        CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800 -wd4819"
         # make 'foo == bar;' error out
         CFLAGS="$CFLAGS -we4553"
         CXXFLAGS="$CXXFLAGS -we4553"
         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
         MOZ_DEBUG_FLAGS='-Zi'
         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
         WARNINGS_AS_ERRORS='-WX'
         MOZ_OPTIMIZE_FLAGS='-O1'
new file mode 100644
--- /dev/null
+++ b/content/base/crashtests/815043.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body onload="document.getElementById('x').dir = '';">
+
+<div><bdi><bdi id="x"><span></span></bdi></bdi></div>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/content/base/crashtests/815276.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body onload="((new DOMParser).parseFromString('<x/>', 'text/xml')).adoptNode(document.getElementById('v'));">
+<div id="v"><bdi>x</bdi></div>
+</body>
+</html>
--- a/content/base/crashtests/crashtests.list
+++ b/content/base/crashtests/crashtests.list
@@ -111,13 +111,15 @@ load 715056.html
 load 741163-1.html
 load 766426.html
 load 771639.html
 load 752226-1.html
 load 752226-2.html
 HTTP(..) load xhr_abortinprogress.html
 load 786854.html
 load xhr_empty_datauri.html
+load 815043.html
+load 815276.html
 load 815477.html
 load 815500.html
 load 816253.html
 load 822691.html
 load 822723.html
--- a/content/base/public/DirectionalityUtils.h
+++ b/content/base/public/DirectionalityUtils.h
@@ -74,24 +74,16 @@ void WalkDescendantsSetDirAuto(mozilla::
 /**
  * After unsetting dir=auto on an element, walk its descendants in tree order,
  * skipping any that have dir=auto themselves, and unset the
  * NODE_ANCESTOR_HAS_DIR_AUTO flag
  */
 void WalkDescendantsClearAncestorDirAuto(mozilla::dom::Element* aElement);
 
 /**
- * Walk the parent chain of a text node whose dir attribute has been removed and
- * reset the direction of any of its ancestors which have dir=auto and whose
- * directionality is determined by a text node descendant.
- */
-void WalkAncestorsResetAutoDirection(mozilla::dom::Element* aElement,
-                                     bool aNotify = true);
-
-/**
  * When the contents of a text node have changed, deal with any elements whose
  * directionality needs to change
  */
 void SetDirectionFromChangedTextNode(nsIContent* aTextNode, uint32_t aOffset,
                                      const PRUnichar* aBuffer, uint32_t aLength,
                                      bool aNotify);
 
 /**
@@ -122,11 +114,24 @@ void SetDirectionalityFromValue(mozilla:
  * and in BeforeSetAttr we can't do the walk because this element hasn't had the
  * value set yet so the results will be wrong.
  */
 void OnSetDirAttr(mozilla::dom::Element* aElement,
                   const nsAttrValue* aNewValue,
                   bool hadValidDir,
                   bool aNotify);
 
+/**
+ * Called when binding a new element to the tree, to set the
+ * NodeAncestorHasDirAuto flag and set the direction of the element and its
+ * ancestors if necessary
+ */
+void SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent);
+
+/**
+ * Called when unbinding an element from the tree, to recompute the
+ * directionality of the element if it doesn't have autodirection, and to
+ * clean up any entries in nsTextDirectionalityMap that refer to it.
+ */
+void ResetDir(mozilla::dom::Element* aElement);
 } // end namespace mozilla
 
 #endif /* DirectionalityUtils_h___ */
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -111,16 +111,17 @@ enum {
 };
 
 #undef ELEMENT_FLAG_BIT
 
 namespace mozilla {
 namespace dom {
 
 class Link;
+class UndoManager;
 
 // IID for the dom::Element interface
 #define NS_ELEMENT_IID \
 { 0xc6c049a1, 0x96e8, 0x4580, \
   { 0xa6, 0x93, 0xb9, 0x5f, 0x53, 0xbe, 0xe8, 0x1c } }
 
 class Element : public FragmentOrElement
 {
@@ -690,16 +691,31 @@ public:
   }
   int32_t ScrollLeftMax()
   {
     nsIScrollableFrame* sf = GetScrollFrame();
     return sf ?
            nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().XMost()) :
            0;
   }
+
+  virtual already_AddRefed<mozilla::dom::UndoManager> GetUndoManager()
+  {
+    return nullptr;
+  }
+
+  virtual bool UndoScope()
+  {
+    return false;
+  }
+
+  virtual void SetUndoScope(bool aUndoScope, mozilla::ErrorResult& aError)
+  {
+  }
+
   virtual void GetInnerHTML(nsAString& aInnerHTML,
                             mozilla::ErrorResult& aError);
   virtual void SetInnerHTML(const nsAString& aInnerHTML,
                             mozilla::ErrorResult& aError);
   void GetOuterHTML(nsAString& aOuterHTML, mozilla::ErrorResult& aError);
   void SetOuterHTML(const nsAString& aOuterHTML, mozilla::ErrorResult& aError);
   void InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
                           mozilla::ErrorResult& aError);
--- a/content/base/public/FragmentOrElement.h
+++ b/content/base/public/FragmentOrElement.h
@@ -161,16 +161,18 @@ class nsInlineEventHandlersTearoff;
 
 /**
  * A generic base class for DOM elements, implementing many nsIContent,
  * nsIDOMNode and nsIDOMElement methods.
  */
 namespace mozilla {
 namespace dom {
 
+class UndoManager;
+
 class FragmentOrElement : public nsIContent
 {
 public:
   FragmentOrElement(already_AddRefed<nsINodeInfo> aNodeInfo);
   virtual ~FragmentOrElement();
 
   friend class ::nsTouchEventReceiverTearoff;
   friend class ::nsInlineEventHandlersTearoff;
@@ -308,16 +310,22 @@ public:
 
     /**
      * The .dataset attribute.
      * @see nsGenericHTMLElement::GetDataset
      */
     nsDOMStringMap* mDataset; // [Weak]
 
     /**
+     * The .undoManager property.
+     * @see nsGenericHTMLElement::GetUndoManager
+     */
+    nsRefPtr<UndoManager> mUndoManager;
+
+    /**
      * SMIL Overridde style rules (for SMIL animation of CSS properties)
      * @see nsIContent::GetSMILOverrideStyle
      */
     nsCOMPtr<nsICSSDeclaration> mSMILOverrideStyle;
 
     /**
      * Holds any SMIL override style rules for this element.
      */
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -60,17 +60,17 @@ class nsIObserver;
 class nsIPresShell;
 class nsIPrincipal;
 class nsIRequest;
 class nsIStreamListener;
 class nsIStyleRule;
 class nsIStyleSheet;
 class nsIURI;
 class nsIVariant;
-class nsIViewManager;
+class nsViewManager;
 class nsPresContext;
 class nsRange;
 class nsScriptLoader;
 class nsSMILAnimationController;
 class nsStyleSet;
 class nsTextNode;
 class nsWindowSizes;
 class nsSmallVoidArray;
@@ -85,16 +85,17 @@ class ImageLoader;
 
 namespace dom {
 class Comment;
 class DocumentFragment;
 class DocumentType;
 class DOMImplementation;
 class Element;
 class Link;
+class UndoManager;
 template<typename> class Sequence;
 } // namespace dom
 } // namespace mozilla
 
 #define NS_IDOCUMENT_IID \
 { 0xff03d72f, 0x87cd, 0x4d11, \
  { 0x81, 0x8d, 0xa8, 0xb4, 0xf5, 0x98, 0x1a, 0x10 } }
 
@@ -472,17 +473,17 @@ public:
   /**
    * Create a new presentation shell that will use aContext for its
    * presentation context (presentation contexts <b>must not</b> be
    * shared among multiple presentation shells). The caller of this
    * method is responsible for calling BeginObservingDocument() on the
    * presshell if the presshell should observe document mutations.
    */
   virtual nsresult CreateShell(nsPresContext* aContext,
-                               nsIViewManager* aViewManager,
+                               nsViewManager* aViewManager,
                                nsStyleSet* aStyleSet,
                                nsIPresShell** aInstancePtrResult) = 0;
   virtual void DeleteShell() = 0;
 
   nsIPresShell* GetShell() const
   {
     return GetBFCacheEntry() ? nullptr : mPresShell;
   }
@@ -1642,16 +1643,18 @@ public:
    * Lookup an image element using its associated ID, which is usually provided
    * by |-moz-element()|. Similar to GetElementById, with the difference that
    * elements set using mozSetImageElement have higher priority.
    * @param aId the ID associated the element we want to lookup
    * @return the element associated with |aId|
    */
   virtual Element* LookupImageElement(const nsAString& aElementId) = 0;
 
+  virtual already_AddRefed<mozilla::dom::UndoManager> GetUndoManager() = 0;
+
   nsresult ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback,
                                         int32_t *aHandle);
   void CancelFrameRequestCallback(int32_t aHandle);
 
   typedef nsTArray< nsCOMPtr<nsIFrameRequestCallback> > FrameRequestCallbackList;
   /**
    * Put this document's frame request callbacks into the provided
    * list, and forget about them.
--- a/content/base/src/Comment.cpp
+++ b/content/base/src/Comment.cpp
@@ -4,17 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Implementations of DOM Core's nsIDOMComment node.
  */
 
 #include "nsCOMPtr.h"
 #include "mozilla/dom/Element.h" // DOMCI_NODE_DATA
-#include "Comment.h"
+#include "mozilla/dom/Comment.h"
+#include "mozilla/dom/CommentBinding.h"
 
 using namespace mozilla;
 using namespace dom;
 
 // DOMCI_NODE_DATA needs to be outside our namespaces
 DOMCI_NODE_DATA(Comment, Comment)
 
 nsresult
@@ -36,23 +37,16 @@ NS_NewCommentNode(nsIContent** aInstance
   NS_ADDREF(*aInstancePtrResult = instance);
 
   return NS_OK;
 }
 
 namespace mozilla {
 namespace dom {
 
-Comment::Comment(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericDOMDataNode(aNodeInfo)
-{
-  NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
-                    "Bad NodeType in aNodeInfo");
-}
-
 Comment::~Comment()
 {
 }
 
 // QueryInterface implementation for Comment
 NS_INTERFACE_TABLE_HEAD(Comment)
   NS_NODE_INTERFACE_TABLE3(Comment, nsIDOMNode, nsIDOMCharacterData,
                            nsIDOMComment)
@@ -94,10 +88,16 @@ Comment::List(FILE* out, int32_t aIndent
   nsAutoString tmp;
   ToCString(tmp, 0, mText.GetLength());
   fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
 
   fputs("-->\n", out);
 }
 #endif
 
+JSObject*
+Comment::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return CommentBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/content/base/src/Comment.h
+++ b/content/base/src/Comment.h
@@ -1,24 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifndef mozilla_dom_Comment_h
+#define mozilla_dom_Comment_h
+
 #include "nsIDOMComment.h"
 #include "nsGenericDOMDataNode.h"
 
 namespace mozilla {
 namespace dom {
 
 class Comment : public nsGenericDOMDataNode,
                 public nsIDOMComment
 {
 public:
-  Comment(already_AddRefed<nsINodeInfo> aNodeInfo);
+  Comment(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : nsGenericDOMDataNode(aNodeInfo)
+  {
+    NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
+                      "Bad NodeType in aNodeInfo");
+    SetIsDOMBinding();
+  }
   virtual ~Comment();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
@@ -40,13 +49,18 @@ public:
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const;
   virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0,
                            bool aDumpAll = true) const
   {
     return;
   }
 #endif
+
+protected:
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap) MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
+#endif // mozilla_dom_Comment_h
--- a/content/base/src/DirectionalityUtils.cpp
+++ b/content/base/src/DirectionalityUtils.cpp
@@ -429,16 +429,19 @@ WalkDescendantsSetDirectionFromText(Elem
 }
 
 class nsTextNodeDirectionalityMap
 {
   static void
   nsTextNodeDirectionalityMapDtor(void *aObject, nsIAtom* aPropertyName,
                                   void *aPropertyValue, void* aData)
   {
+    nsINode* textNode = static_cast<nsINode * >(aObject);
+    textNode->ClearHasTextNodeDirectionalityMap();
+
     nsTextNodeDirectionalityMap* map =
       reinterpret_cast<nsTextNodeDirectionalityMap * >(aPropertyValue);
     delete map;
   }
 
 public:
   nsTextNodeDirectionalityMap(nsINode* aTextNode)
   {
@@ -561,23 +564,16 @@ public:
   }
 };
 
 Directionality
 RecomputeDirectionality(Element* aElement, bool aNotify)
 {
   MOZ_ASSERT(!aElement->HasDirAuto(),
              "RecomputeDirectionality called with dir=auto");
-  if (aElement->HasDirAutoSet()) {
-    nsINode* setByNode =
-      static_cast<nsINode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
-    if (setByNode) {
-      nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
-    }
-  }
 
   Directionality dir = eDir_LTR;
 
   if (aElement->HasValidDir()) {
     dir = aElement->GetDirectionality();
   } else {
     Element* parent = aElement->GetElementParent();
     if (parent) {
@@ -618,16 +614,21 @@ SetDirectionalityOnDescendants(Element* 
       child = child->GetNextNonChildNode(aElement);
       continue;
     }
     element->SetDirectionality(aDir, aNotify);
     child = child->GetNextNode(aElement);
   }
 }
 
+/**
+ * Walk the parent chain of a text node whose dir attribute has been removed and
+ * reset the direction of any of its ancestors which have dir=auto and whose
+ * directionality is determined by a text node descendant.
+ */
 void
 WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
 {
   nsINode* setByNode;
   Element* parent = aElement->GetElementParent();
 
   while (parent && parent->NodeOrAncestorHasDirAuto()) {
     if (parent->HasDirAutoSet()) {
@@ -888,10 +889,48 @@ OnSetDirAttr(Element* aElement, const ns
     WalkDescendantsSetDirAuto(aElement, aNotify);
   } else {
     SetDirectionalityOnDescendants(aElement,
                                    RecomputeDirectionality(aElement, aNotify),
                                    aNotify);
   }
 }
 
+void
+SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent)
+{
+  // Set the AncestorHasDirAuto flag, unless this element shouldn't affect
+  // ancestors that have dir=auto
+  if (!DoesNotParticipateInAutoDirection(aElement) &&
+      !aElement->IsHTML(nsGkAtoms::bdi) &&
+      aParent && aParent->NodeOrAncestorHasDirAuto()) {
+    aElement->SetAncestorHasDirAuto();
+
+    // if we are binding an element to the tree that already has descendants,
+    // and the parent has NodeHasDirAuto or NodeAncestorHasDirAuto, we may
+    // need to reset the direction of an ancestor with dir=auto
+    if (aElement->GetFirstChild()) {
+      WalkAncestorsResetAutoDirection(aElement, true);
+    }
+  }
+
+  if (!aElement->HasDirAuto()) {
+    // if the element doesn't have dir=auto, set its own directionality from
+    // the dir attribute or by inheriting from its ancestors.
+    RecomputeDirectionality(aElement, false);
+  }
+}
+
+void ResetDir(mozilla::dom::Element* aElement)
+{
+  if (aElement->HasDirAutoSet()) {
+    nsINode* setByNode =
+      static_cast<nsINode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
+    nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
+  }
+
+  if (!aElement->HasDirAuto()) {
+    RecomputeDirectionality(aElement, false);
+  }
+}
+
 } // end namespace mozilla
 
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -89,17 +89,17 @@
 #include "nsGenericHTMLElement.h"
 #include "nsIEditor.h"
 #include "nsIEditorIMESupport.h"
 #include "nsIEditorDocShell.h"
 #include "nsEventDispatcher.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsIControllers.h"
 #include "nsView.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsXBLInsertionPoint.h"
 #include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
 #include "nsCSSRuleProcessor.h"
 #include "nsRuleProcessorData.h"
 #include "nsAsyncDOMEvent.h"
 #include "nsTextNode.h"
 
@@ -1155,35 +1155,21 @@ Element::BindToTree(nsIDocument* aDocume
                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());
   }
 
-  // This has to be here, rather than in nsGenericHTMLElement::BindToTree, 
+  // This has to be here, rather than in nsGenericHTMLElement::BindToTree,
   //  because it has to happen after updating the parent pointer, but before
   //  recursively binding the kids.
   if (IsHTML()) {
-    if (aParent && aParent->NodeOrAncestorHasDirAuto()) {
-      SetAncestorHasDirAuto();
-      // if we are binding an element to the tree that already has descendants,
-      // and the parent has NodeHasDirAuto or NodeAncestorHasDirAuto, we may
-      // need to reset the direction of an ancestor with dir=auto
-      if (GetFirstChild()) {
-        WalkAncestorsResetAutoDirection(this);
-      }
-    }
-
-    if (!HasDirAuto()) {
-      // if the element doesn't have dir=auto, set its directionality from
-      // the dir attribute or by inheriting from its ancestors.
-      RecomputeDirectionality(this, false);
-    }
+    SetDirOnBind(this, aParent);
   }
 
   // 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();
 
@@ -1364,18 +1350,18 @@ Element::UnbindFromTree(bool aDeep, bool
     if (slots) {
       slots->mBindingParent = nullptr;
     }
   }
 
   // This has to be here, rather than in nsGenericHTMLElement::UnbindFromTree, 
   //  because it has to happen after unsetting the parent pointer, but before
   //  recursively unbinding the kids.
-  if (IsHTML() && !HasDirAuto()) {
-    RecomputeDirectionality(this, false);
+  if (IsHTML()) {
+    ResetDir(this);
   }
 
   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.
     uint32_t i, n = mAttrsAndChildren.ChildCount();
 
--- a/content/base/src/FragmentOrElement.cpp
+++ b/content/base/src/FragmentOrElement.cpp
@@ -88,24 +88,25 @@
 #include "nsGenericHTMLElement.h"
 #include "nsIEditor.h"
 #include "nsIEditorIMESupport.h"
 #include "nsIEditorDocShell.h"
 #include "nsEventDispatcher.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsIControllers.h"
 #include "nsView.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsXBLInsertionPoint.h"
 #include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
 #include "nsRuleProcessorData.h"
 #include "nsAsyncDOMEvent.h"
 #include "nsTextNode.h"
 #include "mozilla/dom/NodeListBinding.h"
+#include "mozilla/dom/UndoManager.h"
 
 #ifdef MOZ_XUL
 #include "nsIXULDocument.h"
 #endif /* MOZ_XUL */
 
 #include "nsCycleCollectionParticipant.h"
 #include "nsCCUncollectableMarker.h"
 
@@ -534,16 +535,17 @@ NS_INTERFACE_MAP_END_AGGREGATED(mElement
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsInlineEventHandlersTearoff)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsInlineEventHandlersTearoff)
 
 //----------------------------------------------------------------------
 FragmentOrElement::nsDOMSlots::nsDOMSlots()
   : nsINode::nsSlots(),
     mDataset(nullptr),
+    mUndoManager(nullptr),
     mBindingParent(nullptr)
 {
 }
 
 FragmentOrElement::nsDOMSlots::~nsDOMSlots()
 {
   if (mAttributeMap) {
     mAttributeMap->DropReference();
@@ -561,16 +563,19 @@ FragmentOrElement::nsDOMSlots::Traverse(
   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());
 
+  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mUndoManager");
+  cb.NoteXPCOMChild(mUndoManager.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));
 
@@ -585,16 +590,17 @@ FragmentOrElement::nsDOMSlots::Unlink(bo
   mSMILOverrideStyle = nullptr;
   if (mAttributeMap) {
     mAttributeMap->DropReference();
     mAttributeMap = nullptr;
   }
   if (aIsXUL)
     NS_IF_RELEASE(mControllers);
   mChildrenList = nullptr;
+  mUndoManager = nullptr;
   if (mClassList) {
     mClassList->DropReference();
     mClassList = nullptr;
   }
 }
 
 size_t
 FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
--- a/content/base/src/Link.cpp
+++ b/content/base/src/Link.cpp
@@ -136,43 +136,42 @@ Link::GetURI() const
   // We want to cache the URI if we have it
   if (uri) {
     mCachedURI = uri;
   }
 
   return uri.forget();
 }
 
-nsresult
+void
 Link::SetProtocol(const nsAString &aProtocol)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   if (!uri) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   nsAString::const_iterator start, end;
   aProtocol.BeginReading(start);
   aProtocol.EndReading(end);
   nsAString::const_iterator iter(start);
   (void)FindCharInReadable(':', iter, end);
   (void)uri->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)));
 
   SetHrefAttribute(uri);
-  return NS_OK;
 }
 
-nsresult
+void
 Link::SetHost(const nsAString &aHost)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   if (!uri) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   // We cannot simply call nsIURI::SetHost because that would treat the name as
   // an IPv6 address (like http:://[server:443]/).  We also cannot call
   // nsIURI::SetHostPort because that isn't implemented.  Sadfaces.
 
   // First set the hostname.
   nsAString::const_iterator start, end;
@@ -192,238 +191,228 @@ Link::SetHost(const nsAString &aHost)
       int32_t port = portStr.ToInteger(&rv);
       if (NS_SUCCEEDED(rv)) {
         (void)uri->SetPort(port);
       }
     }
   };
 
   SetHrefAttribute(uri);
-  return NS_OK;
+  return;
 }
 
-nsresult
+void
 Link::SetHostname(const nsAString &aHostname)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   if (!uri) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   (void)uri->SetHost(NS_ConvertUTF16toUTF8(aHostname));
   SetHrefAttribute(uri);
-  return NS_OK;
 }
 
-nsresult
+void
 Link::SetPathname(const nsAString &aPathname)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
   if (!url) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   (void)url->SetFilePath(NS_ConvertUTF16toUTF8(aPathname));
   SetHrefAttribute(uri);
-  return NS_OK;
 }
 
-nsresult
+void
 Link::SetSearch(const nsAString &aSearch)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
   if (!url) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   (void)url->SetQuery(NS_ConvertUTF16toUTF8(aSearch));
   SetHrefAttribute(uri);
-  return NS_OK;
 }
 
-nsresult
+void
 Link::SetPort(const nsAString &aPort)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   if (!uri) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   nsresult rv;
   nsAutoString portStr(aPort);
   int32_t port = portStr.ToInteger(&rv);
   if (NS_FAILED(rv)) {
-    return NS_OK;
+    return;
   }
 
   (void)uri->SetPort(port);
   SetHrefAttribute(uri);
-  return NS_OK;
 }
 
-nsresult
+void
 Link::SetHash(const nsAString &aHash)
 {
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   if (!uri) {
     // Ignore failures to be compatible with NS4.
-    return NS_OK;
+    return;
   }
 
   (void)uri->SetRef(NS_ConvertUTF16toUTF8(aHash));
   SetHrefAttribute(uri);
-  return NS_OK;
 }
 
-nsresult
+void
 Link::GetProtocol(nsAString &_protocol)
 {
   nsCOMPtr<nsIURI> uri(GetURI());
   if (!uri) {
     _protocol.AssignLiteral("http");
   }
   else {
     nsAutoCString scheme;
     (void)uri->GetScheme(scheme);
     CopyASCIItoUTF16(scheme, _protocol);
   }
   _protocol.Append(PRUnichar(':'));
-  return NS_OK;
+  return;
 }
 
-nsresult
+void
 Link::GetHost(nsAString &_host)
 {
   _host.Truncate();
 
   nsCOMPtr<nsIURI> uri(GetURI());
   if (!uri) {
     // Do not throw!  Not having a valid URI should result in an empty string.
-    return NS_OK;
+    return;
   }
 
   nsAutoCString hostport;
   nsresult rv = uri->GetHostPort(hostport);
   if (NS_SUCCEEDED(rv)) {
     CopyUTF8toUTF16(hostport, _host);
   }
-  return NS_OK;
 }
 
-nsresult
+void
 Link::GetHostname(nsAString &_hostname)
 {
   _hostname.Truncate();
 
   nsCOMPtr<nsIURI> uri(GetURI());
   if (!uri) {
     // Do not throw!  Not having a valid URI should result in an empty string.
-    return NS_OK;
+    return;
   }
 
   nsAutoCString host;
   nsresult rv = uri->GetHost(host);
   // Note that failure to get the host from the URI is not necessarily a bad
   // thing.  Some URIs do not have a host.
   if (NS_SUCCEEDED(rv)) {
     CopyUTF8toUTF16(host, _hostname);
   }
-  return NS_OK;
 }
 
-nsresult
+void
 Link::GetPathname(nsAString &_pathname)
 {
   _pathname.Truncate();
 
   nsCOMPtr<nsIURI> uri(GetURI());
   nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
   if (!url) {
     // Do not throw!  Not having a valid URI or URL should result in an empty
     // string.
-    return NS_OK;
+    return;
   }
 
   nsAutoCString file;
   nsresult rv = url->GetFilePath(file);
-  NS_ENSURE_SUCCESS(rv, rv);
-  CopyUTF8toUTF16(file, _pathname);
-  return NS_OK;
+  if (NS_SUCCEEDED(rv)) {
+    CopyUTF8toUTF16(file, _pathname);
+  }
 }
 
-nsresult
+void
 Link::GetSearch(nsAString &_search)
 {
   _search.Truncate();
 
   nsCOMPtr<nsIURI> uri(GetURI());
   nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
   if (!url) {
     // Do not throw!  Not having a valid URI or URL should result in an empty
     // string.
-    return NS_OK;
+    return;
   }
 
   nsAutoCString search;
   nsresult rv = url->GetQuery(search);
   if (NS_SUCCEEDED(rv) && !search.IsEmpty()) {
     CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, _search);
   }
-  return NS_OK;
 }
 
-nsresult
+void
 Link::GetPort(nsAString &_port)
 {
   _port.Truncate();
 
   nsCOMPtr<nsIURI> uri(GetURI());
   if (!uri) {
     // Do not throw!  Not having a valid URI should result in an empty string.
-    return NS_OK;
+    return;
   }
 
   int32_t port;
   nsresult rv = uri->GetPort(&port);
   // Note that failure to get the port from the URI is not necessarily a bad
   // thing.  Some URIs do not have a port.
   if (NS_SUCCEEDED(rv) && port != -1) {
     nsAutoString portStr;
     portStr.AppendInt(port, 10);
     _port.Assign(portStr);
   }
-  return NS_OK;
 }
 
-nsresult
+void
 Link::GetHash(nsAString &_hash)
 {
   _hash.Truncate();
 
   nsCOMPtr<nsIURI> uri(GetURI());
   if (!uri) {
     // Do not throw!  Not having a valid URI should result in an empty
     // string.
-    return NS_OK;
+    return;
   }
 
   nsAutoCString ref;
   nsresult rv = uri->GetRef(ref);
   if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) {
     NS_UnescapeURL(ref); // XXX may result in random non-ASCII bytes!
     _hash.Assign(PRUnichar('#'));
     AppendUTF8toUTF16(ref, _hash);
   }
-  return NS_OK;
 }
 
 void
 Link::ResetLinkState(bool aNotify, bool aHasHref)
 {
   nsLinkState defaultState;
 
   // The default state for links with an href is unvisited.
--- a/content/base/src/Link.h
+++ b/content/base/src/Link.h
@@ -48,30 +48,30 @@ public:
   already_AddRefed<nsIURI> GetURI() const;
   virtual already_AddRefed<nsIURI> GetURIExternal() const {
     return GetURI();
   }
 
   /**
    * Helper methods for modifying and obtaining parts of the URI of the Link.
    */
-  nsresult SetProtocol(const nsAString &aProtocol);
-  nsresult SetHost(const nsAString &aHost);
-  nsresult SetHostname(const nsAString &aHostname);
-  nsresult SetPathname(const nsAString &aPathname);
-  nsresult SetSearch(const nsAString &aSearch);
-  nsresult SetPort(const nsAString &aPort);
-  nsresult SetHash(const nsAString &aHash);
-  nsresult GetProtocol(nsAString &_protocol);
-  nsresult GetHost(nsAString &_host);
-  nsresult GetHostname(nsAString &_hostname);
-  nsresult GetPathname(nsAString &_pathname);
-  nsresult GetSearch(nsAString &_search);
-  nsresult GetPort(nsAString &_port);
-  nsresult GetHash(nsAString &_hash);
+  void SetProtocol(const nsAString &aProtocol);
+  void SetHost(const nsAString &aHost);
+  void SetHostname(const nsAString &aHostname);
+  void SetPathname(const nsAString &aPathname);
+  void SetSearch(const nsAString &aSearch);
+  void SetPort(const nsAString &aPort);
+  void SetHash(const nsAString &aHash);
+  void GetProtocol(nsAString &_protocol);
+  void GetHost(nsAString &_host);
+  void GetHostname(nsAString &_hostname);
+  void GetPathname(nsAString &_pathname);
+  void GetSearch(nsAString &_search);
+  void GetPort(nsAString &_port);
+  void GetHash(nsAString &_hash);
 
   /**
    * Invalidates any link caching, and resets the state to the default.
    *
    * @param aNotify
    *        true if ResetLinkState should notify the owning document about style
    *        changes or false if it should not.
    */
--- a/content/base/src/nsAttrValue.cpp
+++ b/content/base/src/nsAttrValue.cpp
@@ -25,43 +25,42 @@
 #include "nsStyledElement.h"
 
 using namespace mozilla;
 
 #define MISC_STR_PTR(_cont) \
   reinterpret_cast<void*>((_cont)->mStringBits & NS_ATTRVALUE_POINTERVALUE_MASK)
 
 bool
-MiscContainer::GetString(nsDependentString& aString) const
+MiscContainer::GetString(nsAString& aString) const
 {
   void* ptr = MISC_STR_PTR(this);
 
   if (!ptr) {
     return false;
   }
 
   if (static_cast<nsAttrValue::ValueBaseType>(mStringBits &
                                               NS_ATTRVALUE_BASETYPE_MASK) ==
       nsAttrValue::eStringBase) {
     nsStringBuffer* buffer = static_cast<nsStringBuffer*>(ptr);
     if (!buffer) {
       return false;
     }
 
-    aString.Rebind(reinterpret_cast<PRUnichar*>(buffer->Data()),
-                   buffer->StorageSize() / sizeof(PRUnichar) - 1);
+    buffer->ToString(buffer->StorageSize() / sizeof(PRUnichar) - 1, aString);
     return true;
   }
 
   nsIAtom* atom = static_cast<nsIAtom*>(ptr);
   if (!atom) {
     return false;
   }
 
-  aString.Rebind(atom->GetUTF16String(), atom->GetLength());
+  atom->ToString(aString);
   return true;
 }
 
 void
 MiscContainer::Cache()
 {
   // Not implemented for anything else yet.
   MOZ_ASSERT(mType == nsAttrValue::eCSSStyleRule);
@@ -70,17 +69,17 @@ MiscContainer::Cache()
   MOZ_ASSERT(!mValue.mCached);
 
   css::StyleRule* rule = mValue.mCSSStyleRule;
   nsHTMLCSSStyleSheet* sheet = rule->GetHTMLCSSStyleSheet();
   if (!sheet) {
     return;
   }
 
-  nsDependentString str;
+  nsString str;
   bool gotString = GetString(str);
   if (!gotString) {
     return;
   }
 
   sheet->CacheStyleAttr(str, this);
   mValue.mCached = 1;
 
@@ -102,17 +101,17 @@ MiscContainer::Evict()
   if (!mValue.mCached) {
     return;
   }
 
   css::StyleRule* rule = mValue.mCSSStyleRule;
   nsHTMLCSSStyleSheet* sheet = rule->GetHTMLCSSStyleSheet();
   MOZ_ASSERT(sheet);
 
-  nsDependentString str;
+  nsString str;
   DebugOnly<bool> gotString = GetString(str);
   MOZ_ASSERT(gotString);
 
   sheet->EvictStyleAttr(str, this);
   mValue.mCached = 0;
 }
 
 nsTArray<const nsAttrValue::EnumTable*>* nsAttrValue::sEnumTableArray = nullptr;
@@ -573,19 +572,17 @@ nsAttrValue::SwapValueWith(nsAttrValue& 
 
 void
 nsAttrValue::ToString(nsAString& aResult) const
 {
   MiscContainer* cont = nullptr;
   if (BaseType() == eOtherBase) {
     cont = GetMiscContainer();
 
-    nsDependentString str;
-    if (cont->GetString(str)) {
-      aResult = str;
+    if (cont->GetString(aResult)) {
       return;
     }
   }
 
   switch(Type()) {
     case eString:
     {
       nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
--- a/content/base/src/nsAttrValueInlines.h
+++ b/content/base/src/nsAttrValueInlines.h
@@ -62,17 +62,17 @@ struct MiscContainer
   {
     if (IsRefCounted()) {
       MOZ_ASSERT(mValue.mRefCount == 0);
       MOZ_ASSERT(!mValue.mCached);
     }
     MOZ_COUNT_DTOR(MiscContainer);
   }
 
-  bool GetString(nsDependentString& aString) const;
+  bool GetString(nsAString& aString) const;
 
   inline bool IsRefCounted() const
   {
     // Nothing stops us from refcounting (and sharing) other types of
     // MiscContainer (except eDoubleValue types) but there's no compelling
     // reason to 
     return mType == nsAttrValue::eCSSStyleRule;
   }
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -20,17 +20,17 @@
 #include "nsIDocShellTreeItem.h"
 #include "nsCPrefetchService.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsIHttpChannel.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsIAtom.h"
 #include "nsGkAtoms.h"
 #include "nsIDOMWindow.h"
 #include "nsNetCID.h"
 #include "nsIOfflineCacheUpdate.h"
 #include "nsIApplicationCache.h"
 #include "nsIApplicationCacheContainer.h"
 #include "nsIApplicationCacheChannel.h"
@@ -1366,17 +1366,17 @@ nsContentSink::DidProcessATokenImpl()
   }
 
   // Increase before comparing to gEventProbeRate
   ++mDeflectedCount;
 
   // Check if there's a pending event
   if (sPendingEventMode != 0 && !mHasPendingEvent &&
       (mDeflectedCount % sEventProbeRate) == 0) {
-    nsIViewManager* vm = shell->GetViewManager();
+    nsViewManager* vm = shell->GetViewManager();
     NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
     nsCOMPtr<nsIWidget> widget;
     vm->GetRootWidget(getter_AddRefs(widget));
     mHasPendingEvent = widget && widget->HasPendingInputEvent();
   }
 
   if (mHasPendingEvent && sPendingEventMode == 2) {
     return NS_ERROR_HTMLPARSER_INTERRUPTED;
@@ -1513,17 +1513,17 @@ nsContentSink::WillParseImpl(void)
   nsIPresShell *shell = mDocument->GetShell();
   if (!shell) {
     return NS_OK;
   }
 
   uint32_t currentTime = PR_IntervalToMicroseconds(PR_IntervalNow());
 
   if (sEnablePerfMode == 0) {
-    nsIViewManager* vm = shell->GetViewManager();
+    nsViewManager* vm = shell->GetViewManager();
     NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
     uint32_t lastEventTime;
     vm->GetLastUserEventTime(lastEventTime);
 
     bool newDynLower =
       mDocument->IsInBackgroundWindow() ||
       ((currentTime - mBeginLoadTime) > uint32_t(sInitialPerfTime) &&
        (currentTime - lastEventTime) < uint32_t(sInteractiveTime));
--- a/content/base/src/nsContentSink.h
+++ b/content/base/src/nsContentSink.h
@@ -29,17 +29,17 @@
 class nsIDocument;
 class nsIURI;
 class nsIChannel;
 class nsIDocShell;
 class nsIParser;
 class nsIAtom;
 class nsIChannel;
 class nsIContent;
-class nsIViewManager;
+class nsViewManager;
 class nsNodeInfoManager;
 class nsScriptLoader;
 class nsIApplicationCache;
 
 namespace mozilla {
 namespace css {
 class Loader;
 }
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -110,17 +110,17 @@
 #include "nsDOMDataTransfer.h"
 #include "nsHtml5Module.h"
 #include "nsPresContext.h"
 #include "nsLayoutStatics.h"
 #include "nsFocusManager.h"
 #include "nsTextEditorState.h"
 #include "nsIPluginHost.h"
 #include "nsICategoryManager.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsEventStateManager.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsParserConstants.h"
 #include "nsIWebNavigation.h"
 #include "nsILoadContext.h"
 #include "nsTextFragment.h"
 #include "mozilla/Selection.h"
 
@@ -6430,21 +6430,21 @@ nsContentUtils::FindPresShellForDocument
   return nullptr;
 }
 
 nsIWidget*
 nsContentUtils::WidgetForDocument(nsIDocument* aDoc)
 {
   nsIPresShell* shell = FindPresShellForDocument(aDoc);
   if (shell) {
-    nsIViewManager* VM = shell->GetViewManager();
+    nsViewManager* VM = shell->GetViewManager();
     if (VM) {
       nsView* rootView = VM->GetRootView();
       if (rootView) {
-        nsView* displayRoot = nsIViewManager::GetDisplayRootFor(rootView);
+        nsView* displayRoot = nsViewManager::GetDisplayRootFor(rootView);
         if (displayRoot) {
           return displayRoot->GetNearestWidget(nullptr);
         }
       }
     }
   }
 
   return nullptr;
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -179,16 +179,17 @@
 
 #include "imgILoader.h"
 #include "imgRequestProxy.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsSandboxFlags.h"
 #include "nsIAppsService.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DocumentFragment.h"
+#include "mozilla/dom/UndoManager.h"
 #include "nsFrame.h" 
 #include "nsDOMCaretPosition.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 typedef nsTArray<Link*> LinkArray;
@@ -1674,16 +1675,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLayoutHistoryState)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnloadBlocker)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFirstBaseNodeWithHref)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDOMImplementation)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mImageMaps)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOriginalDocument)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCachedEncoder)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStateObjectCached)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mUndoManager)
 
   // Traverse all our nsCOMArrays.
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleSheets)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCatalogSheets)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPreloadingImages)
 
   for (uint32_t i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) {
     NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameRequestCallbacks[i]");
@@ -1731,16 +1733,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mXPathEvaluatorTearoff)
   tmp->mCachedRootElement = nullptr; // Avoid a dangling pointer
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDisplayDocument)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mFirstBaseNodeWithHref)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDOMImplementation)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mImageMaps)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mOriginalDocument)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCachedEncoder)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK(mUndoManager)
 
   tmp->mParentDocument = nullptr;
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mPreloadingImages)
 
 
   if (tmp->mBoxObjectTable) {
    tmp->mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nullptr);
@@ -2635,16 +2638,32 @@ nsDocument::GetAllowPlugins(bool * aAllo
     // we are sandboxed and plugins should not be allowed.
     if (*aAllowPlugins)
       *aAllowPlugins = !(mSandboxFlags & SANDBOXED_PLUGINS);
   }
 
   return NS_OK;
 }
 
+already_AddRefed<UndoManager>
+nsDocument::GetUndoManager()
+{
+  Element* rootElement = GetRootElement();
+  if (!rootElement) {
+    return nullptr;
+  }
+
+  if (!mUndoManager) {
+    mUndoManager = new UndoManager(rootElement);
+  }
+
+  nsRefPtr<UndoManager> undoManager = mUndoManager;
+  return undoManager.forget();
+}
+
 /* Return true if the document is in the focused top-level window, and is an
  * ancestor of the focused DOMWindow. */
 NS_IMETHODIMP
 nsDocument::HasFocus(bool* aResult)
 {
   ErrorResult rv;
   *aResult = nsIDocument::HasFocus(rv);
   return rv.ErrorCode();
@@ -3095,30 +3114,30 @@ nsDocument::TryChannelCharset(nsIChannel
         aExecutor->ComplainAboutBogusProtocolCharset(this);
       }
     }
   }
   return false;
 }
 
 nsresult
-nsDocument::CreateShell(nsPresContext* aContext, nsIViewManager* aViewManager,
+nsDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager,
                         nsStyleSet* aStyleSet,
                         nsIPresShell** aInstancePtrResult)
 {
   // Don't add anything here.  Add it to |doCreateShell| instead.
   // This exists so that subclasses can pass other values for the 4th
   // parameter some of the time.
   return doCreateShell(aContext, aViewManager, aStyleSet,
                        eCompatibility_FullStandards, aInstancePtrResult);
 }
 
 nsresult
 nsDocument::doCreateShell(nsPresContext* aContext,
-                          nsIViewManager* aViewManager, nsStyleSet* aStyleSet,
+                          nsViewManager* aViewManager, nsStyleSet* aStyleSet,
                           nsCompatibility aCompatMode,
                           nsIPresShell** aInstancePtrResult)
 {
   *aInstancePtrResult = nullptr;
 
   NS_ASSERTION(!mPresShell, "We have a presshell already!");
 
   NS_ENSURE_FALSE(GetBFCacheEntry(), NS_ERROR_FAILURE);
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -89,16 +89,22 @@ class nsOnloadBlocker;
 class nsUnblockOnloadEvent;
 class nsChildContentList;
 class nsHTMLStyleSheet;
 class nsHTMLCSSStyleSheet;
 class nsDOMNavigationTiming;
 class nsWindowSizes;
 class nsHtml5TreeOpExecutor;
 
+namespace mozilla {
+namespace dom {
+class UndoManager;
+}
+}
+
 /**
  * Right now our identifier map entries contain information for 'name'
  * and 'id' mappings of a given string. This is so that
  * nsHTMLDocument::ResolveName only has to do one hash lookup instead
  * of two. It's not clear whether this still matters for performance.
  * 
  * We also store the document.all result list here. This is mainly so that
  * when all elements with the given ID are removed and we remove
@@ -557,23 +563,25 @@ public:
                              const nsAString& aData);
 
   /**
    * Create a new presentation shell that will use aContext for
    * its presentation context (presentation context's <b>must not</b> be
    * shared among multiple presentation shell's).
    */
   virtual nsresult CreateShell(nsPresContext* aContext,
-                               nsIViewManager* aViewManager,
+                               nsViewManager* aViewManager,
                                nsStyleSet* aStyleSet,
                                nsIPresShell** aInstancePtrResult);
   virtual void DeleteShell();
 
   virtual nsresult GetAllowPlugins(bool* aAllowPlugins);
 
+  virtual already_AddRefed<mozilla::dom::UndoManager> GetUndoManager();
+
   virtual nsresult SetSubDocumentFor(Element* aContent,
                                      nsIDocument* aSubDoc);
   virtual nsIDocument* GetSubDocumentFor(nsIContent* aContent) const;
   virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const;
   virtual Element* GetRootElementInternal() const;
 
   /**
    * Get the style sheets owned by this document.
@@ -1063,17 +1071,17 @@ protected:
 public:
   // Get our title
   virtual void GetTitle(nsString& aTitle);
   // Set our title
   virtual void SetTitle(const nsAString& aTitle, mozilla::ErrorResult& rv);
 
 protected:
   nsresult doCreateShell(nsPresContext* aContext,
-                         nsIViewManager* aViewManager, nsStyleSet* aStyleSet,
+                         nsViewManager* aViewManager, nsStyleSet* aStyleSet,
                          nsCompatibility aCompatMode,
                          nsIPresShell** aInstancePtrResult);
 
   void RemoveStyleSheetsFromStyleSets(nsCOMArray<nsIStyleSheet>& aSheets, 
                                       nsStyleSet::sheetType aType);
   nsresult ResetStylesheetsToURI(nsIURI* aURI);
   void FillStyleSet(nsStyleSet* aStyleSet);
 
@@ -1344,16 +1352,18 @@ private:
   uint8_t mChangeScrollPosWhenScrollingToRef : 1;
 
   // Tracking for images in the document.
   nsDataHashtable< nsPtrHashKey<imgIRequest>, uint32_t> mImageTracker;
 
   // Tracking for plugins in the document.
   nsTHashtable< nsPtrHashKey<nsIObjectLoadingContent> > mPlugins;
 
+  nsRefPtr<mozilla::dom::UndoManager> mUndoManager;
+
 #ifdef DEBUG
 protected:
   bool mWillReparent;
 #endif
 };
 
 #define NS_DOCUMENT_INTERFACE_TABLE_BEGIN(_class)                             \
   NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class)                            \
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -52,16 +52,17 @@
 #include "nsISHistory.h"
 #include "nsISHistoryInternal.h"
 #include "nsIDocShellHistory.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIXULWindow.h"
 #include "nsIEditor.h"
 #include "nsIEditorDocShell.h"
 #include "nsIMozBrowserFrame.h"
+#include "nsIPermissionManager.h"
 
 #include "nsLayoutUtils.h"
 #include "nsView.h"
 #include "nsAsyncDOMEvent.h"
 
 #include "nsIURI.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
@@ -277,16 +278,17 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrame
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
   NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
   NS_INTERFACE_MAP_ENTRY(nsIContentViewManager)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
 NS_INTERFACE_MAP_END
 
 nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
   : mOwnerContent(aOwner)
+  , mAppIdSentToPermissionManager(nsIScriptSecurityManager::NO_APP_ID)
   , mDetachedSubdocViews(nullptr)
   , mDepthTooGreat(false)
   , mIsTopLevelContent(false)
   , mDestroyCalled(false)
   , mNeedsAsyncDestroy(false)
   , mInSwap(false)
   , mInShow(false)
   , mHideCalled(false)
@@ -298,16 +300,17 @@ nsFrameLoader::nsFrameLoader(Element* aO
   , mClampScrollPosition(true)
   , mRemoteBrowserInitialized(false)
   , mObservingOwnerContent(false)
   , mCurrentRemoteFrame(nullptr)
   , mRemoteBrowser(nullptr)
   , mRenderMode(RENDER_MODE_DEFAULT)
   , mEventMode(EVENT_MODE_NORMAL_DISPATCH)
 {
+  ResetPermissionManagerStatus();
 }
 
 nsFrameLoader*
 nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
 {
   NS_ENSURE_TRUE(aOwner, nullptr);
   nsIDocument* doc = aOwner->OwnerDoc();
   NS_ENSURE_TRUE(!doc->GetDisplayDocument() &&
@@ -1399,16 +1402,18 @@ nsFrameLoader::SetOwnerContent(Element* 
   if (mObservingOwnerContent) {
     mObservingOwnerContent = false;
     mOwnerContent->RemoveMutationObserver(this);
   }
   mOwnerContent = aContent;
   if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {
     rfp->OwnerContentChanged(aContent);
   }
+
+  ResetPermissionManagerStatus();
 }
 
 bool
 nsFrameLoader::OwnerIsBrowserOrAppFrame()
 {
   nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
   return browserFrame ? browserFrame->GetReallyIsBrowserOrApp() : false;
 }
@@ -2536,8 +2541,64 @@ nsFrameLoader::AttributeChanged(nsIDocum
                        nsCaseInsensitiveStringComparator())) {
     bool is_targetable = is_primary ||
       value.LowerCaseEqualsLiteral("content-targetable");
 
     parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary,
                                        is_targetable, value);
   }
 }
+
+void
+nsFrameLoader::ResetPermissionManagerStatus()
+{
+  // Finding the new app Id:
+  // . first we check if the owner is an app frame
+  // . second, we check if the owner is a browser frame
+  // in both cases we populate the appId variable.
+  uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
+  if (OwnerIsAppFrame()) {
+    // You can't be both an app and a browser frame.
+    MOZ_ASSERT(!OwnerIsBrowserFrame());
+
+    nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
+    MOZ_ASSERT(ownApp);
+    uint32_t ownAppId = nsIScriptSecurityManager::NO_APP_ID;
+    if (ownApp && NS_SUCCEEDED(ownApp->GetLocalId(&ownAppId))) {
+      appId = ownAppId;
+    }
+  }
+
+  if (OwnerIsBrowserFrame()) {
+    // You can't be both a browser and an app frame.
+    MOZ_ASSERT(!OwnerIsAppFrame());
+
+    nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
+    uint32_t containingAppId = nsIScriptSecurityManager::NO_APP_ID;
+    if (containingApp && NS_SUCCEEDED(containingApp->GetLocalId(&containingAppId))) {
+      appId = containingAppId;
+    }
+  }
+
+  // Nothing changed.
+  if (appId == mAppIdSentToPermissionManager) {
+    return;
+  }
+
+  nsCOMPtr<nsIPermissionManager> permMgr = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
+  if (!permMgr) {
+    NS_ERROR("No PermissionManager available!");
+    return;
+  }
+
+  // If previously we registered an appId, we have to unregister it.
+  if (mAppIdSentToPermissionManager != nsIScriptSecurityManager::NO_APP_ID) {
+    permMgr->ReleaseAppId(mAppIdSentToPermissionManager);
+    mAppIdSentToPermissionManager = nsIScriptSecurityManager::NO_APP_ID;
+  }
+
+  // Register the new AppId.
+  if (appId != nsIScriptSecurityManager::NO_APP_ID) {
+    mAppIdSentToPermissionManager = appId;
+    permMgr->AddrefAppId(mAppIdSentToPermissionManager);
+  }
+}
+
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -376,20 +376,27 @@ private:
                               nsIDocShellTreeOwner* aOwner,
                               int32_t aParentType,
                               nsIDocShellTreeNode* aParentNode);
 
   nsIAtom* TypeAttrName() const {
     return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;
   }
 
+  // Update the permission manager's app-id refcount based on mOwnerContent's
+  // own-or-containing-app.
+  void ResetPermissionManagerStatus();
+
   nsCOMPtr<nsIDocShell> mDocShell;
   nsCOMPtr<nsIURI> mURIToLoad;
   mozilla::dom::Element* mOwnerContent; // WEAK
 
+  // Note: this variable must be modified only by ResetPermissionManagerStatus()
+  uint32_t mAppIdSentToPermissionManager;
+
 public:
   // public because a callback needs these.
   nsRefPtr<nsFrameMessageManager> mMessageManager;
   nsCOMPtr<nsIInProcessContentFrameMessageManager> mChildMessageManager;
 private:
   // Stores the root view of the subdocument while the subdocument is being
   // reframed. Used to restore the presentation after reframing.
   nsView* mDetachedSubdocViews;
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -171,39 +171,47 @@ nsGenericDOMDataNode::GetLength(uint32_t
   *aLength = mText.GetLength();
   return NS_OK;
 }
 
 nsresult
 nsGenericDOMDataNode::SubstringData(uint32_t aStart, uint32_t aCount,
                                     nsAString& aReturn)
 {
+  ErrorResult rv;
+  SubstringData(aStart, aCount, aReturn, rv);
+  return rv.ErrorCode();
+}
+
+void
+nsGenericDOMDataNode::SubstringData(uint32_t aStart, uint32_t aCount,
+                                    nsAString& aReturn, ErrorResult& rv)
+{
   aReturn.Truncate();
 
   uint32_t textLength = mText.GetLength();
   if (aStart > textLength) {
-    return NS_ERROR_DOM_INDEX_SIZE_ERR;
+    rv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
+    return;
   }
 
   uint32_t amount = aCount;
   if (amount > textLength - aStart) {
     amount = textLength - aStart;
   }
 
   if (mText.Is2b()) {
     aReturn.Assign(mText.Get2b() + aStart, amount);
   } else {
     // Must use Substring() since nsDependentCString() requires null
     // terminated strings.
 
     const char *data = mText.Get1b() + aStart;
     CopyASCIItoUTF16(Substring(data, data + amount), aReturn);
   }
-
-  return NS_OK;
 }
 
 //----------------------------------------------------------------------
 
 nsresult
 nsGenericDOMDataNode::AppendData(const nsAString& aData)
 {
   return SetTextInternal(mText.GetLength(), 0, aData.BeginReading(),
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -163,16 +163,44 @@ public:
     NS_ADDREF(*aResult);
 
     return NS_OK;
   }
 
   nsresult SplitData(uint32_t aOffset, nsIContent** aReturn,
                      bool aCloneAfterOriginal = true);
 
+  // WebIDL API
+  // Our XPCOM GetData is just fine for WebIDL
+  void SetData(const nsAString& aData, mozilla::ErrorResult& rv)
+  {
+    rv = SetData(aData);
+  }
+  // nsINode::Length() returns the right thing for our length attribute
+  void SubstringData(uint32_t aStart, uint32_t aCount, nsAString& aReturn,
+                     mozilla::ErrorResult& rv);
+  void AppendData(const nsAString& aData, mozilla::ErrorResult& rv)
+  {
+    rv = AppendData(aData);
+  }
+  void InsertData(uint32_t aOffset, const nsAString& aData,
+                  mozilla::ErrorResult& rv)
+  {
+    rv = InsertData(aOffset, aData);
+  }
+  void DeleteData(uint32_t aOffset, uint32_t aCount, mozilla::ErrorResult& rv)
+  {
+    rv = DeleteData(aOffset, aCount);
+  }
+  void ReplaceData(uint32_t aOffset, uint32_t aCount, const nsAString& aData,
+                   mozilla::ErrorResult& rv)
+  {
+    rv = ReplaceData(aOffset, aCount, aData);
+  }
+
   //----------------------------------------
 
 #ifdef DEBUG
   void ToCString(nsAString& aBuf, int32_t aOffset, int32_t aLen) const;
 #endif
 
   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsGenericDOMDataNode)
 
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -1085,16 +1085,17 @@ GK_ATOM(_true, "true")
 GK_ATOM(tt, "tt")
 GK_ATOM(tty, "tty")
 GK_ATOM(tv, "tv")
 GK_ATOM(type, "type")
 GK_ATOM(u, "u")
 GK_ATOM(ul, "ul")
 GK_ATOM(underflow, "underflow")
 GK_ATOM(undetermined, "undetermined")
+GK_ATOM(undoscope, "undoscope")
 GK_ATOM(unload, "unload")
 GK_ATOM(unparsedEntityUri, "unparsed-entity-uri")
 GK_ATOM(upperFirst, "upper-first")
 GK_ATOM(uri, "uri")
 GK_ATOM(use, "use")
 GK_ATOM(useAttributeSets, "use-attribute-sets")
 GK_ATOM(usemap, "usemap")
 GK_ATOM(user_scalable, "user-scalable")
--- a/content/base/src/nsINode.cpp
+++ b/content/base/src/nsINode.cpp
@@ -69,17 +69,17 @@
 #include "nsIPresShell.h"
 #include "nsIScriptError.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsIServiceManager.h"
 #include "nsIURL.h"
 #include "nsView.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.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"
--- a/content/base/src/nsTextNode.cpp
+++ b/content/base/src/nsTextNode.cpp
@@ -3,16 +3,17 @@
  * 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/. */
 
 /*
  * Implementation of DOM Core's nsIDOMText node.
  */
 
 #include "nsTextNode.h"
+#include "mozilla/dom/TextBinding.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/DirectionalityUtils.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsIDocument.h"
 #include "nsThreadUtils.h"
 #include "nsStubMutationObserver.h"
 #ifdef DEBUG
@@ -107,23 +108,16 @@ NS_NewTextNode(nsIContent** aInstancePtr
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aInstancePtrResult = instance);
 
   return NS_OK;
 }
 
-nsTextNode::nsTextNode(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericDOMDataNode(aNodeInfo)
-{
-  NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
-                    "Bad NodeType in aNodeInfo");
-}
-
 nsTextNode::~nsTextNode()
 {
 }
 
 NS_IMPL_ADDREF_INHERITED(nsTextNode, nsGenericDOMDataNode)
 NS_IMPL_RELEASE_INHERITED(nsTextNode, nsGenericDOMDataNode)
 
 DOMCI_NODE_DATA(Text, nsTextNode)
@@ -131,16 +125,22 @@ DOMCI_NODE_DATA(Text, nsTextNode)
 // QueryInterface implementation for nsTextNode
 NS_INTERFACE_TABLE_HEAD(nsTextNode)
   NS_NODE_INTERFACE_TABLE3(nsTextNode, nsIDOMNode, nsIDOMText,
                            nsIDOMCharacterData)
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsTextNode)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Text)
 NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
 
+JSObject*
+nsTextNode::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return TextBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
 bool
 nsTextNode::IsNodeOfType(uint32_t aFlags) const
 {
   return !(aFlags & ~(eCONTENT | eTEXT | eDATA_NODE));
 }
 
 nsGenericDOMDataNode*
 nsTextNode::CloneDataNode(nsINodeInfo *aNodeInfo, bool aCloneText) const
@@ -180,16 +180,27 @@ nsTextNode::BindToTree(nsIDocument* aDoc
 
 void nsTextNode::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   ResetDirectionSetByTextNode(this);
 
   nsGenericDOMDataNode::UnbindFromTree(aDeep, aNullParent);
 }
 
+already_AddRefed<nsTextNode>
+nsTextNode::SplitText(uint32_t aOffset, ErrorResult& rv)
+{
+  nsCOMPtr<nsIContent> newChild;
+  rv = SplitData(aOffset, getter_AddRefs(newChild));
+  if (rv.Failed()) {
+    return nullptr;
+  }
+  return static_cast<nsTextNode*>(newChild.forget().get());
+}
+
 #ifdef DEBUG
 void
 nsTextNode::List(FILE* out, int32_t aIndent) const
 {
   int32_t index;
   for (index = aIndent; --index >= 0; ) fputs("  ", out);
 
   fprintf(out, "Text@%p", static_cast<const void*>(this));
@@ -325,8 +336,9 @@ void
 nsAttributeTextNode::UpdateText(bool aNotify)
 {
   if (mGrandparent) {
     nsAutoString attrValue;
     mGrandparent->GetAttr(mNameSpaceID, mAttrName, attrValue);
     SetText(attrValue, aNotify);
   }  
 }
+
--- a/content/base/src/nsTextNode.h
+++ b/content/base/src/nsTextNode.h
@@ -1,28 +1,39 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifndef nsTextNode_h
+#define nsTextNode_h
+
 /*
  * Implementation of DOM Core's nsIDOMText node.
  */
 
 #include "nsGenericDOMDataNode.h"
 #include "nsIDOMText.h"
+#include "nsDebug.h"
 
 /**
  * Class used to implement DOM text nodes
  */
 class nsTextNode : public nsGenericDOMDataNode,
                    public nsIDOMText
 {
 public:
-  nsTextNode(already_AddRefed<nsINodeInfo> aNodeInfo);
+  nsTextNode(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : nsGenericDOMDataNode(aNodeInfo)
+  {
+    NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
+                      "Bad NodeType in aNodeInfo");
+    SetIsDOMBinding();
+  }
+
   virtual ~nsTextNode();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
@@ -46,13 +57,27 @@ public:
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true);
 
   nsresult AppendTextForNormalize(const PRUnichar* aBuffer, uint32_t aLength,
                                   bool aNotify, nsIContent* aNextSibling);
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 
+  // WebIDL API
+  already_AddRefed<nsTextNode> SplitText(uint32_t aOffset,
+                                         mozilla::ErrorResult& rv);
+  void GetWholeText(nsAString& aWholeText, mozilla::ErrorResult& rv)
+  {
+    rv = GetWholeText(aWholeText);
+  }
+
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const;
   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const;
 #endif
+
+protected:
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap) MOZ_OVERRIDE;
 };
+
+#endif // nsTextNode_h
--- a/content/canvas/compiledtest/TestWebGLElementArrayCache.cpp
+++ b/content/canvas/compiledtest/TestWebGLElementArrayCache.cpp
@@ -110,16 +110,23 @@ void CheckSanity()
     data[i] = numElems - i;
   c.BufferData(data, numBytes);
   VERIFY( c.Validate(type, numElems,     0, numElems));
   VERIFY(!c.Validate(type, numElems - 1, 0, numElems));
 
   MOZ_ASSERT(numElems > 10);
   VERIFY( c.Validate(type, numElems - 10, 10, numElems - 10));
   VERIFY(!c.Validate(type, numElems - 11, 10, numElems - 10));
+
+  // bug 825205
+  if (sizeof(T) < sizeof(uint32_t)) {
+    uint32_t bigValWrappingToZero = uint32_t(T(-1)) + 1;
+    VERIFY(c.Validate(type, bigValWrappingToZero,     0, numElems));
+    VERIFY(c.Validate(type, bigValWrappingToZero - 1, 0, numElems));
+  }
 }
 
 int main(int argc, char *argv[])
 {
   srand(0); // do not want a random seed here.
 
   CheckSanity<uint8_t>();
   CheckSanity<uint16_t>();
--- a/content/canvas/public/nsICanvasElementExternal.h
+++ b/content/canvas/public/nsICanvasElementExternal.h
@@ -19,17 +19,17 @@ struct gfxRect;
 class nsRenderingContext;
 class nsICanvasRenderingContextInternal;
 
 struct _cairo_surface;
 
 /*
  * This interface contains methods that are needed outside of the content/layout
  * modules, specifically widget.  It should eventually go away when we support
- * libxul builds, and nsHTMLCanvasElement be used directly.
+ * libxul builds, and HTMLCanvasElement be used directly.
  *
  * Code internal to content/layout should /never/ use this interface; if the
  * same functionality is needed in both places, two separate methods should be
  * used.
  */
 
 class nsICanvasElementExternal : public nsISupports {
 public:
--- a/content/canvas/public/nsICanvasRenderingContextInternal.h
+++ b/content/canvas/public/nsICanvasRenderingContextInternal.h
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsICanvasRenderingContextInternal_h___
 #define nsICanvasRenderingContextInternal_h___
 
 #include "nsISupports.h"
 #include "nsIInputStream.h"
 #include "nsIDocShell.h"
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "gfxPattern.h"
 #include "mozilla/RefPtr.h"
 
 #define NS_ICANVASRENDERINGCONTEXTINTERNAL_IID \
 { 0x8b8da863, 0xd151, 0x4014, \
   { 0x8b, 0xdc, 0x62, 0xb5, 0x0d, 0xc0, 0x2b, 0x62 } }
 
 class gfxContext;
@@ -41,21 +41,21 @@ public:
   typedef mozilla::layers::LayerManager LayerManager;
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANVASRENDERINGCONTEXTINTERNAL_IID)
 
   enum {
     RenderFlagPremultAlpha = 0x1
   };
 
-  void SetCanvasElement(nsHTMLCanvasElement* aParentCanvas)
+  void SetCanvasElement(mozilla::dom::HTMLCanvasElement* aParentCanvas)
   {
     mCanvasElement = aParentCanvas;
   }
-  nsHTMLCanvasElement* GetParentObject() const
+  mozilla::dom::HTMLCanvasElement* GetParentObject() const
   {
     return mCanvasElement;
   }
 
   // Sets the dimensions of the canvas, in pixels.  Called
   // whenever the size of the element changes.
   NS_IMETHOD SetDimensions(int32_t width, int32_t height) = 0;
 
@@ -120,17 +120,17 @@ public:
 
   // If this context can be set to use Mozilla's Shmem segments as its backing
   // store, this will set it to that state. Note that if you have drawn
   // anything into this canvas before changing the shmem state, it will be
   // lost.
   NS_IMETHOD SetIsIPC(bool isIPC) = 0;
 
 protected:
-  nsRefPtr<nsHTMLCanvasElement> mCanvasElement;
+  nsRefPtr<mozilla::dom::HTMLCanvasElement> mCanvasElement;
 };
 
 namespace mozilla {
 namespace dom {
 
 }
 }
 
--- a/content/canvas/src/CanvasImageCache.cpp
+++ b/content/canvas/src/CanvasImageCache.cpp
@@ -6,28 +6,28 @@
 #include "CanvasImageCache.h"
 #include "nsIImageLoadingContent.h"
 #include "nsExpirationTracker.h"
 #include "imgIRequest.h"
 #include "gfxASurface.h"
 #include "gfxPoint.h"
 #include "mozilla/dom/Element.h"
 #include "nsTHashtable.h"
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsContentUtils.h"
 
 namespace mozilla {
 
 using namespace dom;
 
 struct ImageCacheKey {
-  ImageCacheKey(Element* aImage, nsHTMLCanvasElement* aCanvas)
+  ImageCacheKey(Element* aImage, HTMLCanvasElement* aCanvas)
     : mImage(aImage), mCanvas(aCanvas) {}
   Element* mImage;
-  nsHTMLCanvasElement* mCanvas;
+  HTMLCanvasElement* mCanvas;
 };
 
 struct ImageCacheEntryData {
   ImageCacheEntryData(const ImageCacheEntryData& aOther)
     : mImage(aOther.mImage)
     , mILC(aOther.mILC)
     , mCanvas(aOther.mCanvas)
     , mRequest(aOther.mRequest)
@@ -40,17 +40,17 @@ struct ImageCacheEntryData {
     , mCanvas(aKey.mCanvas)
   {}
 
   nsExpirationState* GetExpirationState() { return &mState; }
 
   // Key
   nsRefPtr<Element> mImage;
   nsIImageLoadingContent* mILC;
-  nsRefPtr<nsHTMLCanvasElement> mCanvas;
+  nsRefPtr<HTMLCanvasElement> mCanvas;
   // Value
   nsCOMPtr<imgIRequest> mRequest;
   nsRefPtr<gfxASurface> mSurface;
   gfxIntSize mSize;
   nsExpirationState mState;
 };
 
 class ImageCacheEntry : public PLDHashEntryHdr {
@@ -108,17 +108,17 @@ class CanvasImageCacheShutdownObserver M
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 };
 
 void
 CanvasImageCache::NotifyDrawImage(Element* aImage,
-                                  nsHTMLCanvasElement* aCanvas,
+                                  HTMLCanvasElement* aCanvas,
                                   imgIRequest* aRequest,
                                   gfxASurface* aSurface,
                                   const gfxIntSize& aSize)
 {
   if (!gImageCache) {
     gImageCache = new ImageCache();
     nsContentUtils::RegisterShutdownObserver(new CanvasImageCacheShutdownObserver());
   }
@@ -139,17 +139,17 @@ CanvasImageCache::NotifyDrawImage(Elemen
     entry->mData->mILC = ilc;
     entry->mData->mSurface = aSurface;
     entry->mData->mSize = aSize;
   }
 }
 
 gfxASurface*
 CanvasImageCache::Lookup(Element* aImage,
-                         nsHTMLCanvasElement* aCanvas,
+                         HTMLCanvasElement* aCanvas,
                          gfxIntSize* aSize)
 {
   if (!gImageCache)
     return nullptr;
 
   ImageCacheEntry* entry = gImageCache->mCache.GetEntry(ImageCacheKey(aImage, aCanvas));
   if (!entry || !entry->mData->mILC)
     return nullptr;
--- a/content/canvas/src/CanvasImageCache.h
+++ b/content/canvas/src/CanvasImageCache.h
@@ -4,45 +4,45 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef CANVASIMAGECACHE_H_
 #define CANVASIMAGECACHE_H_
 
 namespace mozilla {
 namespace dom {
 class Element;
+class HTMLCanvasElement;
 } // namespace dom
 } // namespace mozilla
-class nsHTMLCanvasElement;
 class imgIRequest;
 class gfxASurface;
 
 #include "gfxPoint.h"
 
 namespace mozilla {
 
 class CanvasImageCache {
 public:
   /**
    * Notify that image element aImage was (or is about to be) drawn to aCanvas
    * using the first frame of aRequest's image. The data for the surface is
    * in aSurface, and the image size is in aSize.
    */
   static void NotifyDrawImage(dom::Element* aImage,
-                              nsHTMLCanvasElement* aCanvas,
+                              dom::HTMLCanvasElement* aCanvas,
                               imgIRequest* aRequest,
                               gfxASurface* aSurface,
                               const gfxIntSize& aSize);
 
   /**
    * Check whether aImage has recently been drawn into aCanvas. If we return
    * a non-null surface, then the image was recently drawn into the canvas
    * (with the same image request) and the returned surface contains the image
    * data, and the image size will be returned in aSize.
    */
   static gfxASurface* Lookup(dom::Element* aImage,
-                             nsHTMLCanvasElement* aCanvas,
+                             dom::HTMLCanvasElement* aCanvas,
                              gfxIntSize* aSize);
 };
 
 }
 
 #endif /* CANVASIMAGECACHE_H_ */
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -11,17 +11,17 @@
 #include "prenv.h"
 
 #include "nsIServiceManager.h"
 #include "nsMathUtils.h"
 
 #include "nsContentUtils.h"
 
 #include "nsIDocument.h"
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsSVGEffects.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsIVariant.h"
 
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIFrame.h"
 #include "nsError.h"
@@ -616,17 +616,17 @@ CanvasRenderingContext2D::Reset()
   mThebesSurface = nullptr;
   mIsEntireFrameInvalid = false;
   mPredictManyRedrawCalls = false;
 
   return NS_OK;
 }
 
 static void
-WarnAboutUnexpectedStyle(nsHTMLCanvasElement* canvasElement)
+WarnAboutUnexpectedStyle(HTMLCanvasElement* canvasElement)
 {
   nsContentUtils::ReportToConsole(
     nsIScriptError::warningFlag,
     "Canvas",
     canvasElement ? canvasElement->OwnerDoc() : nullptr,
     nsContentUtils::eDOM_PROPERTIES,
     "UnexpectedCanvasVariantStyle");
 }
@@ -1395,17 +1395,17 @@ CanvasRenderingContext2D::CreatePattern(
     repeatMode = CanvasPattern::NOREPEAT;
   } else {
     error.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     return NULL;
   }
 
   Element* htmlElement;
   if (element.IsHTMLCanvasElement()) {
-    nsHTMLCanvasElement* canvas = element.GetAsHTMLCanvasElement();
+    HTMLCanvasElement* canvas = element.GetAsHTMLCanvasElement();
     htmlElement = canvas;
 
     nsIntSize size = canvas->GetSize();
     if (size.width == 0 || size.height == 0) {
       error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
       return NULL;
     }
 
@@ -2908,17 +2908,17 @@ CanvasRenderingContext2D::DrawImage(cons
 
   RefPtr<SourceSurface> srcSurf;
   gfxIntSize imgSize;
 
   Element* element;
 
   EnsureTarget();
   if (image.IsHTMLCanvasElement()) {
-    nsHTMLCanvasElement* canvas = image.GetAsHTMLCanvasElement();
+    HTMLCanvasElement* canvas = image.GetAsHTMLCanvasElement();
     element = canvas;
     nsIntSize size = canvas->GetSize();
     if (size.width == 0 || size.height == 0) {
       error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
       return;
     }
 
     // Special case for Canvas, which could be an Azure canvas!
--- a/content/canvas/src/CanvasRenderingContext2D.h
+++ b/content/canvas/src/CanvasRenderingContext2D.h
@@ -5,17 +5,17 @@
 #ifndef CanvasRenderingContext2D_h
 #define CanvasRenderingContext2D_h
 
 #include <vector>
 #include "nsIDOMCanvasRenderingContext2D.h"
 #include "nsICanvasRenderingContextInternal.h"
 #include "mozilla/RefPtr.h"
 #include "nsColor.h"
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsHTMLVideoElement.h"
 #include "CanvasUtils.h"
 #include "gfxFont.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/ImageData.h"
 #include "mozilla/dom/UnionTypes.h"
 
 #define NS_CANVASGRADIENTAZURE_PRIVATE_IID \
@@ -136,17 +136,17 @@ typedef mozilla::dom::HTMLImageElementOr
 
 public:
   CanvasRenderingContext2D();
   virtual ~CanvasRenderingContext2D();
 
   virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
                                bool *triedToWrap);
 
-  nsHTMLCanvasElement* GetCanvas() const
+  HTMLCanvasElement* GetCanvas() const
   {
     // corresponds to changes to the old bindings made in bug 745025
     return mCanvasElement->GetOriginalCanvas();
   }
 
   void Save();
   void Restore();
   void Scale(double x, double y, mozilla::ErrorResult& error);
--- a/content/canvas/src/CanvasUtils.cpp
+++ b/content/canvas/src/CanvasUtils.cpp
@@ -9,33 +9,33 @@
 #include "prprf.h"
 
 #include "nsIServiceManager.h"
 
 #include "nsIConsoleService.h"
 #include "nsIDOMCanvasRenderingContext2D.h"
 #include "nsICanvasRenderingContextInternal.h"
 #include "nsIHTMLCollection.h"
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsIPrincipal.h"
 
 #include "nsGfxCIID.h"
 
 #include "nsTArray.h"
 
 #include "CanvasUtils.h"
 #include "mozilla/gfx/Matrix.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace CanvasUtils {
 
 void
-DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
+DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
                          nsIPrincipal *aPrincipal,
                          bool forceWriteOnly,
                          bool CORSUsed)
 {
     NS_PRECONDITION(aPrincipal, "Must have a principal here");
 
     // Callers should ensure that mCanvasElement is non-null before calling this
     if (!aCanvasElement) {
--- a/content/canvas/src/CanvasUtils.h
+++ b/content/canvas/src/CanvasUtils.h
@@ -5,25 +5,28 @@
 
 #ifndef _CANVASUTILS_H_
 #define _CANVASUTILS_H_
 
 #include "prtypes.h"
 
 #include "mozilla/CheckedInt.h"
 
-class nsHTMLCanvasElement;
 class nsIPrincipal;
 
 namespace mozilla {
 
 namespace gfx {
 class Matrix;
 }
 
+namespace dom {
+class HTMLCanvasElement;
+}
+
 namespace CanvasUtils {
 
 
 // Check that the rectangle [x,y,w,h] is a subrectangle of [0,0,realWidth,realHeight]
 
 inline bool CheckSaneSubrectSize(int32_t x, int32_t y, int32_t w, int32_t h,
                             int32_t realWidth, int32_t realHeight) {
     CheckedInt32 checked_xmost  = CheckedInt32(x) + w;
@@ -34,17 +37,17 @@ inline bool CheckSaneSubrectSize(int32_t
         checked_xmost.value() <= realWidth &&
         checked_ymost.isValid() &&
         checked_ymost.value() <= realHeight;
 }
 
 // Flag aCanvasElement as write-only if drawing an image with aPrincipal
 // onto it would make it such.
 
-void DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
+void DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
                               nsIPrincipal *aPrincipal,
                               bool forceWriteOnly,
                               bool CORSUsed);
 
 // Make a double out of |v|, treating undefined values as 0.0 (for
 // the sake of sparse arrays).  Return true iff coercion
 // succeeded.
 bool CoerceDouble(jsval v, double* d);
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -797,36 +797,36 @@ void WebGLContext::UpdateLastUseIndex()
 }
 
 static uint8_t gWebGLLayerUserData;
 
 namespace mozilla {
 
 class WebGLContextUserData : public LayerUserData {
 public:
-    WebGLContextUserData(nsHTMLCanvasElement *aContent)
+    WebGLContextUserData(HTMLCanvasElement *aContent)
     : mContent(aContent) {}
 
   /** DidTransactionCallback gets called by the Layers code everytime the WebGL canvas gets composite,
     * so it really is the right place to put actions that have to be performed upon compositing
     */
   static void DidTransactionCallback(void* aData)
   {
     WebGLContextUserData *userdata = static_cast<WebGLContextUserData*>(aData);
-    nsHTMLCanvasElement *canvas = userdata->mContent;
+    HTMLCanvasElement *canvas = userdata->mContent;
     WebGLContext *context = static_cast<WebGLContext*>(canvas->GetContextAtIndex(0));
 
     context->mBackbufferClearingStatus = BackbufferClearingStatus::NotClearedSinceLastPresented;
     canvas->MarkContextClean();
 
     context->UpdateLastUseIndex();
   }
 
 private:
-  nsRefPtr<nsHTMLCanvasElement> mContent;
+  nsRefPtr<HTMLCanvasElement> mContent;
 };
 
 } // end namespace mozilla
 
 already_AddRefed<layers::CanvasLayer>
 WebGLContext::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
                              CanvasLayer *aOldLayer,
                              LayerManager *aManager)
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -23,17 +23,17 @@
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsCycleCollectionNoteChild.h"
 
 #include "nsIDocShell.h"
 
 #include "nsIDOMWebGLRenderingContext.h"
 #include "nsICanvasRenderingContextInternal.h"
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIMemoryReporter.h"
 #include "nsIJSNativeInitializer.h"
 #include "nsWrapperCache.h"
 #include "nsIObserver.h"
 
 #include "GLContextProvider.h"
 
@@ -327,17 +327,17 @@ public:
     void TerminateContextLossTimer() {
         if (mContextLossTimerRunning) {
             mContextRestorer->Cancel();
             mContextLossTimerRunning = false;
         }
     }
 
     // WebIDL WebGLRenderingContext API
-    nsHTMLCanvasElement* GetCanvas() const {
+    dom::HTMLCanvasElement* GetCanvas() const {
         return mCanvasElement;
     }
     WebGLsizei DrawingBufferWidth() const {
         if (!IsContextStable())
             return 0;
         return mWidth;
     }
     WebGLsizei DrawingBufferHeight() const {
--- a/content/canvas/src/WebGLElementArrayCache.cpp
+++ b/content/canvas/src/WebGLElementArrayCache.cpp
@@ -5,16 +5,17 @@
 
 #include "WebGLElementArrayCache.h"
 
 #include "nsTArray.h"
 #include "mozilla/Assertions.h"
 
 #include <cstdlib>
 #include <cstring>
+#include <limits>
 
 namespace mozilla {
 
 /*
  * WebGLElementArrayCacheTree contains most of the implementation of WebGLElementArrayCache,
  * which performs WebGL element array buffer validation for drawElements.
  *
  * Attention: Here lie nontrivial data structures, bug-prone algorithms, and non-canonical tweaks!
@@ -470,70 +471,80 @@ void WebGLElementArrayCache::InvalidateT
 {
   if (mUint8Tree)
     mUint8Tree->Invalidate(firstByte, lastByte);
   if (mUint16Tree)
     mUint16Tree->Invalidate(firstByte, lastByte);
 }
 
 template<typename T>
-bool WebGLElementArrayCache::Validate(T maxAllowed, size_t firstElement, size_t countElements) {
+bool WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, size_t countElements) {
+  // if maxAllowed is >= the max T value, then there is no way that a T index could be invalid
+  if (maxAllowed >= std::numeric_limits<T>::max())
+    return true;
+
+  T maxAllowedT(maxAllowed);
+
+  // integer overflow must have been handled earlier, so we assert that maxAllowedT
+  // is exactly the max allowed value.
+  MOZ_ASSERT(uint32_t(maxAllowedT) == maxAllowed);
+
   if (!mByteSize || !countElements)
     return true;
 
   WebGLElementArrayCacheTree<T>*& tree = TreeForType<T>::Run(this);
   if (!tree) {
     tree = new WebGLElementArrayCacheTree<T>(*this);
   }
 
   size_t lastElement = firstElement + countElements - 1;
 
   tree->Update();
 
   // fast exit path when the global maximum for the whole element array buffer
   // falls in the allowed range
-  if (tree->GlobalMaximum() <= maxAllowed)
+  if (tree->GlobalMaximum() <= maxAllowedT)
   {
     return true;
   }
 
   const T* elements = Elements<T>();
 
   // before calling tree->Validate, we have to validate ourselves the boundaries of the elements span,
   // to round them to the nearest multiple of sElementsPerLeaf.
   size_t firstElementAdjustmentEnd = NS_MIN(lastElement,
                                             tree->LastElementUnderSameLeaf(firstElement));
   while (firstElement <= firstElementAdjustmentEnd) {
-    if (elements[firstElement] > maxAllowed)
+    if (elements[firstElement] > maxAllowedT)
       return false;
     firstElement++;
   }
   size_t lastElementAdjustmentEnd = NS_MAX(firstElement,
                                            tree->FirstElementUnderSameLeaf(lastElement));
   while (lastElement >= lastElementAdjustmentEnd) {
-    if (elements[lastElement] > maxAllowed)
+    if (elements[lastElement] > maxAllowedT)
       return false;
     lastElement--;
   }
 
   // at this point, for many tiny validations, we're already done.
   if (firstElement > lastElement)
     return true;
 
   // general case
-  return tree->Validate(maxAllowed,
+  return tree->Validate(maxAllowedT,
                         tree->LeafForElement(firstElement),
                         tree->LeafForElement(lastElement));
 }
 
 bool WebGLElementArrayCache::Validate(GLenum type, uint32_t maxAllowed, size_t firstElement, size_t countElements) {
   if (type == LOCAL_GL_UNSIGNED_BYTE)
-    return Validate<uint8_t>(uint8_t(maxAllowed), firstElement, countElements);
+    return Validate<uint8_t>(maxAllowed, firstElement, countElements);
   if (type == LOCAL_GL_UNSIGNED_SHORT)
-    return Validate<uint16_t>(uint16_t(maxAllowed), firstElement, countElements);
+    return Validate<uint16_t>(maxAllowed, firstElement, countElements);
   return false;
 }
 
 size_t WebGLElementArrayCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
   size_t uint8TreeSize  = mUint8Tree  ? mUint8Tree->SizeOfIncludingThis(aMallocSizeOf) : 0;
   size_t uint16TreeSize = mUint16Tree ? mUint16Tree->SizeOfIncludingThis(aMallocSizeOf) : 0;
   return aMallocSizeOf(this) +
           mByteSize +
--- a/content/canvas/src/WebGLElementArrayCache.h
+++ b/content/canvas/src/WebGLElementArrayCache.h
@@ -46,17 +46,17 @@ public:
 
   ~WebGLElementArrayCache();
 
   size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
 
 private:
 
   template<typename T>
-  bool Validate(T maxAllowed, size_t first, size_t count);
+  bool Validate(uint32_t maxAllowed, size_t first, size_t count);
 
   size_t ByteSize() const {
     return mByteSize;
   }
 
   template<typename T>
   const T* Elements() const { return static_cast<const T*>(mUntypedData); }
   template<typename T>
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -876,16 +876,18 @@ nsEventDispatcher::CreateEvent(nsPresCon
   if (aEventType.LowerCaseEqualsLiteral("notifypaintevent"))
     return NS_NewDOMNotifyPaintEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("simplegestureevent"))
     return NS_NewDOMSimpleGestureEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("beforeunloadevent"))
     return NS_NewDOMBeforeUnloadEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("pagetransition"))
     return NS_NewDOMPageTransitionEvent(aDOMEvent, aPresContext, nullptr);
+  if (aEventType.LowerCaseEqualsLiteral("domtransaction"))
+    return NS_NewDOMDOMTransactionEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("scrollareaevent"))
     return NS_NewDOMScrollAreaEvent(aDOMEvent, aPresContext, nullptr);
   // FIXME: Should get spec to say what the right string is here!  This
   // is probably wrong!
   if (aEventType.LowerCaseEqualsLiteral("transitionevent"))
     return NS_NewDOMTransitionEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("animationevent"))
     return NS_NewDOMAnimationEvent(aDOMEvent, aPresContext, nullptr);
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -22,17 +22,17 @@
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptRuntime.h"
 #include "nsLayoutUtils.h"
 #include "nsINameSpaceManager.h"
 #include "nsIContent.h"
 #include "mozilla/dom/Element.h"
 #include "nsIFrame.h"
 #include "nsView.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsError.h"
 #include "nsIJSContextStack.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsMutationEvent.h"
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -3309,41 +3309,63 @@ nsEventStateManager::PostHandleEvent(nsP
 
       if (*aStatus == nsEventStatus_eConsumeNoDefault) {
         break;
       }
 
       widget::WheelEvent* wheelEvent = static_cast<widget::WheelEvent*>(aEvent);
       switch (WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent)) {
         case WheelPrefs::ACTION_SCROLL: {
+          if (!wheelEvent->deltaX && !wheelEvent->deltaY) {
+            break;
+          }
           // For scrolling of default action, we should honor the mouse wheel
           // transaction.
           nsIScrollableFrame* scrollTarget =
             ComputeScrollTarget(aTargetFrame, wheelEvent,
                                 COMPUTE_DEFAULT_ACTION_TARGET);
           wheelEvent->overflowDeltaX = wheelEvent->deltaX;
           wheelEvent->overflowDeltaY = wheelEvent->deltaY;
           WheelPrefs::GetInstance()->
             CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
           if (scrollTarget) {
             DoScrollText(scrollTarget, wheelEvent);
           } else {
             nsMouseWheelTransaction::EndTransaction();
           }
           break;
         }
-        case WheelPrefs::ACTION_HISTORY:
-          DoScrollHistory(wheelEvent->GetPreferredIntDelta());
+        case WheelPrefs::ACTION_HISTORY: {
+          // If this event doesn't cause NS_MOUSE_SCROLL event or the direction
+          // is oblique, don't perform history back/forward.
+          int32_t intDelta = wheelEvent->GetPreferredIntDelta();
+          if (!intDelta) {
+            break;
+          }
+          DoScrollHistory(intDelta);
           break;
-
-        case WheelPrefs::ACTION_ZOOM:
-          DoScrollZoom(aTargetFrame, wheelEvent->GetPreferredIntDelta());
+        }
+        case WheelPrefs::ACTION_ZOOM: {
+          // If this event doesn't cause NS_MOUSE_SCROLL event or the direction
+          // is oblique, don't perform zoom in/out.
+          int32_t intDelta = wheelEvent->GetPreferredIntDelta();
+          if (!intDelta) {
+            break;
+          }
+          DoScrollZoom(aTargetFrame, intDelta);
           break;
-
+        }
+        case WheelPrefs::ACTION_NONE:
         default:
+          // If we don't handle the wheel event, all of the delta values must
+          // be overflown delta values.
+          wheelEvent->overflowDeltaX = wheelEvent->deltaX;
+          wheelEvent->overflowDeltaY = wheelEvent->deltaY;
+          WheelPrefs::GetInstance()->
+            CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
           break;
       }
       *aStatus = nsEventStatus_eConsumeNoDefault;
     }
     break;
 
   case NS_GESTURENOTIFY_EVENT_START:
     {
@@ -5524,20 +5546,16 @@ nsEventStateManager::WheelPrefs::CancelA
   if (mMultiplierY[index]) {
     aEvent->overflowDeltaY /= mMultiplierY[index];
   }
 }
 
 nsEventStateManager::WheelPrefs::Action
 nsEventStateManager::WheelPrefs::ComputeActionFor(widget::WheelEvent* aEvent)
 {
-  if (!aEvent->deltaX && !aEvent->deltaY) {
-    return ACTION_NONE;
-  }
-
   Index index = GetIndexFor(aEvent);
   Init(index);
 
   bool deltaXPreferred =
     (std::abs(aEvent->deltaX) > std::abs(aEvent->deltaY) &&
      std::abs(aEvent->deltaX) > std::abs(aEvent->deltaZ));
   Action* actions = deltaXPreferred ? mOverriddenActionsX : mActions;
   if (actions[index] == ACTION_NONE || actions[index] == ACTION_SCROLL) {
@@ -5547,19 +5565,17 @@ nsEventStateManager::WheelPrefs::Compute
   // Momentum events shouldn't run special actions.
   if (aEvent->isMomentum) {
     // Use the default action.  Note that user might kill the wheel scrolling.
     Init(INDEX_DEFAULT);
     return (actions[INDEX_DEFAULT] == ACTION_SCROLL) ? ACTION_SCROLL :
                                                        ACTION_NONE;
   }
 
-  // If this event doesn't cause NS_MOUSE_SCROLL event or the direction is
-  // oblique, history and zoom shouldn't be executed.
-  return !aEvent->GetPreferredIntDelta() ? ACTION_NONE : actions[index];
+  return actions[index];
 }
 
 bool
 nsEventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta(
                                    widget::WheelEvent* aEvent)
 {
   Index index = GetIndexFor(aEvent);
   Init(index);
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=80: */
 /* 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/. */
 
 #include "nsIMEStateManager.h"
 #include "nsCOMPtr.h"
-#include "nsIViewManager.h"
+#include "nsViewManager.h"
 #include "nsIPresShell.h"
 #include "nsISupports.h"
 #include "nsPIDOMWindow.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIEditorDocShell.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
--- a/content/events/test/window_wheel_default_action.html
+++ b/content/events/test/window_wheel_default_action.html
@@ -1676,33 +1676,36 @@ function doTestActionOverride(aCallback)
         ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
       } else if (kTest.expected & kScrollRight) {
         ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
       } else {
         is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
       }
       if (++index == kTests.length) {
         SpecialPowers.setIntPref("mousewheel.default.action", 1);
-        SpecialPowers.clearUserPref("mousewheel.default.action.override_x");
+        SpecialPowers.setIntPref("mousewheel.default.action.override_x", -1);
         SimpleTest.executeSoon(aCallback);
       } else {
         doIt();
       }
     }, 20);
   }
   doIt();
 }
 
 function runTests()
 {
   SpecialPowers.setBoolPref("general.smoothScroll", false);
 
   SpecialPowers.setIntPref("mousewheel.default.action", 1);      // scroll
+  SpecialPowers.setIntPref("mousewheel.default.action.override_x", -1);
   SpecialPowers.setIntPref("mousewheel.with_shift.action", 2);   // history
+  SpecialPowers.setIntPref("mousewheel.with_shift.action.override_x", -1);
   SpecialPowers.setIntPref("mousewheel.with_control.action", 3); // zoom
+  SpecialPowers.setIntPref("mousewheel.with_control.action.override_x", -1);
 
   const kSettings = [
     { description: "all delta values are not customized",
       deltaMultiplierX:  1.0, deltaMultiplierY:  1.0, deltaMultiplierZ:  1.0 },
     { description: "deltaX is reverted",
       deltaMultiplierX: -1.0, deltaMultiplierY:  1.0, deltaMultiplierZ:  1.0 },
     { description: "deltaY is reverted",
       deltaMultiplierX:  1.0, deltaMultiplierY: -1.0, deltaMultiplierZ:  1.0 },
@@ -1746,18 +1749,21 @@ function runTests()
   doTest();
 }
 
 function finishTests()
 {
   SpecialPowers.clearUserPref("general.smoothScroll");
 
   SpecialPowers.clearUserPref("mousewheel.default.action");
+  SpecialPowers.clearUserPref("mousewheel.default.action.override_x");
   SpecialPowers.clearUserPref("mousewheel.with_shift.action");
+  SpecialPowers.clearUserPref("mousewheel.with_shift.action.override_x");
   SpecialPowers.clearUserPref("mousewheel.with_control.action");
+  SpecialPowers.clearUserPref("mousewheel.with_control.action.override_x");
 
   SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_x");
   SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_y");
   SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_z");
   SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_x");
   SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_y");
   SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_z");
   SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_x");
rename from content/html/content/public/nsHTMLCanvasElement.h
rename to content/html/content/public/HTMLCanvasElement.h
--- a/content/html/content/public/nsHTMLCanvasElement.h
+++ b/content/html/content/public/HTMLCanvasElement.h
@@ -1,57 +1,58 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
-#if !defined(nsHTMLCanvasElement_h__)
-#define nsHTMLCanvasElement_h__
+#if !defined(mozilla_dom_HTMLCanvasElement_h)
+#define mozilla_dom_HTMLCanvasElement_h
 
 #include "nsIDOMHTMLCanvasElement.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsSize.h"
 #include "nsError.h"
 #include "nsNodeInfoManager.h"
 
 #include "nsICanvasElementExternal.h"
 #include "nsLayoutUtils.h"
 
 class nsICanvasRenderingContextInternal;
 class nsIDOMFile;
-class nsHTMLCanvasPrintState;
 class nsITimerCallback;
 class nsIPropertyBag;
 
 namespace mozilla {
 
 namespace layers {
 class CanvasLayer;
 class LayerManager;
 }
 
 namespace gfx {
 struct Rect;
 }
 
-}
+namespace dom {
+
+class HTMLCanvasPrintState;
 
-class nsHTMLCanvasElement : public nsGenericHTMLElement,
-                            public nsICanvasElementExternal,
-                            public nsIDOMHTMLCanvasElement
+class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement,
+                                    public nsICanvasElementExternal,
+                                    public nsIDOMHTMLCanvasElement
 {
-  typedef mozilla::layers::CanvasLayer CanvasLayer;
-  typedef mozilla::layers::LayerManager LayerManager;
+  typedef layers::CanvasLayer CanvasLayer;
+  typedef layers::LayerManager LayerManager;
 
 public:
-  nsHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLCanvasElement();
+  HTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual ~HTMLCanvasElement();
 
-  NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLCanvasElement, canvas)
+  NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLCanvasElement, canvas)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -59,17 +60,17 @@ public:
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
 
   // nsIDOMHTMLCanvasElement
   NS_DECL_NSIDOMHTMLCANVASELEMENT
 
   // CC
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLCanvasElement,
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLCanvasElement,
                                            nsGenericHTMLElement)
 
   /**
    * Get the size in pixels of this canvas element
    */
   nsIntSize GetSize();
 
   /**
@@ -168,38 +169,41 @@ protected:
   nsresult MozGetAsFileImpl(const nsAString& aName,
                             const nsAString& aType,
                             nsIDOMFile** aResult);
   nsresult GetContextHelper(const nsAString& aContextId,
                             nsICanvasRenderingContextInternal **aContext);
   void CallPrintCallback();
 
   nsString mCurrentContextId;
-  nsRefPtr<nsHTMLCanvasElement> mOriginalCanvas;
+  nsRefPtr<HTMLCanvasElement> mOriginalCanvas;
   nsCOMPtr<nsIPrintCallback> mPrintCallback;
   nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext;
-  nsCOMPtr<nsHTMLCanvasPrintState> mPrintState;
+  nsCOMPtr<HTMLCanvasPrintState> mPrintState;
   
 public:
   // Record whether this canvas should be write-only or not.
   // We set this when script paints an image from a different origin.
   // We also transitively set it when script paints a canvas which
   // is itself write-only.
   bool                     mWriteOnly;
 
   bool IsPrintCallbackDone();
 
   void HandlePrintCallback(nsPresContext::nsPresContextType aType);
 
   nsresult DispatchPrintCallback(nsITimerCallback* aCallback);
 
   void ResetPrintCallback();
 
-  nsHTMLCanvasElement* GetOriginalCanvas();
+  HTMLCanvasElement* GetOriginalCanvas();
 };
 
 inline nsISupports*
-GetISupports(nsHTMLCanvasElement* p)
+GetISupports(HTMLCanvasElement* p)
 {
-  return static_cast<mozilla::dom::Element*>(p);
+  return static_cast<Element*>(p);
 }
 
-#endif /* nsHTMLCanvasElement_h__ */
+} // namespace dom
+} // namespace mozilla
+
+#endif /* mozilla_dom_HTMLCanvasElement_h */
--- a/content/html/content/public/Makefile.in
+++ b/content/html/content/public/Makefile.in
@@ -26,15 +26,20 @@ EXPORTS = \
 		nsIForm.h \
 		nsIFormProcessor.h \
 		nsILink.h \
 		nsIRadioVisitor.h \
 		nsIRadioGroupContainer.h \
 		nsITextControlElement.h \
 		nsFormSubmission.h \
 		nsHTMLAudioElement.h \
-		nsHTMLCanvasElement.h \
 		nsHTMLMediaElement.h \
 		nsHTMLVideoElement.h \
 		nsIHTMLCollection.h \
 		$(NULL)
 
+EXPORTS_NAMESPACES = mozilla/dom
+
+EXPORTS_mozilla/dom = \
+		HTMLCanvasElement.h \
+		$(NULL)
+
 include $(topsrcdir)/config/rules.mk
rename from content/html/content/src/nsHTMLAnchorElement.cpp
rename to content/html/content/src/HTMLAnchorElement.cpp
--- a/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/content/html/content/src/HTMLAnchorElement.cpp
@@ -1,111 +1,30 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
 /* 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/. */
 
-#include "nsGenericHTMLElement.h"
-#include "nsIDOMHTMLAnchorElement.h"
-#include "nsILink.h"
-#include "Link.h"
+#include "mozilla/dom/HTMLAnchorElement.h"
+#include "mozilla/dom/HTMLAnchorElementBinding.h"
 
 #include "nsCOMPtr.h"
 #include "nsContentUtils.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
 #include "nsHTMLDNSPrefetch.h"
 
-using namespace mozilla::dom;
-
-class nsHTMLAnchorElement : public nsGenericHTMLElement,
-                            public nsIDOMHTMLAnchorElement,
-                            public nsILink,
-                            public Link
-{
-public:
-  using Element::GetText;
-  using Element::SetText;
-
-  nsHTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLAnchorElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
-  virtual bool Draggable() const MOZ_OVERRIDE;
-
-  // nsIDOMHTMLAnchorElement
-  NS_DECL_NSIDOMHTMLANCHORELEMENT
-
-  // DOM memory reporter participant
-  NS_DECL_SIZEOF_EXCLUDING_THIS
-
-  // nsILink
-  NS_IMETHOD LinkAdded() { return NS_OK; }
-  NS_IMETHOD LinkRemoved() { return NS_OK; }
+NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
+DOMCI_NODE_DATA(HTMLAnchorElement, mozilla::dom::HTMLAnchorElement)
 
-  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                              nsIContent* aBindingParent,
-                              bool aCompileEventHandlers);
-  virtual void UnbindFromTree(bool aDeep = true,
-                              bool aNullParent = true);
-  virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex);
-
-  virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
-  virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
-  virtual bool IsLink(nsIURI** aURI) const;
-  virtual void GetLinkTarget(nsAString& aTarget);
-  virtual nsLinkState GetLinkState() const;
-  virtual already_AddRefed<nsIURI> GetHrefURI() const;
-
-  nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                   const nsAString& aValue, bool aNotify)
-  {
-    return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
-  }
-  virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                           nsIAtom* aPrefix, const nsAString& aValue,
-                           bool aNotify);
-  virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
-                             bool aNotify);
-  virtual bool ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult);
-
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  virtual nsEventStates IntrinsicState() const;
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-
-  virtual void OnDNSPrefetchDeferred();
-  virtual void OnDNSPrefetchRequested();
-  virtual bool HasDeferredDNSPrefetchRequest();
-
-protected:
-  virtual void GetItemValueText(nsAString& text);
-  virtual void SetItemValueText(const nsAString& text);
-};
+namespace mozilla {
+namespace dom {
 
 #define ANCHOR_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
 
 // Anchor element specific bits
 enum {
   // Indicates that a DNS Prefetch has been requested from this Anchor elem
   HTML_ANCHOR_DNS_PREFETCH_REQUESTED =    ANCHOR_ELEMENT_FLAG_BIT(0),
 
@@ -113,116 +32,109 @@ enum {
   HTML_ANCHOR_DNS_PREFETCH_DEFERRED =     ANCHOR_ELEMENT_FLAG_BIT(1)
 };
 
 // Make sure we have enough space for those bits
 PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
 
 #undef ANCHOR_ELEMENT_FLAG_BIT
 
-NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
-
-nsHTMLAnchorElement::nsHTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-  , Link(this)
-{
-}
-
-nsHTMLAnchorElement::~nsHTMLAnchorElement()
+HTMLAnchorElement::~HTMLAnchorElement()
 {
 }
 
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, Element)
-
+NS_IMPL_ADDREF_INHERITED(HTMLAnchorElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLAnchorElement, Element)
 
-DOMCI_NODE_DATA(HTMLAnchorElement, nsHTMLAnchorElement)
-
-// QueryInterface implementation for nsHTMLAnchorElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLAnchorElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLAnchorElement,
+// QueryInterface implementation for HTMLAnchorElement
+NS_INTERFACE_TABLE_HEAD(HTMLAnchorElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE3(HTMLAnchorElement,
                                    nsIDOMHTMLAnchorElement,
                                    nsILink,
                                    Link)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAnchorElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLAnchorElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAnchorElement)
 
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLAnchorElement)
+NS_IMPL_ELEMENT_CLONE(HTMLAnchorElement)
 
+JSObject*
+HTMLAnchorElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return HTMLAnchorElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
 
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Coords, coords)
-NS_IMPL_URI_ATTR(nsHTMLAnchorElement, Href, href)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Hreflang, hreflang)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Name, name)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rel, rel)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Download, download)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Charset, charset)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Coords, coords)
+NS_IMPL_URI_ATTR(HTMLAnchorElement, Href, href)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Hreflang, hreflang)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Name, name)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Rel, rel)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Rev, rev)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Shape, shape)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Type, type)
+NS_IMPL_STRING_ATTR(HTMLAnchorElement, Download, download)
 
 int32_t
-nsHTMLAnchorElement::TabIndexDefault()
+HTMLAnchorElement::TabIndexDefault()
 {
   return 0;
 }
 
 void
-nsHTMLAnchorElement::GetItemValueText(nsAString& aValue)
+HTMLAnchorElement::GetItemValueText(nsAString& aValue)
 {
   GetHref(aValue);
 }
 
 void
-nsHTMLAnchorElement::SetItemValueText(const nsAString& aValue)
+HTMLAnchorElement::SetItemValueText(const nsAString& aValue)
 {
   SetHref(aValue);
 }
 
 bool
-nsHTMLAnchorElement::Draggable() const
+HTMLAnchorElement::Draggable() const
 {
   // links can be dragged as long as there is an href and the
   // draggable attribute isn't false
   if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
     // no href, so just use the same behavior as other elements
     return nsGenericHTMLElement::Draggable();
   }
 
   return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
                       nsGkAtoms::_false, eIgnoreCase);
 }
 
 void
-nsHTMLAnchorElement::OnDNSPrefetchRequested()
+HTMLAnchorElement::OnDNSPrefetchRequested()
 {
   UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
   SetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
 }
 
 void
-nsHTMLAnchorElement::OnDNSPrefetchDeferred()
+HTMLAnchorElement::OnDNSPrefetchDeferred()
 {
   UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
   SetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
 }
 
 bool
-nsHTMLAnchorElement::HasDeferredDNSPrefetchRequest()
+HTMLAnchorElement::HasDeferredDNSPrefetchRequest()
 {
   return HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
 }
 
 nsresult
-nsHTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                                nsIContent* aBindingParent,
-                                bool aCompileEventHandlers)
+HTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
+                              nsIContent* aBindingParent,
+                              bool aCompileEventHandlers)
 {
   Link::ResetLinkState(false, Link::ElementHasHref());
 
   nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -233,17 +145,17 @@ nsHTMLAnchorElement::BindToTree(nsIDocum
       nsHTMLDNSPrefetch::PrefetchLow(this);
     }
   }
 
   return rv;
 }
 
 void
-nsHTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
+HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   // Cancel any DNS prefetches
   // Note: Must come before ResetLinkState.  If called after, it will recreate
   // mCachedURI based on data that is invalid - due to a call to GetHostname.
 
   // If prefetch was deferred, clear flag and move on
   if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED))
     UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
@@ -263,18 +175,18 @@ nsHTMLAnchorElement::UnbindFromTree(bool
   if (doc) {
     doc->UnregisterPendingLinkUpdate(this);
   }
 
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
 }
 
 bool
-nsHTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
-                                     bool *aIsFocusable, int32_t *aTabIndex)
+HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
+                                   bool *aIsFocusable, int32_t *aTabIndex)
 {
   if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
     return true;
   }
 
   // cannot focus links if there is no link handler
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
@@ -318,132 +230,134 @@ nsHTMLAnchorElement::IsHTMLFocusable(boo
   }
 
   *aIsFocusable = true;
 
   return false;
 }
 
 nsresult
-nsHTMLAnchorElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
+HTMLAnchorElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
 {
   return PreHandleEventForAnchors(aVisitor);
 }
 
 nsresult
-nsHTMLAnchorElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
+HTMLAnchorElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
 {
   return PostHandleEventForAnchors(aVisitor);
 }
 
 bool
-nsHTMLAnchorElement::IsLink(nsIURI** aURI) const
+HTMLAnchorElement::IsLink(nsIURI** aURI) const
 {
   return IsHTMLLink(aURI);
 }
 
 void
-nsHTMLAnchorElement::GetLinkTarget(nsAString& aTarget)
+HTMLAnchorElement::GetLinkTarget(nsAString& aTarget)
 {
   GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
   if (aTarget.IsEmpty()) {
     GetBaseTarget(aTarget);
   }
 }
 
 NS_IMETHODIMP
-nsHTMLAnchorElement::GetTarget(nsAString& aValue)
+HTMLAnchorElement::GetTarget(nsAString& aValue)
 {
   if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
     GetBaseTarget(aValue);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLAnchorElement::SetTarget(const nsAString& aValue)
+HTMLAnchorElement::SetTarget(const nsAString& aValue)
 {
   return SetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue, true);
 }
 
 #define IMPL_URI_PART(_part)                                 \
   NS_IMETHODIMP                                              \
-  nsHTMLAnchorElement::Get##_part(nsAString& a##_part)       \
+  HTMLAnchorElement::Get##_part(nsAString& a##_part)         \
   {                                                          \
-    return Link::Get##_part(a##_part);                       \
+    Link::Get##_part(a##_part);                              \
+    return NS_OK;                                            \
   }                                                          \
   NS_IMETHODIMP                                              \
-  nsHTMLAnchorElement::Set##_part(const nsAString& a##_part) \
+  HTMLAnchorElement::Set##_part(const nsAString& a##_part)   \
   {                                                          \
-    return Link::Set##_part(a##_part);                       \
+    Link::Set##_part(a##_part);                              \
+    return NS_OK;                                            \
   }
 
 IMPL_URI_PART(Protocol)
 IMPL_URI_PART(Host)
 IMPL_URI_PART(Hostname)
 IMPL_URI_PART(Pathname)
 IMPL_URI_PART(Search)
 IMPL_URI_PART(Port)
 IMPL_URI_PART(Hash)
 
 #undef IMPL_URI_PART
 
 NS_IMETHODIMP    
-nsHTMLAnchorElement::GetText(nsAString& aText)
+HTMLAnchorElement::GetText(nsAString& aText)
 {
   nsContentUtils::GetNodeTextContent(this, true, aText);
   return NS_OK;
 }
 
 NS_IMETHODIMP    
-nsHTMLAnchorElement::SetText(const nsAString& aText)
+HTMLAnchorElement::SetText(const nsAString& aText)
 {
   return nsContentUtils::SetNodeTextContent(this, aText, false);
 }
 
 NS_IMETHODIMP
-nsHTMLAnchorElement::ToString(nsAString& aSource)
+HTMLAnchorElement::ToString(nsAString& aSource)
 {
   return GetHref(aSource);
 }
 
 NS_IMETHODIMP    
-nsHTMLAnchorElement::GetPing(nsAString& aValue)
+HTMLAnchorElement::GetPing(nsAString& aValue)
 {
   return GetURIListAttr(nsGkAtoms::ping, aValue);
 }
 
 NS_IMETHODIMP
-nsHTMLAnchorElement::SetPing(const nsAString& aValue)
+HTMLAnchorElement::SetPing(const nsAString& aValue)
 {
   return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
 }
 
 nsLinkState
-nsHTMLAnchorElement::GetLinkState() const
+HTMLAnchorElement::GetLinkState() const
 {
   return Link::GetLinkState();
 }
 
 already_AddRefed<nsIURI>
-nsHTMLAnchorElement::GetHrefURI() const
+HTMLAnchorElement::GetHrefURI() const
 {
   nsIURI* uri = Link::GetCachedURI();
   if (uri) {
     NS_ADDREF(uri);
     return uri;
   }
 
   return GetHrefURIForAnchors();
 }
 
 nsresult
-nsHTMLAnchorElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                             nsIAtom* aPrefix, const nsAString& aValue,
-                             bool aNotify)
+HTMLAnchorElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+                           nsIAtom* aPrefix, const nsAString& aValue,
+                           bool aNotify)
 {
   bool reset = false;
   if (aName == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
     // If we do not have a cached URI, we have some value here so we must reset
     // our link state after calling the parent.
     if (!Link::HasCachedURI()) {
       reset = true;
     }
@@ -468,18 +382,18 @@ nsHTMLAnchorElement::SetAttr(int32_t aNa
   if (reset) {
     Link::ResetLinkState(!!aNotify, true);
   }
 
   return rv;
 }
 
 nsresult
-nsHTMLAnchorElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
-                               bool aNotify)
+HTMLAnchorElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
+                             bool aNotify)
 {
   nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
                                                 aNotify);
 
   // The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
   // is important here!  The attribute is not unset until UnsetAttr returns, and
   // we will need the updated attribute value because notifying the document
   // that content states have changed will call IntrinsicState, which will try
@@ -487,30 +401,32 @@ nsHTMLAnchorElement::UnsetAttr(int32_t a
   if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
     Link::ResetLinkState(!!aNotify, false);
   }
 
   return rv;
 }
 
 bool
-nsHTMLAnchorElement::ParseAttribute(int32_t aNamespaceID,
-                                    nsIAtom* aAttribute,
-                                    const nsAString& aValue,
-                                    nsAttrValue& aResult)
+HTMLAnchorElement::ParseAttribute(int32_t aNamespaceID,
+                                  nsIAtom* aAttribute,
+                                  const nsAString& aValue,
+                                  nsAttrValue& aResult)
 {
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                               aResult);
 }
 
 nsEventStates
-nsHTMLAnchorElement::IntrinsicState() const
+HTMLAnchorElement::IntrinsicState() const
 {
   return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
 }
 
 size_t
-nsHTMLAnchorElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
+HTMLAnchorElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
   return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
          Link::SizeOfExcludingThis(aMallocSizeOf);
 }
 
+} // namespace mozilla
+} // namespace dom
copy from content/html/content/src/nsHTMLAnchorElement.cpp
copy to content/html/content/src/HTMLAnchorElement.h
--- a/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/content/html/content/src/HTMLAnchorElement.h
@@ -1,40 +1,41 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
 /* 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/. */
 
+#ifndef mozilla_dom_HTMLAnchorElement_h
+#define mozilla_dom_HTMLAnchorElement_h
+
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsILink.h"
 #include "Link.h"
 
-#include "nsCOMPtr.h"
-#include "nsContentUtils.h"
-#include "nsGkAtoms.h"
-#include "nsIPresShell.h"
-#include "nsIDocument.h"
-#include "nsPresContext.h"
-#include "nsHTMLDNSPrefetch.h"
+namespace mozilla {
+namespace dom {
 
-using namespace mozilla::dom;
-
-class nsHTMLAnchorElement : public nsGenericHTMLElement,
-                            public nsIDOMHTMLAnchorElement,
-                            public nsILink,
-                            public Link
+class HTMLAnchorElement : public nsGenericHTMLElement,
+                          public nsIDOMHTMLAnchorElement,
+                          public nsILink,
+                          public Link
 {
 public:
   using Element::GetText;
   using Element::SetText;
 
-  nsHTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLAnchorElement();
+  HTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : nsGenericHTMLElement(aNodeInfo)
+    , Link(this)
+  {
+    SetIsDOMBinding();
+  }
+  virtual ~HTMLAnchorElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -92,425 +93,121 @@ public:
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 
   virtual void OnDNSPrefetchDeferred();
   virtual void OnDNSPrefetchRequested();
   virtual bool HasDeferredDNSPrefetchRequest();
 
+  // WebIDL API
+  void GetHref(nsString& aValue)
+  {
+    GetHTMLURIAttr(nsGkAtoms::href, aValue);
+  }
+  void SetHref(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::href, aValue, rv);
+  }
+  // The XPCOM GetTarget is OK for us
+  void SetTarget(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::target, aValue, rv);
+  }
+  void GetDownload(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::download, aValue);
+  }
+  void SetDownload(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::download, aValue, rv);
+  }
+  // The XPCOM GetPing is OK for us
+  void SetPing(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::ping, aValue, rv);
+  }
+  void GetRel(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::rel, aValue);
+  }
+  void SetRel(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::rel, aValue, rv);
+  }
+  void GetHreflang(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::hreflang, aValue);
+  }
+  void SetHreflang(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::hreflang, aValue, rv);
+  }
+  void GetType(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::type, aValue);
+  }
+  void SetType(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::type, aValue, rv);
+  }
+  // The XPCOM GetText is OK for us
+  void SetText(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    rv = SetText(aValue);
+  }
+  // The XPCOM URI decomposition attributes are fine for us
+  void GetCoords(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::coords, aValue);
+  }
+  void SetCoords(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::coords, aValue, rv);
+  }
+  void GetCharset(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::charset, aValue);
+  }
+  void SetCharset(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::charset, aValue, rv);
+  }
+  void GetName(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::name, aValue);
+  }
+  void SetName(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::name, aValue, rv);
+  }
+  void GetRev(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::rev, aValue);
+  }
+  void SetRev(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::rev, aValue, rv);
+  }
+  void GetShape(nsString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::shape, aValue);
+  }
+  void SetShape(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::shape, aValue, rv);
+  }
+  void Stringify(nsAString& aResult)
+  {
+    GetHref(aResult);
+  }
+
 protected:
   virtual void GetItemValueText(nsAString& text);
   virtual void SetItemValueText(const nsAString& text);
-};
-
-#define ANCHOR_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
-
-// Anchor element specific bits
-enum {
-  // Indicates that a DNS Prefetch has been requested from this Anchor elem
-  HTML_ANCHOR_DNS_PREFETCH_REQUESTED =    ANCHOR_ELEMENT_FLAG_BIT(0),
-
-  // Indicates that a DNS Prefetch was added to the deferral queue
-  HTML_ANCHOR_DNS_PREFETCH_DEFERRED =     ANCHOR_ELEMENT_FLAG_BIT(1)
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap) MOZ_OVERRIDE;
 };
 
-// Make sure we have enough space for those bits
-PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
-
-#undef ANCHOR_ELEMENT_FLAG_BIT
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
-
-nsHTMLAnchorElement::nsHTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-  , Link(this)
-{
-}
-
-nsHTMLAnchorElement::~nsHTMLAnchorElement()
-{
-}
-
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, Element)
-
-
-DOMCI_NODE_DATA(HTMLAnchorElement, nsHTMLAnchorElement)
-
-// QueryInterface implementation for nsHTMLAnchorElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLAnchorElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLAnchorElement,
-                                   nsIDOMHTMLAnchorElement,
-                                   nsILink,
-                                   Link)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAnchorElement,
-                                               nsGenericHTMLElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAnchorElement)
-
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLAnchorElement)
-
-
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Coords, coords)
-NS_IMPL_URI_ATTR(nsHTMLAnchorElement, Href, href)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Hreflang, hreflang)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Name, name)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rel, rel)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
-NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Download, download)
-
-int32_t
-nsHTMLAnchorElement::TabIndexDefault()
-{
-  return 0;
-}
-
-void
-nsHTMLAnchorElement::GetItemValueText(nsAString& aValue)
-{
-  GetHref(aValue);
-}
-
-void
-nsHTMLAnchorElement::SetItemValueText(const nsAString& aValue)
-{
-  SetHref(aValue);
-}
-
-bool
-nsHTMLAnchorElement::Draggable() const
-{
-  // links can be dragged as long as there is an href and the
-  // draggable attribute isn't false
-  if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
-    // no href, so just use the same behavior as other elements
-    return nsGenericHTMLElement::Draggable();
-  }
-
-  return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
-                      nsGkAtoms::_false, eIgnoreCase);
-}
-
-void
-nsHTMLAnchorElement::OnDNSPrefetchRequested()
-{
-  UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
-  SetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
-}
-
-void
-nsHTMLAnchorElement::OnDNSPrefetchDeferred()
-{
-  UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
-  SetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
-}
-
-bool
-nsHTMLAnchorElement::HasDeferredDNSPrefetchRequest()
-{
-  return HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
-}
-
-nsresult
-nsHTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                                nsIContent* aBindingParent,
-                                bool aCompileEventHandlers)
-{
-  Link::ResetLinkState(false, Link::ElementHasHref());
-
-  nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
-                                                 aBindingParent,
-                                                 aCompileEventHandlers);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // Prefetch links
-  if (aDocument) {
-    aDocument->RegisterPendingLinkUpdate(this);
-    if (nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
-      nsHTMLDNSPrefetch::PrefetchLow(this);
-    }
-  }
-
-  return rv;
-}
-
-void
-nsHTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
-{
-  // Cancel any DNS prefetches
-  // Note: Must come before ResetLinkState.  If called after, it will recreate
-  // mCachedURI based on data that is invalid - due to a call to GetHostname.
-
-  // If prefetch was deferred, clear flag and move on
-  if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED))
-    UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
-  // Else if prefetch was requested, clear flag and send cancellation
-  else if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_REQUESTED)) {
-    UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
-    // Possible that hostname could have changed since binding, but since this
-    // covers common cases, most DNS prefetch requests will be canceled
-    nsHTMLDNSPrefetch::CancelPrefetchLow(this, NS_ERROR_ABORT);
-  }
-  
-  // If this link is ever reinserted into a document, it might
-  // be under a different xml:base, so forget the cached state now.
-  Link::ResetLinkState(false, Link::ElementHasHref());
-  
-  nsIDocument* doc = GetCurrentDoc();
-  if (doc) {
-    doc->UnregisterPendingLinkUpdate(this);
-  }
-
-  nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
-}
-
-bool
-nsHTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
-                                     bool *aIsFocusable, int32_t *aTabIndex)
-{
-  if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
-    return true;
-  }
-
-  // cannot focus links if there is no link handler
-  nsIDocument* doc = GetCurrentDoc();
-  if (doc) {
-    nsIPresShell* presShell = doc->GetShell();
-    if (presShell) {
-      nsPresContext* presContext = presShell->GetPresContext();
-      if (presContext && !presContext->GetLinkHandler()) {
-        *aIsFocusable = false;
-        return false;
-      }
-    }
-  }
-
-  if (IsEditable()) {
-    if (aTabIndex) {
-      *aTabIndex = -1;
-    }
-
-    *aIsFocusable = false;
-
-    return true;
-  }
-
-  if (!HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
-    // check whether we're actually a link
-    if (!Link::HasURI()) {
-      // Not tabbable or focusable without href (bug 17605), unless
-      // forced to be via presence of nonnegative tabindex attribute
-      if (aTabIndex) {
-        *aTabIndex = -1;
-      }
-
-      *aIsFocusable = false;
-
-      return false;
-    }
-  }
+} // namespace dom
+} // namespace mozilla
 
-  if (aTabIndex && (sTabFocusModel & eTabFocus_linksMask) == 0) {
-    *aTabIndex = -1;
-  }
-
-  *aIsFocusable = true;
-
-  return false;
-}
-
-nsresult
-nsHTMLAnchorElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
-{
-  return PreHandleEventForAnchors(aVisitor);
-}
-
-nsresult
-nsHTMLAnchorElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
-{
-  return PostHandleEventForAnchors(aVisitor);
-}
-
-bool
-nsHTMLAnchorElement::IsLink(nsIURI** aURI) const
-{
-  return IsHTMLLink(aURI);
-}
-
-void
-nsHTMLAnchorElement::GetLinkTarget(nsAString& aTarget)
-{
-  GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
-  if (aTarget.IsEmpty()) {
-    GetBaseTarget(aTarget);
-  }
-}
-
-NS_IMETHODIMP
-nsHTMLAnchorElement::GetTarget(nsAString& aValue)
-{
-  if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
-    GetBaseTarget(aValue);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLAnchorElement::SetTarget(const nsAString& aValue)
-{
-  return SetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue, true);
-}
-
-#define IMPL_URI_PART(_part)                                 \
-  NS_IMETHODIMP                                              \
-  nsHTMLAnchorElement::Get##_part(nsAString& a##_part)       \
-  {                                                          \
-    return Link::Get##_part(a##_part);                       \
-  }                                                          \
-  NS_IMETHODIMP                                              \
-  nsHTMLAnchorElement::Set##_part(const nsAString& a##_part) \
-  {                                                          \
-    return Link::Set##_part(a##_part);                       \
-  }
-
-IMPL_URI_PART(Protocol)
-IMPL_URI_PART(Host)
-IMPL_URI_PART(Hostname)
-IMPL_URI_PART(Pathname)
-IMPL_URI_PART(Search)
-IMPL_URI_PART(Port)
-IMPL_URI_PART(Hash)
-
-#undef IMPL_URI_PART
-
-NS_IMETHODIMP    
-nsHTMLAnchorElement::GetText(nsAString& aText)
-{
-  nsContentUtils::GetNodeTextContent(this, true, aText);
-  return NS_OK;
-}
-
-NS_IMETHODIMP    
-nsHTMLAnchorElement::SetText(const nsAString& aText)
-{
-  return nsContentUtils::SetNodeTextContent(this, aText, false);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchorElement::ToString(nsAString& aSource)
-{
-  return GetHref(aSource);
-}
-
-NS_IMETHODIMP    
-nsHTMLAnchorElement::GetPing(nsAString& aValue)
-{
-  return GetURIListAttr(nsGkAtoms::ping, aValue);
-}
-
-NS_IMETHODIMP
-nsHTMLAnchorElement::SetPing(const nsAString& aValue)
-{
-  return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
-}
-
-nsLinkState
-nsHTMLAnchorElement::GetLinkState() const
-{
-  return Link::GetLinkState();
-}
-
-already_AddRefed<nsIURI>
-nsHTMLAnchorElement::GetHrefURI() const
-{
-  nsIURI* uri = Link::GetCachedURI();
-  if (uri) {
-    NS_ADDREF(uri);
-    return uri;
-  }
-
-  return GetHrefURIForAnchors();
-}
-
-nsresult
-nsHTMLAnchorElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                             nsIAtom* aPrefix, const nsAString& aValue,
-                             bool aNotify)
-{
-  bool reset = false;
-  if (aName == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
-    // If we do not have a cached URI, we have some value here so we must reset
-    // our link state after calling the parent.
-    if (!Link::HasCachedURI()) {
-      reset = true;
-    }
-    // However, if we have a cached URI, we'll want to see if the value changed.
-    else {
-      nsAutoString val;
-      GetHref(val);
-      if (!val.Equals(aValue)) {
-        reset = true;
-      }
-    }
-  }
-
-  nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
-                                              aValue, aNotify);
-
-  // The ordering of the parent class's SetAttr call and Link::ResetLinkState
-  // is important here!  The attribute is not set until SetAttr returns, and
-  // we will need the updated attribute value because notifying the document
-  // that content states have changed will call IntrinsicState, which will try
-  // to get updated information about the visitedness from Link.
-  if (reset) {
-    Link::ResetLinkState(!!aNotify, true);
-  }
-
-  return rv;
-}
-
-nsresult
-nsHTMLAnchorElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
-                               bool aNotify)
-{
-  nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
-                                                aNotify);
-
-  // The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
-  // is important here!  The attribute is not unset until UnsetAttr returns, and
-  // we will need the updated attribute value because notifying the document
-  // that content states have changed will call IntrinsicState, which will try
-  // to get updated information about the visitedness from Link.
-  if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
-    Link::ResetLinkState(!!aNotify, false);
-  }
-
-  return rv;
-}
-
-bool
-nsHTMLAnchorElement::ParseAttribute(int32_t aNamespaceID,
-                                    nsIAtom* aAttribute,
-                                    const nsAString& aValue,
-                                    nsAttrValue& aResult)
-{
-  return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
-                                              aResult);
-}
-
-nsEventStates
-nsHTMLAnchorElement::IntrinsicState() const
-{
-  return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
-}
-
-size_t
-nsHTMLAnchorElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
-{
-  return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
-         Link::SizeOfExcludingThis(aMallocSizeOf);
-}
-
+#endif // mozilla_dom_HTMLAnchorElement_h
rename from content/html/content/src/nsHTMLCanvasElement.cpp
rename to content/html/content/src/HTMLCanvasElement.cpp
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/HTMLCanvasElement.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "nsHTMLCanvasElement.h"
+#include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsAttrValueInlines.h"
 
 #include "mozilla/Base64.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "nsNetUtil.h"
@@ -31,20 +31,25 @@
 #include "nsITimer.h"
 #include "nsAsyncDOMEvent.h"
 
 #include "nsIWritablePropertyBag2.h"
 
 #define DEFAULT_CANVAS_WIDTH 300
 #define DEFAULT_CANVAS_HEIGHT 150
 
-using namespace mozilla;
-using namespace mozilla::dom;
 using namespace mozilla::layers;
 
+nsGenericHTMLElement*
+NS_NewHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo,
+                        mozilla::dom::FromParser aFromParser)
+{
+  return new mozilla::dom::HTMLCanvasElement(aNodeInfo);
+}
+
 namespace {
 
 typedef mozilla::dom::HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement
 HTMLImageOrCanvasOrVideoElement;
 
 class ToBlobRunnable : public nsRunnable
 {
 public:
@@ -64,22 +69,25 @@ public:
   }
 private:
   nsCOMPtr<nsIFileCallback> mCallback;
   nsCOMPtr<nsIDOMBlob> mBlob;
 };
 
 } // anonymous namespace
 
-class nsHTMLCanvasPrintState : public nsIDOMMozCanvasPrintState
+namespace mozilla {
+namespace dom {
+
+class HTMLCanvasPrintState : public nsIDOMMozCanvasPrintState
 {
 public:
-  nsHTMLCanvasPrintState(nsHTMLCanvasElement* aCanvas,
-                         nsICanvasRenderingContextInternal* aContext,
-                         nsITimerCallback* aCallback)
+  HTMLCanvasPrintState(HTMLCanvasElement* aCanvas,
+                       nsICanvasRenderingContextInternal* aContext,
+                       nsITimerCallback* aCallback)
     : mIsDone(false), mPendingNotify(false), mCanvas(aCanvas),
       mContext(aContext), mCallback(aCallback)
   {
   }
 
   NS_IMETHOD GetContext(nsISupports** aContext)
   {
     NS_ADDREF(*aContext = mContext);
@@ -89,18 +97,18 @@ public:
   NS_IMETHOD Done()
   {
     if (!mPendingNotify && !mIsDone) {
       // The canvas needs to be invalidated for printing reftests on linux to
       // work.
       if (mCanvas) {
         mCanvas->InvalidateCanvas();
       }
-      nsRefPtr<nsRunnableMethod<nsHTMLCanvasPrintState> > doneEvent =
-        NS_NewRunnableMethod(this, &nsHTMLCanvasPrintState::NotifyDone);
+      nsRefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
+        NS_NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
       if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
         mPendingNotify = true;
       }
     }
     return NS_OK;
   }
 
   void NotifyDone()
@@ -111,106 +119,95 @@ public:
       mCallback->Notify(nullptr);
     }
   }
 
   bool mIsDone;
 
   // CC
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(nsHTMLCanvasPrintState)
+  NS_DECL_CYCLE_COLLECTION_CLASS(HTMLCanvasPrintState)
 private:
-  virtual ~nsHTMLCanvasPrintState()
+  virtual ~HTMLCanvasPrintState()
   {
   }
   bool mPendingNotify;
 
 protected:
-  nsRefPtr<nsHTMLCanvasElement> mCanvas;
+  nsRefPtr<HTMLCanvasElement> mCanvas;
   nsCOMPtr<nsICanvasRenderingContextInternal> mContext;
   nsCOMPtr<nsITimerCallback> mCallback;
 };
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsHTMLCanvasPrintState)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsHTMLCanvasPrintState)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(HTMLCanvasPrintState)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(HTMLCanvasPrintState)
 
-DOMCI_DATA(MozCanvasPrintState, nsHTMLCanvasPrintState)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsHTMLCanvasPrintState)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLCanvasPrintState)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMozCanvasPrintState)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozCanvasPrintState)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLCanvasPrintState)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsHTMLCanvasPrintState)
+NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLCanvasPrintState)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(HTMLCanvasPrintState)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCanvas)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContext)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCallback)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsHTMLCanvasPrintState)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(HTMLCanvasPrintState)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCanvas)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCallback)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 // ---------------------------------------------------------------------------
 
-nsGenericHTMLElement*
-NS_NewHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo,
-                        FromParser aFromParser)
-{
-  return new nsHTMLCanvasElement(aNodeInfo);
-}
-
-nsHTMLCanvasElement::nsHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+HTMLCanvasElement::HTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo), 
     mWriteOnly(false)
 {
 }
 
-nsHTMLCanvasElement::~nsHTMLCanvasElement()
+HTMLCanvasElement::~HTMLCanvasElement()
 {
   ResetPrintCallback();
 }
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLCanvasElement)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLCanvasElement,
+NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLCanvasElement)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLCanvasElement,
                                                   nsGenericHTMLElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCurrentContext)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrintCallback)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrintState)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOriginalCanvas)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLCanvasElement,
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLCanvasElement,
                                                 nsGenericHTMLElement)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCurrentContext)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mPrintCallback)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mPrintState)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mOriginalCanvas)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLCanvasElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLCanvasElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLCanvasElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLCanvasElement, Element)
 
-DOMCI_NODE_DATA(HTMLCanvasElement, nsHTMLCanvasElement)
-
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLCanvasElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLCanvasElement,
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLCanvasElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE2(HTMLCanvasElement,
                                    nsIDOMHTMLCanvasElement,
                                    nsICanvasElementExternal)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLCanvasElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLCanvasElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLCanvasElement)
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLCanvasElement)
+NS_IMPL_ELEMENT_CLONE(HTMLCanvasElement)
 
 nsIntSize
-nsHTMLCanvasElement::GetWidthHeight()
+HTMLCanvasElement::GetWidthHeight()
 {
   nsIntSize size(DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT);
   const nsAttrValue* value;
 
   if ((value = GetParsedAttr(nsGkAtoms::width)) &&
       value->Type() == nsAttrValue::eInteger)
   {
       size.width = value->GetIntegerValue();
@@ -220,182 +217,182 @@ nsHTMLCanvasElement::GetWidthHeight()
       value->Type() == nsAttrValue::eInteger)
   {
       size.height = value->GetIntegerValue();
   }
 
   return size;
 }
 
-NS_IMPL_UINT_ATTR_DEFAULT_VALUE(nsHTMLCanvasElement, Width, width, DEFAULT_CANVAS_WIDTH)
-NS_IMPL_UINT_ATTR_DEFAULT_VALUE(nsHTMLCanvasElement, Height, height, DEFAULT_CANVAS_HEIGHT)
-NS_IMPL_BOOL_ATTR(nsHTMLCanvasElement, MozOpaque, moz_opaque)
+NS_IMPL_UINT_ATTR_DEFAULT_VALUE(HTMLCanvasElement, Width, width, DEFAULT_CANVAS_WIDTH)
+NS_IMPL_UINT_ATTR_DEFAULT_VALUE(HTMLCanvasElement, Height, height, DEFAULT_CANVAS_HEIGHT)
+NS_IMPL_BOOL_ATTR(HTMLCanvasElement, MozOpaque, moz_opaque)
 
 nsresult
-nsHTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                             nsIAtom* aPrefix, const nsAString& aValue,
-                             bool aNotify)
+HTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+                           nsIAtom* aPrefix, const nsAString& aValue,
+                           bool aNotify)
 {
   nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue,
                                               aNotify);
   if (NS_SUCCEEDED(rv) && mCurrentContext &&
       (aName == nsGkAtoms::width || aName == nsGkAtoms::height || aName == nsGkAtoms::moz_opaque))
   {
     rv = UpdateContext();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return rv;
 }
 
 void
-nsHTMLCanvasElement::HandlePrintCallback(nsPresContext::nsPresContextType aType)
+HTMLCanvasElement::HandlePrintCallback(nsPresContext::nsPresContextType aType)
 {
   // Only call the print callback here if 1) we're in a print testing mode or
   // print preview mode, 2) the canvas has a print callback and 3) the callback
   // hasn't already been called. For real printing the callback is handled in
   // nsSimplePageSequenceFrame::PrePrintNextPage.
   nsCOMPtr<nsIPrintCallback> printCallback;
   if ((aType == nsPresContext::eContext_PageLayout ||
        aType == nsPresContext::eContext_PrintPreview) &&
       !mPrintState &&
       NS_SUCCEEDED(GetMozPrintCallback(getter_AddRefs(printCallback))) && printCallback) {
     DispatchPrintCallback(nullptr);
   }
 }
 
 nsresult
-nsHTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
+HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
 {
   // For print reftests the context may not be initialized yet, so get a context
   // so mCurrentContext is set.
   if (!mCurrentContext) {
     nsresult rv;
     nsCOMPtr<nsISupports> context;
     rv = GetContext(NS_LITERAL_STRING("2d"), JSVAL_VOID,
                     getter_AddRefs(context));
     NS_ENSURE_SUCCESS(rv, rv);
   }
-  mPrintState = new nsHTMLCanvasPrintState(this, mCurrentContext, aCallback);
+  mPrintState = new HTMLCanvasPrintState(this, mCurrentContext, aCallback);
 
-  nsRefPtr<nsRunnableMethod<nsHTMLCanvasElement> > renderEvent =
-        NS_NewRunnableMethod(this, &nsHTMLCanvasElement::CallPrintCallback);
+  nsRefPtr<nsRunnableMethod<HTMLCanvasElement> > renderEvent =
+        NS_NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
   return NS_DispatchToCurrentThread(renderEvent);
 }
 
 void
-nsHTMLCanvasElement::CallPrintCallback()
+HTMLCanvasElement::CallPrintCallback()
 {
   nsCOMPtr<nsIPrintCallback> printCallback;
   GetMozPrintCallback(getter_AddRefs(printCallback));
   printCallback->Render(mPrintState);
 }
 
 void
-nsHTMLCanvasElement::ResetPrintCallback()
+HTMLCanvasElement::ResetPrintCallback()
 {
   if (mPrintState) {
     mPrintState = nullptr;
   }
 }
 
 bool
-nsHTMLCanvasElement::IsPrintCallbackDone()
+HTMLCanvasElement::IsPrintCallbackDone()
 {
   if (mPrintState == nullptr) {
     return true;
   }
 
   return mPrintState->mIsDone;
 }
 
-nsHTMLCanvasElement*
-nsHTMLCanvasElement::GetOriginalCanvas()
+HTMLCanvasElement*
+HTMLCanvasElement::GetOriginalCanvas()
 {
   return mOriginalCanvas ? mOriginalCanvas.get() : this;
 }
 
 nsresult
-nsHTMLCanvasElement::CopyInnerTo(Element* aDest)
+HTMLCanvasElement::CopyInnerTo(Element* aDest)
 {
   nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
   NS_ENSURE_SUCCESS(rv, rv);
   if (aDest->OwnerDoc()->IsStaticDocument()) {
-    nsHTMLCanvasElement* dest = static_cast<nsHTMLCanvasElement*>(aDest);
-    nsHTMLCanvasElement* self = const_cast<nsHTMLCanvasElement*>(this);
+    HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
+    HTMLCanvasElement* self = const_cast<HTMLCanvasElement*>(this);
     dest->mOriginalCanvas = self;
 
     nsCOMPtr<nsISupports> cxt;
     dest->GetContext(NS_LITERAL_STRING("2d"), JSVAL_VOID, getter_AddRefs(cxt));
     nsRefPtr<CanvasRenderingContext2D> context2d =
       static_cast<CanvasRenderingContext2D*>(cxt.get());
     if (context2d && !self->mPrintCallback) {
-      HTMLImageOrCanvasOrVideoElement element;
-      element.SetAsHTMLCanvasElement() = this;
+      HTMLImageOrCanvasOrVideoElement element;
+      element.SetAsHTMLCanvasElement() = this;
       ErrorResult err;
       context2d->DrawImage(element,
                            0.0, 0.0, err);
       rv = err.ErrorCode();
     }
   }
   return rv;
 }
 
 nsChangeHint
-nsHTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
-                                            int32_t aModType) const
+HTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
+                                          int32_t aModType) const
 {
   nsChangeHint retval =
     nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::width ||
       aAttribute == nsGkAtoms::height)
   {
     NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
   } else if (aAttribute == nsGkAtoms::moz_opaque)
   {
     NS_UpdateHint(retval, NS_STYLE_HINT_VISUAL);
   }
   return retval;
 }
 
 bool
-nsHTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
-                                    nsIAtom* aAttribute,
-                                    const nsAString& aValue,
-                                    nsAttrValue& aResult)
+HTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
+                                  nsIAtom* aAttribute,
+                                  const nsAString& aValue,
+                                  nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height)) {
     return aResult.ParseNonNegativeIntValue(aValue);
   }
 
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                               aResult);
 }
 
 
-// nsHTMLCanvasElement::toDataURL
+// HTMLCanvasElement::toDataURL
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
-                               uint8_t optional_argc, nsAString& aDataURL)
+HTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
+                             uint8_t optional_argc, nsAString& aDataURL)
 {
   // do a trust check if this is a write-only canvas
   if (mWriteOnly && !nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   return ToDataURLImpl(aType, aParams, aDataURL);
 }
 
-// nsHTMLCanvasElement::mozFetchAsStream
+// HTMLCanvasElement::mozFetchAsStream
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
-                                      const nsAString& aType)
+HTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
+                                    const nsAString& aType)
 {
   if (!nsContentUtils::IsCallerChrome())
     return NS_ERROR_FAILURE;
 
   nsresult rv;
   bool fellBackToPNG = false;
   nsCOMPtr<nsIInputStream> inputData;
 
@@ -412,38 +409,38 @@ nsHTMLCanvasElement::MozFetchAsStream(ns
   nsCOMPtr<nsIInputStreamCallback> asyncCallback;
   rv = NS_NewInputStreamReadyEvent(getter_AddRefs(asyncCallback), aCallback, mainThread);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return asyncCallback->OnInputStreamReady(asyncData);
 }
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::SetMozPrintCallback(nsIPrintCallback *aCallback)
+HTMLCanvasElement::SetMozPrintCallback(nsIPrintCallback *aCallback)
 {
   mPrintCallback = aCallback;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::GetMozPrintCallback(nsIPrintCallback** aCallback)
+HTMLCanvasElement::GetMozPrintCallback(nsIPrintCallback** aCallback)
 {
   if (mOriginalCanvas) {
     mOriginalCanvas->GetMozPrintCallback(aCallback);
     return NS_OK;
   }
   NS_IF_ADDREF(*aCallback = mPrintCallback);
   return NS_OK;
 }
 
 nsresult
-nsHTMLCanvasElement::ExtractData(const nsAString& aType,
-                                 const nsAString& aOptions,
-                                 nsIInputStream** aStream,
-                                 bool& aFellBackToPNG)
+HTMLCanvasElement::ExtractData(const nsAString& aType,
+                               const nsAString& aOptions,
+                               nsIInputStream** aStream,
+                               bool& aFellBackToPNG)
 {
   // note that if we don't have a current context, the spec says we're
   // supposed to just return transparent black pixels of the canvas
   // dimensions.
   nsRefPtr<gfxImageSurface> emptyCanvas;
   nsIntSize size = GetWidthHeight();
   if (!mCurrentContext) {
     emptyCanvas = new gfxImageSurface(gfxIntSize(size.width, size.height), gfxASurface::ImageFormatARGB32);
@@ -495,19 +492,19 @@ nsHTMLCanvasElement::ExtractData(const n
 
   NS_ENSURE_SUCCESS(rv, rv);
 
   imgStream.forget(aStream);
   return NS_OK;
 }
 
 nsresult
-nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
-                                   nsIVariant* aEncoderOptions,
-                                   nsAString& aDataURL)
+HTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
+                                 nsIVariant* aEncoderOptions,
+                                 nsAString& aDataURL)
 {
   bool fallbackToPNG = false;
 
   nsIntSize size = GetWidthHeight();
   if (size.height == 0 || size.width == 0) {
     aDataURL = NS_LITERAL_STRING("data:,");
     return NS_OK;
   }
@@ -580,20 +577,20 @@ nsHTMLCanvasElement::ToDataURLImpl(const
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(count <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   return Base64EncodeInputStream(stream, aDataURL, (uint32_t)count, aDataURL.Length());
 }
 
 // XXXkhuey the encoding should be off the main thread, but we're lazy.
 NS_IMETHODIMP
-nsHTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
-                            const nsAString& aType,
-                            nsIVariant* aParams,
-                            uint8_t optional_argc)
+HTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
+                          const nsAString& aType,
+                          nsIVariant* aParams,
+                          uint8_t optional_argc)
 {
   // do a trust check if this is a write-only canvas
   if (mWriteOnly && !nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   if (!aCallback) {
     return NS_ERROR_UNEXPECTED;
@@ -633,34 +630,34 @@ nsHTMLCanvasElement::ToBlob(nsIFileCallb
     JS_updateMallocCounter(cx, imgSize);
   }
 
   nsRefPtr<ToBlobRunnable> runnable = new ToBlobRunnable(aCallback, blob);
   return NS_DispatchToCurrentThread(runnable);
 }
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::MozGetAsFile(const nsAString& aName,
-                                  const nsAString& aType,
-                                  uint8_t optional_argc,
-                                  nsIDOMFile** aResult)
+HTMLCanvasElement::MozGetAsFile(const nsAString& aName,
+                                const nsAString& aType,
+                                uint8_t optional_argc,
+                                nsIDOMFile** aResult)
 {
   // do a trust check if this is a write-only canvas
   if ((mWriteOnly) &&
       !nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   return MozGetAsFileImpl(aName, aType, aResult);
 }
 
 nsresult
-nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
-                                      const nsAString& aType,
-                                      nsIDOMFile** aResult)
+HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
+                                    const nsAString& aType,
+                                    nsIDOMFile** aResult)
 {
   bool fallbackToPNG = false;
 
   nsCOMPtr<nsIInputStream> stream;
   nsresult rv = ExtractData(aType, EmptyString(), getter_AddRefs(stream),
                             fallbackToPNG);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -687,18 +684,18 @@ nsHTMLCanvasElement::MozGetAsFileImpl(co
   nsRefPtr<nsDOMMemoryFile> file =
     new nsDOMMemoryFile(imgData, (uint32_t)imgSize, aName, type);
 
   file.forget(aResult);
   return NS_OK;
 }
 
 nsresult
-nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
-                                      nsICanvasRenderingContextInternal **aContext)
+HTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
+                                    nsICanvasRenderingContextInternal **aContext)
 {
   NS_ENSURE_ARG(aContext);
 
   if (aContextId.EqualsLiteral("2d")) {
     Telemetry::Accumulate(Telemetry::CANVAS_2D_USED, 1);
     nsRefPtr<CanvasRenderingContext2D> ctx =
       new CanvasRenderingContext2D();
 
@@ -739,19 +736,19 @@ nsHTMLCanvasElement::GetContextHelper(co
   }
 
   ctx->SetCanvasElement(this);
   ctx.forget(aContext);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
-                                const JS::Value& aContextOptions,
-                                nsISupports **aContext)
+HTMLCanvasElement::GetContext(const nsAString& aContextId,
+                              const JS::Value& aContextOptions,
+                              nsISupports **aContext)
 {
   nsresult rv;
 
   if (mCurrentContextId.IsEmpty()) {
     rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
     NS_ENSURE_SUCCESS(rv, rv);
     if (!mCurrentContext) {
       return NS_OK;
@@ -826,18 +823,18 @@ nsHTMLCanvasElement::GetContext(const ns
     return NS_OK;
   }
 
   NS_ADDREF (*aContext = mCurrentContext);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
-                                      nsISupports **aContext)
+HTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
+                                    nsISupports **aContext)
 {
   if(!nsContentUtils::IsCallerChrome()) {
     // XXX ERRMSG we need to report an error to developers here! (bug 329026)
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   // We only support 2d shmem contexts for now.
   if (!aContextId.Equals(NS_LITERAL_STRING("2d")))
@@ -861,17 +858,17 @@ nsHTMLCanvasElement::MozGetIPCContext(co
     return NS_ERROR_INVALID_ARG;
   }
 
   NS_ADDREF (*aContext = mCurrentContext);
   return NS_OK;
 }
 
 nsresult
-nsHTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
+HTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
 {
   if (!mCurrentContext)
     return NS_OK;
 
   nsIntSize sz = GetWidthHeight();
 
   nsresult rv = mCurrentContext->SetIsOpaque(GetIsOpaque());
   if (NS_FAILED(rv)) {
@@ -893,35 +890,35 @@ nsHTMLCanvasElement::UpdateContext(nsIPr
     mCurrentContextId.Truncate();
     return rv;
   }
 
   return rv;
 }
 
 nsIntSize
-nsHTMLCanvasElement::GetSize()
+HTMLCanvasElement::GetSize()
 {
   return GetWidthHeight();
 }
 
 bool
-nsHTMLCanvasElement::IsWriteOnly()
+HTMLCanvasElement::IsWriteOnly()
 {
   return mWriteOnly;
 }
 
 void
-nsHTMLCanvasElement::SetWriteOnly()
+HTMLCanvasElement::SetWriteOnly()
 {
   mWriteOnly = true;
 }
 
 void
-nsHTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
+HTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
 {
   // We don't need to flush anything here; if there's no frame or if
   // we plan to reframe we don't need to invalidate it anyway.
   nsIFrame *frame = GetPrimaryFrame();
   if (!frame)
     return;
 
   frame->MarkLayersActive(nsChangeHint(0));
@@ -957,84 +954,89 @@ nsHTMLCanvasElement::InvalidateCanvasCon
     JSObject *obj = scope->GetGlobalJSObject();
     if (obj) {
       js::NotifyAnimationActivity(obj);
     }
   }
 }
 
 void
-nsHTMLCanvasElement::InvalidateCanvas()
+HTMLCanvasElement::InvalidateCanvas()
 {
   // We don't need to flush anything here; if there's no frame or if
   // we plan to reframe we don't need to invalidate it anyway.
   nsIFrame *frame = GetPrimaryFrame();
   if (!frame)
     return;
 
   frame->InvalidateFrame();
 }
 
 int32_t
-nsHTMLCanvasElement::CountContexts()
+HTMLCanvasElement::CountContexts()
 {
   if (mCurrentContext)
     return 1;
 
   return 0;
 }
 
 nsICanvasRenderingContextInternal *
-nsHTMLCanvasElement::GetContextAtIndex(int32_t index)
+HTMLCanvasElement::GetContextAtIndex(int32_t index)
 {
   if (mCurrentContext && index == 0)
     return mCurrentContext;
 
   return NULL;
 }
 
 bool
-nsHTMLCanvasElement::GetIsOpaque()
+HTMLCanvasElement::GetIsOpaque()
 {
   return HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque);
 }
 
 already_AddRefed<CanvasLayer>
-nsHTMLCanvasElement::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
-                                    CanvasLayer *aOldLayer,
-                                    LayerManager *aManager)
+HTMLCanvasElement::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
+                                  CanvasLayer *aOldLayer,
+                                  LayerManager *aManager)
 {
   if (!mCurrentContext)
     return nullptr;
 
   return mCurrentContext->GetCanvasLayer(aBuilder, aOldLayer, aManager);
 }
 
 bool
-nsHTMLCanvasElement::ShouldForceInactiveLayer(LayerManager *aManager)
+HTMLCanvasElement::ShouldForceInactiveLayer(LayerManager *aManager)
 {
   return !mCurrentContext || mCurrentContext->ShouldForceInactiveLayer(aManager);
 }
 
 void
-nsHTMLCanvasElement::MarkContextClean()
+HTMLCanvasElement::MarkContextClean()
 {
   if (!mCurrentContext)
     return;
 
   mCurrentContext->MarkContextClean();
 }
 
 NS_IMETHODIMP_(nsIntSize)
-nsHTMLCanvasElement::GetSizeExternal()
+HTMLCanvasElement::GetSizeExternal()
 {
   return GetWidthHeight();
 }
 
 NS_IMETHODIMP
-nsHTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, uint32_t aFlags)
+HTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, uint32_t aFlags)
 {
   if (!mCurrentContext)
     return NS_OK;
 
   return mCurrentContext->Render(aContext, aFilter, aFlags);
 }
 
+} // namespace dom
+} // namespace mozilla
+
+DOMCI_NODE_DATA(HTMLCanvasElement, mozilla::dom::HTMLCanvasElement)
+DOMCI_DATA(MozCanvasPrintState, mozilla::dom::HTMLCanvasPrintState)
rename from content/html/content/src/nsHTMLLIElement.cpp
rename to content/html/content/src/HTMLLIElement.cpp
--- a/content/html/content/src/nsHTMLLIElement.cpp
+++ b/content/html/content/src/HTMLLIElement.cpp
@@ -1,93 +1,47 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "mozilla/Util.h"
+#include "mozilla/dom/HTMLLIElement.h"
+#include "mozilla/dom/HTMLLIElementBinding.h"
 
-#include "nsIDOMHTMLLIElement.h"
-#include "nsIDOMEventTarget.h"
-#include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
-class nsHTMLLIElement : public nsGenericHTMLElement,
-                        public nsIDOMHTMLLIElement
-{
-public:
-  nsHTMLLIElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLLIElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
+NS_IMPL_NS_NEW_HTML_ELEMENT(LI)
+DOMCI_NODE_DATA(HTMLLIElement, mozilla::dom::HTMLLIElement)
 
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLLIElement
-  NS_DECL_NSIDOMHTMLLIELEMENT
+namespace mozilla {
+namespace dom {
 
-  virtual bool ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult);
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
-  virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-  virtual nsXPCClassInfo* GetClassInfo();
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-};
-
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(LI)
-
-
-nsHTMLLIElement::nsHTMLLIElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLLIElement::~HTMLLIElement()
 {
 }
 
-nsHTMLLIElement::~nsHTMLLIElement()
-{
-}
+NS_IMPL_ADDREF_INHERITED(HTMLLIElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLLIElement, Element)
 
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLLIElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLLIElement, Element)
-
-
-DOMCI_NODE_DATA(HTMLLIElement, nsHTMLLIElement)
-
 // QueryInterface implementation for nsHTMLLIElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLLIElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLLIElement, nsIDOMHTMLLIElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLIElement,
+NS_INTERFACE_TABLE_HEAD(HTMLLIElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLLIElement, nsIDOMHTMLLIElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLLIElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLIElement)
 
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLLIElement)
+NS_IMPL_ELEMENT_CLONE(HTMLLIElement)
 
-
-NS_IMPL_STRING_ATTR(nsHTMLLIElement, Type, type)
-NS_IMPL_INT_ATTR(nsHTMLLIElement, Value, value)
+NS_IMPL_STRING_ATTR(HTMLLIElement, Type, type)
+NS_IMPL_INT_ATTR(HTMLLIElement, Value, value)
 
 // values that are handled case-insensitively
 static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
   { "disc", NS_STYLE_LIST_STYLE_DISC },
   { "circle", NS_STYLE_LIST_STYLE_CIRCLE },
   { "round", NS_STYLE_LIST_STYLE_CIRCLE },
   { "square", NS_STYLE_LIST_STYLE_SQUARE },
   { 0 }
@@ -99,20 +53,20 @@ static const nsAttrValue::EnumTable kOrd
   { "a", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
   { "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
   { "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
   { "1", NS_STYLE_LIST_STYLE_DECIMAL },
   { 0 }
 };
 
 bool
-nsHTMLLIElement::ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult)
+HTMLLIElement::ParseAttribute(int32_t aNamespaceID,
+                              nsIAtom* aAttribute,
+                              const nsAString& aValue,
+                              nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::type) {
       return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable,
                                     true) ||
              aResult.ParseEnumValue(aValue, kUnorderedListItemTypeTable, false);
     }
     if (aAttribute == nsGkAtoms::value) {
@@ -137,30 +91,37 @@ MapAttributesIntoRule(const nsMappedAttr
         listStyleType->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
     }
   }
 
   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLLIElement::IsAttributeMapped(const nsIAtom* aAttribute) const
+HTMLLIElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry attributes[] = {
     { &nsGkAtoms::type },
     { nullptr },
   };
 
   static const MappedAttributeEntry* const map[] = {
     attributes,
     sCommonAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
-
-
 nsMapRuleToAttributesFunc
-nsHTMLLIElement::GetAttributeMappingFunction() const
+HTMLLIElement::GetAttributeMappingFunction() const
 {
   return &MapAttributesIntoRule;
 }
+
+JSObject*
+HTMLLIElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return HTMLLIElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+} // namespace dom
+} // namespace mozilla
copy from content/html/content/src/nsHTMLLIElement.cpp
copy to content/html/content/src/HTMLLIElement.h
--- a/content/html/content/src/nsHTMLLIElement.cpp
+++ b/content/html/content/src/HTMLLIElement.h
@@ -1,33 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "mozilla/Util.h"
+#ifndef mozilla_dom_HTMLLIElement_h
+#define mozilla_dom_HTMLLIElement_h
 
+#include "mozilla/Util.h"
 #include "nsIDOMHTMLLIElement.h"
-#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
-#include "nsAttrValueInlines.h"
-#include "nsGkAtoms.h"
-#include "nsStyleConsts.h"
-#include "nsMappedAttributes.h"
-#include "nsRuleData.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-class nsHTMLLIElement : public nsGenericHTMLElement,
-                        public nsIDOMHTMLLIElement
+class HTMLLIElement : public nsGenericHTMLElement,
+                      public nsIDOMHTMLLIElement
 {
 public:
-  nsHTMLLIElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLLIElement();
+  HTMLLIElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : nsGenericHTMLElement(aNodeInfo)
+  {
+    SetIsDOMBinding();
+  }
+  virtual ~HTMLLIElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -43,124 +43,36 @@ public:
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsAttrValue& aResult);
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
   virtual nsXPCClassInfo* GetClassInfo();
   virtual nsIDOMNode* AsDOMNode() { return this; }
-};
-
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(LI)
-
-
-nsHTMLLIElement::nsHTMLLIElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-{
-}
-
-nsHTMLLIElement::~nsHTMLLIElement()
-{
-}
-
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLLIElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLLIElement, Element)
-
-
-DOMCI_NODE_DATA(HTMLLIElement, nsHTMLLIElement)
 
-// QueryInterface implementation for nsHTMLLIElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLLIElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLLIElement, nsIDOMHTMLLIElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLIElement,
-                                               nsGenericHTMLElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLIElement)
-
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLLIElement)
-
-
-NS_IMPL_STRING_ATTR(nsHTMLLIElement, Type, type)
-NS_IMPL_INT_ATTR(nsHTMLLIElement, Value, value)
+  // WebIDL API
+  void GetType(nsString& aType)
+  {
+    GetHTMLAttr(nsGkAtoms::type, aType);
+  }
+  void SetType(const nsAString& aType, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::type, aType, rv);
+  }
+  int32_t Value() const
+  {
+    return GetIntAttr(nsGkAtoms::value, 0);
+  }
+  void SetValue(int32_t aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLIntAttr(nsGkAtoms::value, aValue, rv);
+  }
 
-// values that are handled case-insensitively
-static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
-  { "disc", NS_STYLE_LIST_STYLE_DISC },
-  { "circle", NS_STYLE_LIST_STYLE_CIRCLE },
-  { "round", NS_STYLE_LIST_STYLE_CIRCLE },
-  { "square", NS_STYLE_LIST_STYLE_SQUARE },
-  { 0 }
-};
-
-// values that are handled case-sensitively
-static const nsAttrValue::EnumTable kOrderedListItemTypeTable[] = {
-  { "A", NS_STYLE_LIST_STYLE_UPPER_ALPHA },
-  { "a", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
-  { "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
-  { "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
-  { "1", NS_STYLE_LIST_STYLE_DECIMAL },
-  { 0 }
+protected:
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap) MOZ_OVERRIDE;
 };
 
-bool
-nsHTMLLIElement::ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult)
-{
-  if (aNamespaceID == kNameSpaceID_None) {
-    if (aAttribute == nsGkAtoms::type) {
-      return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable,
-                                    true) ||
-             aResult.ParseEnumValue(aValue, kUnorderedListItemTypeTable, false);
-    }
-    if (aAttribute == nsGkAtoms::value) {
-      return aResult.ParseIntValue(aValue);
-    }
-  }
-
-  return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
-                                              aResult);
-}
+} // namespace dom
+} // namespace mozilla
 
-static void
-MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
-                      nsRuleData* aData)
-{
-  if (aData->mSIDs & NS_STYLE_INHERIT_BIT(List)) {
-    nsCSSValue* listStyleType = aData->ValueForListStyleType();
-    if (listStyleType->GetUnit() == eCSSUnit_Null) {
-      // type: enum
-      const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
-      if (value && value->Type() == nsAttrValue::eEnum)
-        listStyleType->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
-    }
-  }
-
-  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLLIElement::IsAttributeMapped(const nsIAtom* aAttribute) const
-{
-  static const MappedAttributeEntry attributes[] = {
-    { &nsGkAtoms::type },
-    { nullptr },
-  };
-
-  static const MappedAttributeEntry* const map[] = {
-    attributes,
-    sCommonAttributeMap,
-  };
-
-  return FindAttributeDependence(aAttribute, map);
-}
-
-
-
-nsMapRuleToAttributesFunc
-nsHTMLLIElement::GetAttributeMappingFunction() const
-{
-  return &MapAttributesIntoRule;
-}
+#endif // mozilla_dom_HTMLLIElement_h
rename from content/html/content/src/nsHTMLParagraphElement.cpp
rename to content/html/content/src/HTMLParagraphElement.cpp
--- a/content/html/content/src/nsHTMLParagraphElement.cpp
+++ b/content/html/content/src/HTMLParagraphElement.cpp
@@ -1,103 +1,51 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "mozilla/Util.h"
+#include "mozilla/dom/HTMLParagraphElement.h"
+#include "mozilla/dom/HTMLParagraphElementBinding.h"
 
-#include "nsIDOMHTMLParagraphElement.h"
-#include "nsIDOMEventTarget.h"
-#include "nsGenericHTMLElement.h"
-#include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
-// XXX missing nav attributes
-
-class nsHTMLParagraphElement : public nsGenericHTMLElement,
-                               public nsIDOMHTMLParagraphElement
-{
-public:
-  nsHTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLParagraphElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLParagraphElement
-  NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT
-
-  virtual bool ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult);
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
-  virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
-
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-};
-
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Paragraph)
-
+DOMCI_NODE_DATA(HTMLParagraphElement, mozilla::dom::HTMLParagraphElement)
 
-nsHTMLParagraphElement::nsHTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+namespace mozilla {
+namespace dom {
+
+HTMLParagraphElement::~HTMLParagraphElement()
 {
 }
 
-nsHTMLParagraphElement::~nsHTMLParagraphElement()
-{
-}
-
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLParagraphElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLParagraphElement, Element)
-
-DOMCI_NODE_DATA(HTMLParagraphElement, nsHTMLParagraphElement)
+NS_IMPL_ADDREF_INHERITED(HTMLParagraphElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLParagraphElement, Element)
 
 // QueryInterface implementation for nsHTMLParagraphElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLParagraphElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLParagraphElement,
+NS_INTERFACE_TABLE_HEAD(HTMLParagraphElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLParagraphElement,
                                    nsIDOMHTMLParagraphElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLParagraphElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLParagraphElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLParagraphElement)
 
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLParagraphElement)
+NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement)
 
-
-NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align)
-
+NS_IMPL_STRING_ATTR(HTMLParagraphElement, Align, align)
 
 bool
-nsHTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
-                                       nsIAtom* aAttribute,
-                                       const nsAString& aValue,
-                                       nsAttrValue& aResult)
+HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
+                                     nsIAtom* aAttribute,
+                                     const nsAString& aValue,
+                                     nsAttrValue& aResult)
 {
   if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
     return ParseDivAlignValue(aValue, aResult);
   }
 
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                               aResult);
 }
@@ -105,24 +53,33 @@ nsHTMLParagraphElement::ParseAttribute(i
 static void
 MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
 {
   nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLParagraphElement::IsAttributeMapped(const nsIAtom* aAttribute) const
+HTMLParagraphElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry* const map[] = {
     sDivAlignAttributeMap,
     sCommonAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
 
 nsMapRuleToAttributesFunc
-nsHTMLParagraphElement::GetAttributeMappingFunction() const
+HTMLParagraphElement::GetAttributeMappingFunction() const
 {
   return &MapAttributesIntoRule;
 }
+
+JSObject*
+HTMLParagraphElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return HTMLParagraphElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+} // namespace dom
+} // namespace mozilla
copy from content/html/content/src/nsHTMLParagraphElement.cpp
copy to content/html/content/src/HTMLParagraphElement.h
--- a/content/html/content/src/nsHTMLParagraphElement.cpp
+++ b/content/html/content/src/HTMLParagraphElement.h
@@ -1,34 +1,34 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifndef mozilla_dom_HTMLParagraphElement_h
+#define mozilla_dom_HTMLParagraphElement_h
+
 #include "mozilla/Util.h"
 
 #include "nsIDOMHTMLParagraphElement.h"
-#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
-#include "nsGkAtoms.h"
-#include "nsStyleConsts.h"
-#include "nsMappedAttributes.h"
-#include "nsRuleData.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-// XXX missing nav attributes
-
-class nsHTMLParagraphElement : public nsGenericHTMLElement,
-                               public nsIDOMHTMLParagraphElement
+class HTMLParagraphElement : public nsGenericHTMLElement,
+                             public nsIDOMHTMLParagraphElement
 {
 public:
-  nsHTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLParagraphElement();
+  HTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : nsGenericHTMLElement(aNodeInfo)
+  {
+    SetIsDOMBinding();
+  }
+  virtual ~HTMLParagraphElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -47,82 +47,25 @@ public:
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
+
+  // WebIDL API
+  // The XPCOM GetAlign is fine for our purposes
+  void SetAlign(const nsAString& aValue, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::align, aValue, rv);
+  }
+
+protected:
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap) MOZ_OVERRIDE;
 };
 
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(Paragraph)
-
-
-nsHTMLParagraphElement::nsHTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-{
-}
-
-nsHTMLParagraphElement::~nsHTMLParagraphElement()
-{
-}
-
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLParagraphElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLParagraphElement, Element)
-
-DOMCI_NODE_DATA(HTMLParagraphElement, nsHTMLParagraphElement)
-
-// QueryInterface implementation for nsHTMLParagraphElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLParagraphElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLParagraphElement,
-                                   nsIDOMHTMLParagraphElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLParagraphElement,
-                                               nsGenericHTMLElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLParagraphElement)
-
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLParagraphElement)
-
-
-NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align)
-
+} // namespace dom
+} // namespace mozilla
 
-bool
-nsHTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
-                                       nsIAtom* aAttribute,
-                                       const nsAString& aValue,
-                                       nsAttrValue& aResult)
-{
-  if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
-    return ParseDivAlignValue(aValue, aResult);
-  }
-
-  return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
-                                              aResult);
-}
-
-static void
-MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
-{
-  nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
-  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLParagraphElement::IsAttributeMapped(const nsIAtom* aAttribute) const
-{
-  static const MappedAttributeEntry* const map[] = {
-    sDivAlignAttributeMap,
-    sCommonAttributeMap,
-  };
-
-  return FindAttributeDependence(aAttribute, map);
-}
-
-
-nsMapRuleToAttributesFunc
-nsHTMLParagraphElement::GetAttributeMappingFunction() const
-{
-  return &MapAttributesIntoRule;
-}
+#endif // mozilla_dom_HTMLParagraphElement_h
rename from content/html/content/src/nsHTMLPreElement.cpp
rename to content/html/content/src/HTMLPreElement.cpp
--- a/content/html/content/src/nsHTMLPreElement.cpp
+++ b/content/html/content/src/HTMLPreElement.cpp
@@ -1,103 +1,51 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "mozilla/Util.h"
+#include "mozilla/dom/HTMLPreElement.h"
+#include "mozilla/dom/HTMLPreElementBinding.h"
 
-#include "nsIDOMHTMLPreElement.h"
-#include "nsIDOMEventTarget.h"
-#include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
-class nsHTMLPreElement : public nsGenericHTMLElement,
-                         public nsIDOMHTMLPreElement
-{
-public:
-  nsHTMLPreElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLPreElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
+NS_IMPL_NS_NEW_HTML_ELEMENT(Pre)
+DOMCI_NODE_DATA(HTMLPreElement, mozilla::dom::HTMLPreElement)
 
-  // nsIDOMHTMLPreElement
-  NS_IMETHOD GetWidth(int32_t* aWidth);
-  NS_IMETHOD SetWidth(int32_t aWidth);
-
-  virtual bool ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult);
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
-  virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
+namespace mozilla {
+namespace dom {
 
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-};
-
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(Pre)
-
-
-nsHTMLPreElement::nsHTMLPreElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLPreElement::~HTMLPreElement()
 {
 }
 
-nsHTMLPreElement::~nsHTMLPreElement()
-{
-}
-
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLPreElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLPreElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLPreElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLPreElement, Element)
 
-
-DOMCI_NODE_DATA(HTMLPreElement, nsHTMLPreElement)
-
-// QueryInterface implementation for nsHTMLPreElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLPreElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLPreElement, nsIDOMHTMLPreElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLPreElement,
+// QueryInterface implementation for HTMLPreElement
+NS_INTERFACE_TABLE_HEAD(HTMLPreElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLPreElement, nsIDOMHTMLPreElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLPreElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLPreElement)
 
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLPreElement)
+NS_IMPL_ELEMENT_CLONE(HTMLPreElement)
 
-
-NS_IMPL_INT_ATTR(nsHTMLPreElement, Width, width)
-
+NS_IMPL_INT_ATTR(HTMLPreElement, Width, width)
 
 bool
-nsHTMLPreElement::ParseAttribute(int32_t aNamespaceID,
-                                 nsIAtom* aAttribute,
-                                 const nsAString& aValue,
-                                 nsAttrValue& aResult)
+HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
+                               nsIAtom* aAttribute,
+                               const nsAString& aValue,
+                               nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::cols) {
       return aResult.ParseIntWithBounds(aValue, 0);
     }
     if (aAttribute == nsGkAtoms::width) {
       return aResult.ParseIntWithBounds(aValue, 0);
     }
@@ -146,17 +94,17 @@ MapAttributesIntoRule(const nsMappedAttr
       }
     }
   }
 
   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLPreElement::IsAttributeMapped(const nsIAtom* aAttribute) const
+HTMLPreElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry attributes[] = {
     { &nsGkAtoms::wrap },
     { &nsGkAtoms::cols },
     { &nsGkAtoms::width },
     { nullptr },
   };
   
@@ -164,12 +112,21 @@ nsHTMLPreElement::IsAttributeMapped(cons
     attributes,
     sCommonAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
 nsMapRuleToAttributesFunc
-nsHTMLPreElement::GetAttributeMappingFunction() const
+HTMLPreElement::GetAttributeMappingFunction() const
 {
   return &MapAttributesIntoRule;
 }
+
+JSObject*
+HTMLPreElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return HTMLPreElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+} // namespace dom
+} // namespace mozilla
copy from content/html/content/src/nsHTMLPreElement.cpp
copy to content/html/content/src/HTMLPreElement.h
--- a/content/html/content/src/nsHTMLPreElement.cpp
+++ b/content/html/content/src/HTMLPreElement.h