Merge the last PGO-green inbound changeset to m-c.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 04 Feb 2013 06:51:57 -0500
changeset 120731 2a8e243711a98a8cc6b7b4a9e6bbbd5e41d7ad28
parent 120730 847e28c7ba6738b22cdf7c7021f423509464356d (current diff)
parent 120722 6fec3ed8b9a20999a401533940c8a853f6ab0ed5 (diff)
child 120732 0f5d67cdf79c1bdd8ed7a786ca85ea07f57b1110
child 120789 de946331d8861c358a483241fe34c67d8b61498a
push id22388
push userryanvm@gmail.com
push dateMon, 04 Feb 2013 12:12:00 +0000
treeherdermozilla-inbound@3d2d50b222e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone21.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 the last PGO-green inbound changeset to m-c.
accessible/src/base/NotificationController.cpp
accessible/src/base/NotificationController.h
content/html/content/src/nsHTMLBRElement.cpp
content/html/content/src/nsHTMLStyleElement.cpp
services/healthreport/modules-testing/utils.jsm
--- a/content/base/src/nsStyleLinkElement.h
+++ b/content/base/src/nsStyleLinkElement.h
@@ -36,16 +36,18 @@ public:
   nsStyleLinkElement();
   virtual ~nsStyleLinkElement();
 
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0;
 
   // nsIDOMLinkStyle
   NS_DECL_NSIDOMLINKSTYLE
 
+  nsIStyleSheet* GetSheet() { return mStyleSheet; }
+
   // nsIStyleSheetLinkingElement  
   NS_IMETHOD SetStyleSheet(nsIStyleSheet* aStyleSheet);
   NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet);
   NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle);
   NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
                               bool* aWillNotify,
                               bool* aIsAlternate);
   NS_IMETHOD SetEnableUpdates(bool aEnableUpdates);
@@ -73,18 +75,16 @@ protected:
 
   virtual already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) = 0;
   virtual void GetStyleSheetInfo(nsAString& aTitle,
                                  nsAString& aType,
                                  nsAString& aMedia,
                                  bool* aIsScoped,
                                  bool* aIsAlternate) = 0;
 
-  nsIStyleSheet* GetStyleSheet() { return mStyleSheet; }
-
   virtual mozilla::CORSMode GetCORSMode() const
   {
     // Default to no CORS
     return mozilla::CORS_NONE;
   }
 
   // CC methods
   void Unlink();
rename from content/html/content/src/nsHTMLBRElement.cpp
rename to content/html/content/src/HTMLBRElement.cpp
--- a/content/html/content/src/nsHTMLBRElement.cpp
+++ b/content/html/content/src/HTMLBRElement.cpp
@@ -1,105 +1,70 @@
 /* -*- 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/dom/HTMLBRElement.h"
+#include "mozilla/dom/HTMLBRElementBinding.h"
 #include "mozilla/Util.h"
 
-#include "nsIDOMHTMLBRElement.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 nsHTMLBRElement : public nsGenericHTMLElement,
-                        public nsIDOMHTMLBRElement
-{
-public:
-  nsHTMLBRElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLBRElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLBRElement
-  NS_DECL_NSIDOMHTMLBRELEMENT    
-
-  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(BR)
 
+DOMCI_NODE_DATA(HTMLBRElement, mozilla::dom::HTMLBRElement)
 
-nsHTMLBRElement::nsHTMLBRElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+namespace mozilla {
+namespace dom {
+
+HTMLBRElement::HTMLBRElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
 {
+  SetIsDOMBinding();
 }
 
-nsHTMLBRElement::~nsHTMLBRElement()
+HTMLBRElement::~HTMLBRElement()
 {
 }
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLBRElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLBRElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLBRElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLBRElement, Element)
 
 
-DOMCI_NODE_DATA(HTMLBRElement, nsHTMLBRElement)
-
-// QueryInterface implementation for nsHTMLBRElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLBRElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLBRElement, nsIDOMHTMLBRElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLBRElement,
+// QueryInterface implementation for HTMLBRElement
+NS_INTERFACE_TABLE_HEAD(HTMLBRElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLBRElement, nsIDOMHTMLBRElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLBRElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLBRElement)
 
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLBRElement)
+NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
 
 
-NS_IMPL_STRING_ATTR(nsHTMLBRElement, Clear, clear)
+NS_IMPL_STRING_ATTR(HTMLBRElement, Clear, clear)
 
 static const nsAttrValue::EnumTable kClearTable[] = {
   { "left", NS_STYLE_CLEAR_LEFT },
   { "right", NS_STYLE_CLEAR_RIGHT },
   { "all", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
   { "both", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
   { 0 }
 };
 
 bool
-nsHTMLBRElement::ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult)
+HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
+                              nsIAtom* aAttribute,
+                              const nsAString& aValue,
+                              nsAttrValue& aResult)
 {
   if (aAttribute == nsGkAtoms::clear && aNamespaceID == kNameSpaceID_None) {
     return aResult.ParseEnumValue(aValue, kClearTable, false);
   }
 
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                               aResult);
 }
@@ -116,28 +81,38 @@ MapAttributesIntoRule(const nsMappedAttr
         clear->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
     }
   }
 
   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLBRElement::IsAttributeMapped(const nsIAtom* aAttribute) const
+HTMLBRElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry attributes[] = {
     { &nsGkAtoms::clear },
     { nullptr }
   };
 
   static const MappedAttributeEntry* const map[] = {
     attributes,
     sCommonAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
 nsMapRuleToAttributesFunc
-nsHTMLBRElement::GetAttributeMappingFunction() const
+HTMLBRElement::GetAttributeMappingFunction() const
 {
   return &MapAttributesIntoRule;
 }
+
+JSObject*
+HTMLBRElement::WrapNode(JSContext *aCx, JSObject *aScope,
+                        bool* aTriedToWrap)
+{
+  return HTMLBRElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+} // namespace dom
+} // namespace mozilla
copy from content/html/content/src/nsHTMLBRElement.cpp
copy to content/html/content/src/HTMLBRElement.h
--- a/content/html/content/src/nsHTMLBRElement.cpp
+++ b/content/html/content/src/HTMLBRElement.h
@@ -1,143 +1,65 @@
 /* -*- 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_HTMLBRElement_h
+#define mozilla_dom_HTMLBRElement_h
 
 #include "nsIDOMHTMLBRElement.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 nsHTMLBRElement : public nsGenericHTMLElement,
-                        public nsIDOMHTMLBRElement
+class HTMLBRElement MOZ_FINAL : public nsGenericHTMLElement,
+                                public nsIDOMHTMLBRElement
 {
 public:
-  nsHTMLBRElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLBRElement();
+  HTMLBRElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual ~HTMLBRElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
 
   // nsIDOMHTMLBRElement
-  NS_DECL_NSIDOMHTMLBRELEMENT    
+  NS_DECL_NSIDOMHTMLBRELEMENT
 
   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(BR)
-
-
-nsHTMLBRElement::nsHTMLBRElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-{
-}
-
-nsHTMLBRElement::~nsHTMLBRElement()
-{
-}
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLBRElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLBRElement, Element)
-
 
-DOMCI_NODE_DATA(HTMLBRElement, nsHTMLBRElement)
-
-// QueryInterface implementation for nsHTMLBRElement
-NS_INTERFACE_TABLE_HEAD(nsHTMLBRElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLBRElement, nsIDOMHTMLBRElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLBRElement,
-                                               nsGenericHTMLElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLBRElement)
-
+  bool Clear()
+  {
+    return GetBoolAttr(nsGkAtoms::clear);
+  }
+  void SetClear(const nsAString& aClear, ErrorResult& aError)
+  {
+    return SetHTMLAttr(nsGkAtoms::clear, aClear, aError);
+  }
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLBRElement)
-
-
-NS_IMPL_STRING_ATTR(nsHTMLBRElement, Clear, clear)
-
-static const nsAttrValue::EnumTable kClearTable[] = {
-  { "left", NS_STYLE_CLEAR_LEFT },
-  { "right", NS_STYLE_CLEAR_RIGHT },
-  { "all", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
-  { "both", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
-  { 0 }
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap);
 };
 
-bool
-nsHTMLBRElement::ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult)
-{
-  if (aAttribute == nsGkAtoms::clear && aNamespaceID == kNameSpaceID_None) {
-    return aResult.ParseEnumValue(aValue, kClearTable, false);
-  }
-
-  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(Display)) {
-    nsCSSValue* clear = aData->ValueForClear();
-    if (clear->GetUnit() == eCSSUnit_Null) {
-      const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::clear);
-      if (value && value->Type() == nsAttrValue::eEnum)
-        clear->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
-    }
-  }
-
-  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
-}
+#endif
 
-NS_IMETHODIMP_(bool)
-nsHTMLBRElement::IsAttributeMapped(const nsIAtom* aAttribute) const
-{
-  static const MappedAttributeEntry attributes[] = {
-    { &nsGkAtoms::clear },
-    { nullptr }
-  };
-
-  static const MappedAttributeEntry* const map[] = {
-    attributes,
-    sCommonAttributeMap,
-  };
-
-  return FindAttributeDependence(aAttribute, map);
-}
-
-nsMapRuleToAttributesFunc
-nsHTMLBRElement::GetAttributeMappingFunction() const
-{
-  return &MapAttributesIntoRule;
-}
rename from content/html/content/src/nsHTMLStyleElement.cpp
rename to content/html/content/src/HTMLStyleElement.cpp
--- a/content/html/content/src/nsHTMLStyleElement.cpp
+++ b/content/html/content/src/HTMLStyleElement.cpp
@@ -1,250 +1,195 @@
 /* -*- 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 "nsIDOMHTMLStyleElement.h"
+#include "mozilla/dom/HTMLStyleElement.h"
+#include "mozilla/dom/HTMLStyleElementBinding.h"
 #include "nsIDOMLinkStyle.h"
 #include "nsIDOMEventTarget.h"
-#include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsIDOMStyleSheet.h"
 #include "nsIStyleSheet.h"
-#include "nsStyleLinkElement.h"
 #include "nsNetUtil.h"
 #include "nsIDocument.h"
 #include "nsUnicharUtils.h"
 #include "nsThreadUtils.h"
 #include "nsContentUtils.h"
 #include "nsStubMutationObserver.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
-class nsHTMLStyleElement : public nsGenericHTMLElement,
-                           public nsIDOMHTMLStyleElement,
-                           public nsStyleLinkElement,
-                           public nsStubMutationObserver
-{
-public:
-  nsHTMLStyleElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLStyleElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // CC
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLStyleElement,
-                                           nsGenericHTMLElement)
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  virtual void GetInnerHTML(nsAString& aInnerHTML,
-                            mozilla::ErrorResult& aError) MOZ_OVERRIDE;
-  virtual void SetInnerHTML(const nsAString& aInnerHTML,
-                            mozilla::ErrorResult& aError) MOZ_OVERRIDE;
-
-  // nsIDOMHTMLStyleElement
-  NS_DECL_NSIDOMHTMLSTYLEELEMENT
-
-  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                              nsIContent* aBindingParent,
-                              bool aCompileEventHandlers);
-  virtual void UnbindFromTree(bool aDeep = true,
-                              bool aNullParent = true);
-  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 nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  // nsIMutationObserver
-  NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
-  NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
-  NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
-  NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-protected:
-  already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline);
-  void GetStyleSheetInfo(nsAString& aTitle,
-                         nsAString& aType,
-                         nsAString& aMedia,
-                         bool* aIsScoped,
-                         bool* aIsAlternate);
-  /**
-   * Common method to call from the various mutation observer methods.
-   * aContent is a content node that's either the one that changed or its
-   * parent; we should only respond to the change if aContent is non-anonymous.
-   */
-  void ContentChanged(nsIContent* aContent);
-};
-
-
 NS_IMPL_NS_NEW_HTML_ELEMENT(Style)
 
+DOMCI_NODE_DATA(HTMLStyleElement, mozilla::dom::HTMLStyleElement)
 
-nsHTMLStyleElement::nsHTMLStyleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+namespace mozilla {
+namespace dom {
+
+HTMLStyleElement::HTMLStyleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
 {
   AddMutationObserver(this);
+  SetIsDOMBinding();
 }
 
-nsHTMLStyleElement::~nsHTMLStyleElement()
+HTMLStyleElement::~HTMLStyleElement()
 {
 }
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLStyleElement,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLStyleElement,
                                                   nsGenericHTMLElement)
   tmp->nsStyleLinkElement::Traverse(cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLStyleElement,
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLStyleElement,
                                                 nsGenericHTMLElement)
   tmp->nsStyleLinkElement::Unlink();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLStyleElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLStyleElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLStyleElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLStyleElement, Element)
 
 
-DOMCI_NODE_DATA(HTMLStyleElement, nsHTMLStyleElement)
-
-// QueryInterface implementation for nsHTMLStyleElement
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLStyleElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE4(nsHTMLStyleElement,
+// QueryInterface implementation for HTMLStyleElement
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLStyleElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE4(HTMLStyleElement,
                                    nsIDOMHTMLStyleElement,
                                    nsIDOMLinkStyle,
                                    nsIStyleSheetLinkingElement,
                                    nsIMutationObserver)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLStyleElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLStyleElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLStyleElement)
 
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLStyleElement)
+NS_IMPL_ELEMENT_CLONE(HTMLStyleElement)
 
 
 NS_IMETHODIMP
-nsHTMLStyleElement::GetDisabled(bool* aDisabled)
+HTMLStyleElement::GetDisabled(bool* aDisabled)
 {
-  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetStyleSheet());
+  NS_ENSURE_ARG_POINTER(aDisabled);
+
+  *aDisabled = Disabled();
+  return NS_OK;
+}
+
+bool
+HTMLStyleElement::Disabled()
+{
+  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
   if (!ss) {
-    *aDisabled = false;
-    return NS_OK;
+    return false;
   }
 
-  return ss->GetDisabled(aDisabled);
+  bool disabled = false;
+  ss->GetDisabled(&disabled);
+
+  return disabled;
 }
 
-NS_IMETHODIMP 
-nsHTMLStyleElement::SetDisabled(bool aDisabled)
+NS_IMETHODIMP
+HTMLStyleElement::SetDisabled(bool aDisabled)
 {
-  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetStyleSheet());
+  ErrorResult error;
+  SetDisabled(aDisabled, error);
+  return error.ErrorCode();
+}
+
+void
+HTMLStyleElement::SetDisabled(bool aDisabled, ErrorResult& aError)
+{
+  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
   if (!ss) {
-    return NS_OK;
+    return;
   }
 
-  return ss->SetDisabled(aDisabled);
+  nsresult result = ss->SetDisabled(aDisabled);
+  if (NS_FAILED(result)) {
+    aError.Throw(result);
+  }
 }
 
-NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Media, media)
-NS_IMPL_BOOL_ATTR(nsHTMLStyleElement, Scoped, scoped)
-NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Type, type)
+NS_IMPL_STRING_ATTR(HTMLStyleElement, Media, media)
+NS_IMPL_BOOL_ATTR(HTMLStyleElement, Scoped, scoped)
+NS_IMPL_STRING_ATTR(HTMLStyleElement, Type, type)
 
 void
-nsHTMLStyleElement::CharacterDataChanged(nsIDocument* aDocument,
-                                         nsIContent* aContent,
-                                         CharacterDataChangeInfo* aInfo)
+HTMLStyleElement::CharacterDataChanged(nsIDocument* aDocument,
+                                       nsIContent* aContent,
+                                       CharacterDataChangeInfo* aInfo)
 {
   ContentChanged(aContent);
 }
 
 void
-nsHTMLStyleElement::ContentAppended(nsIDocument* aDocument,
-                                    nsIContent* aContainer,
-                                    nsIContent* aFirstNewContent,
-                                    int32_t aNewIndexInContainer)
+HTMLStyleElement::ContentAppended(nsIDocument* aDocument,
+                                  nsIContent* aContainer,
+                                  nsIContent* aFirstNewContent,
+                                  int32_t aNewIndexInContainer)
 {
   ContentChanged(aContainer);
 }
 
 void
-nsHTMLStyleElement::ContentInserted(nsIDocument* aDocument,
-                                    nsIContent* aContainer,
-                                    nsIContent* aChild,
-                                    int32_t aIndexInContainer)
+HTMLStyleElement::ContentInserted(nsIDocument* aDocument,
+                                  nsIContent* aContainer,
+                                  nsIContent* aChild,
+                                  int32_t aIndexInContainer)
 {
   ContentChanged(aChild);
 }
 
 void
-nsHTMLStyleElement::ContentRemoved(nsIDocument* aDocument,
-                                   nsIContent* aContainer,
-                                   nsIContent* aChild,
-                                   int32_t aIndexInContainer,
-                                   nsIContent* aPreviousSibling)
+HTMLStyleElement::ContentRemoved(nsIDocument* aDocument,
+                                 nsIContent* aContainer,
+                                 nsIContent* aChild,
+                                 int32_t aIndexInContainer,
+                                 nsIContent* aPreviousSibling)
 {
   ContentChanged(aChild);
 }
 
 void
-nsHTMLStyleElement::ContentChanged(nsIContent* aContent)
+HTMLStyleElement::ContentChanged(nsIContent* aContent)
 {
   if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
     UpdateStyleSheetInternal(nullptr);
   }
 }
 
 nsresult
-nsHTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                               nsIContent* aBindingParent,
-                               bool aCompileEventHandlers)
+HTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
+                             nsIContent* aBindingParent,
+                             bool aCompileEventHandlers)
 {
   nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  void (nsHTMLStyleElement::*update)() = &nsHTMLStyleElement::UpdateStyleSheetInternal;
+  void (HTMLStyleElement::*update)() = &HTMLStyleElement::UpdateStyleSheetInternal;
   nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, update));
 
   return rv;  
 }
 
 void
-nsHTMLStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
+HTMLStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
 
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
   UpdateStyleSheetInternal(oldDoc);
 }
 
 nsresult
-nsHTMLStyleElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                            nsIAtom* aPrefix, const nsAString& aValue,
-                            bool aNotify)
+HTMLStyleElement::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) && aNameSpaceID == kNameSpaceID_None) {
     if (aName == nsGkAtoms::title ||
         aName == nsGkAtoms::media ||
         aName == nsGkAtoms::type) {
       UpdateStyleSheetInternal(nullptr, true);
@@ -252,18 +197,18 @@ nsHTMLStyleElement::SetAttr(int32_t aNam
       UpdateStyleSheetScopedness(true);
     }
   }
 
   return rv;
 }
 
 nsresult
-nsHTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
-                              bool aNotify)
+HTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
+                            bool aNotify)
 {
   nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
                                                 aNotify);
   if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::title ||
         aAttribute == nsGkAtoms::media ||
         aAttribute == nsGkAtoms::type) {
       UpdateStyleSheetInternal(nullptr, true);
@@ -271,47 +216,47 @@ nsHTMLStyleElement::UnsetAttr(int32_t aN
       UpdateStyleSheetScopedness(false);
     }
   }
 
   return rv;
 }
 
 void
-nsHTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
+HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
 {
   nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
 }
 
 void
-nsHTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML,
-                                 ErrorResult& aError)
+HTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML,
+                               ErrorResult& aError)
 {
   SetEnableUpdates(false);
 
   aError = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
 
   SetEnableUpdates(true);
 
   UpdateStyleSheetInternal(nullptr);
 }
 
 already_AddRefed<nsIURI>
-nsHTMLStyleElement::GetStyleSheetURL(bool* aIsInline)
+HTMLStyleElement::GetStyleSheetURL(bool* aIsInline)
 {
   *aIsInline = true;
   return nullptr;
 }
 
 void
-nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
-                                      nsAString& aType,
-                                      nsAString& aMedia,
-                                      bool* aIsScoped,
-                                      bool* aIsAlternate)
+HTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
+                                    nsAString& aType,
+                                    nsAString& aMedia,
+                                    bool* aIsScoped,
+                                    bool* aIsAlternate)
 {
   aTitle.Truncate();
   aType.Truncate();
   aMedia.Truncate();
   *aIsAlternate = false;
 
   nsAutoString title;
   GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
@@ -333,8 +278,19 @@ nsHTMLStyleElement::GetStyleSheetInfo(ns
   if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
     return;
   }
 
   // If we get here we assume that we're loading a css file, so set the
   // type to 'text/css'
   aType.AssignLiteral("text/css");
 }
+
+JSObject*
+HTMLStyleElement::WrapNode(JSContext *aCx, JSObject *aScope,
+                           bool *aTriedToWrap)
+{
+  return HTMLStyleElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+} // namespace dom
+} // namespace mozilla
+
copy from content/html/content/src/nsHTMLStyleElement.cpp
copy to content/html/content/src/HTMLStyleElement.h
--- a/content/html/content/src/nsHTMLStyleElement.cpp
+++ b/content/html/content/src/HTMLStyleElement.h
@@ -1,45 +1,40 @@
 /* -*- 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_HTMLStyleElement_h
+#define mozilla_dom_HTMLStyleElement_h
+
 #include "nsIDOMHTMLStyleElement.h"
-#include "nsIDOMLinkStyle.h"
-#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
-#include "nsGkAtoms.h"
-#include "nsStyleConsts.h"
-#include "nsIDOMStyleSheet.h"
-#include "nsIStyleSheet.h"
 #include "nsStyleLinkElement.h"
-#include "nsNetUtil.h"
-#include "nsIDocument.h"
-#include "nsUnicharUtils.h"
-#include "nsThreadUtils.h"
-#include "nsContentUtils.h"
 #include "nsStubMutationObserver.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+class nsIDocument;
+
+namespace mozilla {
+namespace dom {
 
-class nsHTMLStyleElement : public nsGenericHTMLElement,
-                           public nsIDOMHTMLStyleElement,
-                           public nsStyleLinkElement,
-                           public nsStubMutationObserver
+class HTMLStyleElement MOZ_FINAL : public nsGenericHTMLElement,
+                                   public nsIDOMHTMLStyleElement,
+                                   public nsStyleLinkElement,
+                                   public nsStubMutationObserver
 {
 public:
-  nsHTMLStyleElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLStyleElement();
+  HTMLStyleElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual ~HTMLStyleElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLStyleElement,
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
                                            nsGenericHTMLElement)
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
@@ -73,16 +68,38 @@ public:
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   // nsIMutationObserver
   NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
+  bool Disabled();
+  void SetDisabled(bool aDisabled, ErrorResult& aError);
+  void SetMedia(const nsAString& aMedia, ErrorResult& aError)
+  {
+    SetHTMLAttr(nsGkAtoms::media, aMedia, aError);
+  }
+  void SetType(const nsAString& aType, ErrorResult& aError)
+  {
+    SetHTMLAttr(nsGkAtoms::type, aType, aError);
+  }
+  bool Scoped()
+  {
+    return GetBoolAttr(nsGkAtoms::scoped);
+  }
+  void SetScoped(bool aScoped, ErrorResult& aError)
+  {
+    SetHTMLBoolAttr(nsGkAtoms::scoped, aScoped, aError);
+  }
+
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
+                             bool *aTriedToWrap);
+
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 protected:
   already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline);
   void GetStyleSheetInfo(nsAString& aTitle,
                          nsAString& aType,
                          nsAString& aMedia,
@@ -91,250 +108,13 @@ protected:
   /**
    * Common method to call from the various mutation observer methods.
    * aContent is a content node that's either the one that changed or its
    * parent; we should only respond to the change if aContent is non-anonymous.
    */
   void ContentChanged(nsIContent* aContent);
 };
 
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(Style)
-
-
-nsHTMLStyleElement::nsHTMLStyleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-{
-  AddMutationObserver(this);
-}
-
-nsHTMLStyleElement::~nsHTMLStyleElement()
-{
-}
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLStyleElement,
-                                                  nsGenericHTMLElement)
-  tmp->nsStyleLinkElement::Traverse(cb);
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLStyleElement,
-                                                nsGenericHTMLElement)
-  tmp->nsStyleLinkElement::Unlink();
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLStyleElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLStyleElement, Element)
-
-
-DOMCI_NODE_DATA(HTMLStyleElement, nsHTMLStyleElement)
-
-// QueryInterface implementation for nsHTMLStyleElement
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLStyleElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE4(nsHTMLStyleElement,
-                                   nsIDOMHTMLStyleElement,
-                                   nsIDOMLinkStyle,
-                                   nsIStyleSheetLinkingElement,
-                                   nsIMutationObserver)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLStyleElement,
-                                               nsGenericHTMLElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLStyleElement)
-
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLStyleElement)
-
-
-NS_IMETHODIMP
-nsHTMLStyleElement::GetDisabled(bool* aDisabled)
-{
-  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetStyleSheet());
-  if (!ss) {
-    *aDisabled = false;
-    return NS_OK;
-  }
-
-  return ss->GetDisabled(aDisabled);
-}
-
-NS_IMETHODIMP 
-nsHTMLStyleElement::SetDisabled(bool aDisabled)
-{
-  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetStyleSheet());
-  if (!ss) {
-    return NS_OK;
-  }
-
-  return ss->SetDisabled(aDisabled);
-}
-
-NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Media, media)
-NS_IMPL_BOOL_ATTR(nsHTMLStyleElement, Scoped, scoped)
-NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Type, type)
-
-void
-nsHTMLStyleElement::CharacterDataChanged(nsIDocument* aDocument,
-                                         nsIContent* aContent,
-                                         CharacterDataChangeInfo* aInfo)
-{
-  ContentChanged(aContent);
-}
-
-void
-nsHTMLStyleElement::ContentAppended(nsIDocument* aDocument,
-                                    nsIContent* aContainer,
-                                    nsIContent* aFirstNewContent,
-                                    int32_t aNewIndexInContainer)
-{
-  ContentChanged(aContainer);
-}
-
-void
-nsHTMLStyleElement::ContentInserted(nsIDocument* aDocument,
-                                    nsIContent* aContainer,
-                                    nsIContent* aChild,
-                                    int32_t aIndexInContainer)
-{
-  ContentChanged(aChild);
-}
-
-void
-nsHTMLStyleElement::ContentRemoved(nsIDocument* aDocument,
-                                   nsIContent* aContainer,
-                                   nsIContent* aChild,
-                                   int32_t aIndexInContainer,
-                                   nsIContent* aPreviousSibling)
-{
-  ContentChanged(aChild);
-}
-
-void
-nsHTMLStyleElement::ContentChanged(nsIContent* aContent)
-{
-  if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
-    UpdateStyleSheetInternal(nullptr);
-  }
-}
+} // namespace dom
+} // namespace mozilla
 
-nsresult
-nsHTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                               nsIContent* aBindingParent,
-                               bool aCompileEventHandlers)
-{
-  nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
-                                                 aBindingParent,
-                                                 aCompileEventHandlers);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  void (nsHTMLStyleElement::*update)() = &nsHTMLStyleElement::UpdateStyleSheetInternal;
-  nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, update));
-
-  return rv;  
-}
-
-void
-nsHTMLStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
-{
-  nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
-
-  nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
-  UpdateStyleSheetInternal(oldDoc);
-}
-
-nsresult
-nsHTMLStyleElement::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) && aNameSpaceID == kNameSpaceID_None) {
-    if (aName == nsGkAtoms::title ||
-        aName == nsGkAtoms::media ||
-        aName == nsGkAtoms::type) {
-      UpdateStyleSheetInternal(nullptr, true);
-    } else if (aName == nsGkAtoms::scoped) {
-      UpdateStyleSheetScopedness(true);
-    }
-  }
-
-  return rv;
-}
-
-nsresult
-nsHTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
-                              bool aNotify)
-{
-  nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
-                                                aNotify);
-  if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
-    if (aAttribute == nsGkAtoms::title ||
-        aAttribute == nsGkAtoms::media ||
-        aAttribute == nsGkAtoms::type) {
-      UpdateStyleSheetInternal(nullptr, true);
-    } else if (aAttribute == nsGkAtoms::scoped) {
-      UpdateStyleSheetScopedness(false);
-    }
-  }
-
-  return rv;
-}
+#endif
 
-void
-nsHTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
-{
-  nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
-}
-
-void
-nsHTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML,
-                                 ErrorResult& aError)
-{
-  SetEnableUpdates(false);
-
-  aError = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
-
-  SetEnableUpdates(true);
-
-  UpdateStyleSheetInternal(nullptr);
-}
-
-already_AddRefed<nsIURI>
-nsHTMLStyleElement::GetStyleSheetURL(bool* aIsInline)
-{
-  *aIsInline = true;
-  return nullptr;
-}
-
-void
-nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
-                                      nsAString& aType,
-                                      nsAString& aMedia,
-                                      bool* aIsScoped,
-                                      bool* aIsAlternate)
-{
-  aTitle.Truncate();
-  aType.Truncate();
-  aMedia.Truncate();
-  *aIsAlternate = false;
-
-  nsAutoString title;
-  GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
-  title.CompressWhitespace();
-  aTitle.Assign(title);
-
-  GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
-  // The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
-  // that media queries should be ASCII lowercased during serialization.
-  nsContentUtils::ASCIIToLower(aMedia);
-
-  GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
-
-  *aIsScoped = HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
-
-  nsAutoString mimeType;
-  nsAutoString notUsed;
-  nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
-  if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
-    return;
-  }
-
-  // If we get here we assume that we're loading a css file, so set the
-  // type to 'text/css'
-  aType.AssignLiteral("text/css");
-}
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -27,29 +27,31 @@ EXPORTS		= \
 		nsTimeRanges.h \
 		$(NULL)
 
 EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
 		HTMLAnchorElement.h \
 		HTMLBodyElement.h \
+		HTMLBRElement.h \
 		HTMLDataListElement.h \
 		HTMLDivElement.h \
 		HTMLFontElement.h \
 		HTMLFrameSetElement.h \
 		HTMLHeadingElement.h \
 		HTMLImageElement.h \
 		HTMLLabelElement.h \
 		HTMLLIElement.h \
 		HTMLParagraphElement.h \
 		HTMLPreElement.h \
 		HTMLScriptElement.h \
 		HTMLSharedListElement.h \
 		HTMLSpanElement.h \
+		HTMLStyleElement.h \
 		HTMLTableCaptionElement.h \
 		HTMLTableCellElement.h \
 		HTMLTableColElement.h \
 		HTMLTableElement.h \
 		HTMLTableRowElement.h \
 		HTMLTableSectionElement.h \
 		HTMLTitleElement.h \
 		HTMLUnknownElement.h \
@@ -63,17 +65,17 @@ CPPSRCS		= \
 		nsHTMLDNSPrefetch.cpp \
 		nsGenericHTMLElement.cpp \
 		nsGenericHTMLFrameElement.cpp \
 		nsFormSubmission.cpp \
 		nsTextEditorState.cpp \
 		HTMLElement.cpp \
 		HTMLAnchorElement.cpp \
 		nsHTMLAreaElement.cpp \
-		nsHTMLBRElement.cpp \
+		HTMLBRElement.cpp \
 		HTMLBodyElement.cpp \
 		nsHTMLButtonElement.cpp \
 		HTMLCanvasElement.cpp \
 		HTMLDataListElement.cpp \
 		HTMLDivElement.cpp \
 		nsHTMLFieldSetElement.cpp \
 		HTMLFontElement.cpp \
 		nsHTMLFormElement.cpp \
@@ -102,17 +104,17 @@ CPPSRCS		= \
 		HTMLParagraphElement.cpp \
 		HTMLPreElement.cpp \
 		nsHTMLProgressElement.cpp \
 		HTMLScriptElement.cpp \
 		nsHTMLSelectElement.cpp \
 		nsHTMLSharedElement.cpp \
 		HTMLSpanElement.cpp \
 		HTMLSharedListElement.cpp \
-		nsHTMLStyleElement.cpp \
+		HTMLStyleElement.cpp \
 		HTMLTableElement.cpp \
 		HTMLTableCaptionElement.cpp \
 		HTMLTableCellElement.cpp \
 		HTMLTableColElement.cpp \
 		HTMLTableRowElement.cpp \
 		HTMLTableSectionElement.cpp \
 		nsHTMLTextAreaElement.cpp \
 		HTMLTitleElement.cpp \
--- a/content/html/content/src/nsHTMLLinkElement.cpp
+++ b/content/html/content/src/nsHTMLLinkElement.cpp
@@ -154,32 +154,32 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLA
 
 
 NS_IMPL_ELEMENT_CLONE(nsHTMLLinkElement)
 
 
 NS_IMETHODIMP
 nsHTMLLinkElement::GetDisabled(bool* aDisabled)
 {
-  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetStyleSheet());
+  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
   nsresult result = NS_OK;
 
   if (ss) {
     result = ss->GetDisabled(aDisabled);
   } else {
     *aDisabled = false;
   }
 
   return result;
 }
 
 NS_IMETHODIMP 
 nsHTMLLinkElement::SetDisabled(bool aDisabled)
 {
-  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetStyleSheet());
+  nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
   nsresult result = NS_OK;
 
   if (ss) {
     result = ss->SetDisabled(aDisabled);
   }
 
   return result;
 }
@@ -327,17 +327,17 @@ nsHTMLLinkElement::SetAttr(int32_t aName
 
   if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None &&
       (aName == nsGkAtoms::href ||
        aName == nsGkAtoms::rel ||
        aName == nsGkAtoms::title ||
        aName == nsGkAtoms::media ||
        aName == nsGkAtoms::type)) {
     bool dropSheet = false;
-    if (aName == nsGkAtoms::rel && GetStyleSheet()) {
+    if (aName == nsGkAtoms::rel && GetSheet()) {
       uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(aValue);
       dropSheet = !(linkTypes & STYLESHEET);          
     }
     
     UpdateStyleSheetInternal(nullptr,
                              dropSheet ||
                              (aName == nsGkAtoms::title ||
                               aName == nsGkAtoms::media ||
--- a/content/html/content/test/reflect.js
+++ b/content/html/content/test/reflect.js
@@ -56,18 +56,17 @@ function reflectString(aParameters)
 
   element[idlAttr] = null;
   // TODO: remove this ugly hack when null stringification will work as expected.
   var todoAttrs = {
     form: [ "acceptCharset", "name", "target" ],
     input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ],
     link: [ "crossOrigin" ],
     source: [ "media" ],
-    textarea: [ "name", "placeholder" ],
-    style: [ "media", "type" ]
+    textarea: [ "name", "placeholder" ]
   };
   if (!(element.localName in todoAttrs) || todoAttrs[element.localName].indexOf(idlAttr) == -1) {
     is(element.getAttribute(contentAttr), "null",
        "null should have been stringified to 'null'");
     is(element[idlAttr], "null", "null should have been stringified to 'null'");
     element.removeAttribute(contentAttr);
   } else {
     todo_is(element.getAttribute(contentAttr), "null",
--- a/content/xml/content/src/XMLStylesheetProcessingInstruction.h
+++ b/content/xml/content/src/XMLStylesheetProcessingInstruction.h
@@ -28,22 +28,16 @@ public:
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction,
                                            ProcessingInstruction)
 
-  using nsStyleLinkElement::GetSheet;
-  nsIStyleSheet* GetSheet()
-  {
-    return GetStyleSheet();
-  }
-
   // nsIDOMNode
   virtual void SetNodeValueInternal(const nsAString& aNodeValue,
                                     mozilla::ErrorResult& aError);
 
   // nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers);
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -345,17 +345,21 @@ DOMInterfaces = {
 'HTMLAnchorElement': {
     'binaryNames': {
         '__stringifier': 'Stringify'
     },
     'hasInstanceInterface': 'nsIDOMHTMLAnchorElement',
 },
 
 'HTMLBodyElement': {
-  'hasInstanceInterface': 'nsIDOMHTMLBodyElement',
+    'hasInstanceInterface': 'nsIDOMHTMLBodyElement',
+},
+
+'HTMLBRElement': {
+    'hasInstanceInterface': 'nsIDOMHTMLBRElement',
 },
 
 'HTMLCollection': {
     'nativeType': 'nsIHTMLCollection',
     'resultNotAddRefed': [ 'item' ]
 },
 
 'HTMLDataListElement': {
@@ -470,16 +474,23 @@ DOMInterfaces = {
 
 'HTMLTableSectionElement': {
     'hasInstanceInterface': 'nsIDOMHTMLTableSectionElement',
     'resultNotAddRefed': [
         'rows'
     ]
 },
 
+'HTMLStyleElement': {
+    'hasInstanceInterface': 'nsIDOMHTMLStyleElement',
+    'resultNotAddRefed': [
+        'sheet'
+    ]
+},
+
 'HTMLUListElement': {
     'headerFile' : 'mozilla/dom/HTMLSharedListElement.h'
 },
 
 'IID': [
 {
     'nativeType': 'nsIJSID',
     'headerFile': 'xpcjsid.h',
--- a/dom/network/tests/marionette/test_mobile_iccinfo.js
+++ b/dom/network/tests/marionette/test_mobile_iccinfo.js
@@ -14,24 +14,21 @@ function sendEmulatorCommand(cmd, callba
   emulatorCmdPendingCount++;
   runEmulatorCmd(cmd, function (result) {
     emulatorCmdPendingCount--;
     is(result[result.length - 1], "OK");
     callback(result);
   });
 }
 
-function setEmulatorMccMnc(mcc, mnc, callback) {
+function setEmulatorMccMnc(mcc, mnc) {
   let cmd = "operator set 0 Android,Android," + mcc + mnc;
   sendEmulatorCommand(cmd, function (result) {
     let re = new RegExp("" + mcc + mnc + "$");
     ok(result[0].match(re), "MCC/MNC should be changed.");
-    if (callback) {
-      callback();
-    }
   });
 }
 
 function waitForIccInfoChange(callback) {
   connection.addEventListener("iccinfochange", function handler() {
     connection.removeEventListener("iccinfochange", handler);
     callback();
   });
@@ -66,21 +63,23 @@ function testDisplayConditionChange(func
 
 function testSPN(mcc, mnc, expectedIsDisplayNetworkNameRequired,
                   expectedIsDisplaySpnRequired, callback) {
   waitForIccInfoChange(function() {
     is(connection.iccInfo.isDisplayNetworkNameRequired,
        expectedIsDisplayNetworkNameRequired);
     is(connection.iccInfo.isDisplaySpnRequired,
        expectedIsDisplaySpnRequired);
-    window.setTimeout(callback, 0);
+    // operatorchange will be ignored if we send commands too soon.
+    window.setTimeout(callback, 100);
   });
   setEmulatorMccMnc(mcc, mnc);
 }
 
 testDisplayConditionChange(testSPN, [
+  // [MCC, MNC, isDisplayNetworkNameRequired, isDisplaySpnRequired]
   [123, 456, false, true], // Not in HPLMN.
   [234, 136,  true, true], // Not in HPLMN, but in PLMN specified in SPDI.
   [123, 456, false, true], // Not in HPLMN. Triggering iccinfochange
   [466,  92,  true, true], // Not in HPLMN, but in another PLMN specified in SPDI.
   [123, 456, false, true], // Not in HPLMN. Triggering iccinfochange
   [310, 260,  true, true], // inside HPLMN.
 ], finalize);
--- a/dom/sms/src/ril/SmsDatabaseService.js
+++ b/dom/sms/src/ril/SmsDatabaseService.js
@@ -715,19 +715,18 @@ SmsDatabaseService.prototype = {
 
 
   /**
    * nsIRilSmsDatabaseService API
    */
 
   saveReceivedMessage: function saveReceivedMessage(
       aSender, aBody, aMessageClass, aDate, aCallback) {
-    let receiver = this.mRIL.rilContext.icc
-                 ? this.mRIL.rilContext.icc.msisdn
-                 : null;
+    let iccInfo = this.mRIL.rilContext.iccInfo;
+    let receiver = iccInfo ? iccInfo.msisdn : null;
 
     // Workaround an xpconnect issue with undefined string objects.
     // See bug 808220
     if (receiver === undefined || receiver === "undefined") {
       receiver = null;
     }
 
     if (receiver) {
@@ -760,29 +759,29 @@ SmsDatabaseService.prototype = {
       read:           FILTER_READ_UNREAD
     };
     return this.saveMessage(message, aCallback);
   },
 
   saveSendingMessage: function saveSendingMessage(
       aReceiver, aBody, aDeliveryStatus, aDate, aCallback) {
     let rilContext = this.mRIL.rilContext;
-    let sender = rilContext.icc
-               ? rilContext.icc.msisdn
+    let sender = rilContext.iccInfo
+               ? rilContext.iccInfo.msisdn
                : null;
 
     // Workaround an xpconnect issue with undefined string objects.
     // See bug 808220
     if (sender === undefined || sender === "undefined") {
       sender = null;
     }
 
     let receiver = aReceiver;
 
-    if (rilContext.voice.network.mcc === rilContext.icc.mcc) {
+    if (rilContext.voice.network.mcc === rilContext.iccInfo.mcc) {
       if (receiver) {
         let parsedNumber = PhoneNumberUtils.parse(receiver.toString());
         receiver = (parsedNumber && parsedNumber.internationalNumber)
                    ? parsedNumber.internationalNumber
                    : receiver;
       }
 
       if (sender) {
--- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp
+++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp
@@ -403,31 +403,33 @@ GonkGPSGeolocationProvider::RequestSetID
   }
 
   AGpsSetIDType type = AGPS_SETID_TYPE_NONE;
 
   nsCOMPtr<nsIRilContext> rilCtx;
   mRIL->GetRilContext(getter_AddRefs(rilCtx));
 
   if (rilCtx) {
-    nsCOMPtr<nsIICCRecords> icc;
-    rilCtx->GetIcc(getter_AddRefs(icc));
-    if (icc) {
-      nsAutoString id;
-      if (flags & AGPS_RIL_REQUEST_SETID_IMSI) {
-        type = AGPS_SETID_TYPE_IMSI;
-        icc->GetImsi(id);
+    nsAutoString id;
+    if (flags & AGPS_RIL_REQUEST_SETID_IMSI) {
+      type = AGPS_SETID_TYPE_IMSI;
+      rilCtx->GetImsi(id);
+    }
+
+    if (flags & AGPS_RIL_REQUEST_SETID_MSISDN) {
+      nsCOMPtr<nsIDOMMozMobileICCInfo> iccInfo;
+      rilCtx->GetIccInfo(getter_AddRefs(iccInfo));
+      if (iccInfo) {
+        type = AGPS_SETID_TYPE_MSISDN;
+        iccInfo->GetMsisdn(id);
       }
-      if (flags & AGPS_RIL_REQUEST_SETID_MSISDN) {
-        type = AGPS_SETID_TYPE_MSISDN;
-        icc->GetMsisdn(id);
-      }
-      NS_ConvertUTF16toUTF8 idBytes(id);
-      mAGpsRilInterface->set_set_id(type, idBytes.get());
     }
+
+    NS_ConvertUTF16toUTF8 idBytes(id);
+    mAGpsRilInterface->set_set_id(type, idBytes.get());
   }
 }
 
 void
 GonkGPSGeolocationProvider::SetReferenceLocation()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -439,21 +441,21 @@ GonkGPSGeolocationProvider::SetReference
   mRIL->GetRilContext(getter_AddRefs(rilCtx));
 
   AGpsRefLocation location;
 
   // TODO: Bug 772750 - get mobile connection technology from rilcontext
   location.type = AGPS_REF_LOCATION_TYPE_UMTS_CELLID;
 
   if (rilCtx) {
-    nsCOMPtr<nsIICCRecords> icc;
-    rilCtx->GetIcc(getter_AddRefs(icc));
-    if (icc) {
-      icc->GetMcc(&location.u.cellID.mcc);
-      icc->GetMnc(&location.u.cellID.mnc);
+    nsCOMPtr<nsIDOMMozMobileICCInfo> iccInfo;
+    rilCtx->GetIccInfo(getter_AddRefs(iccInfo));
+    if (iccInfo) {
+      iccInfo->GetMcc(&location.u.cellID.mcc);
+      iccInfo->GetMnc(&location.u.cellID.mnc);
     }
     nsCOMPtr<nsIDOMMozMobileConnectionInfo> voice;
     rilCtx->GetVoice(getter_AddRefs(voice));
     if (voice) {
       nsCOMPtr<nsIDOMMozMobileCellInfo> cell;
       voice->GetCell(getter_AddRefs(cell));
       if (cell) {
         cell->GetGsmLocationAreaCode(&location.u.cellID.lac);
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -410,17 +410,17 @@ RILContentHelper.prototype = {
     };
 
     let rilContext = cpmm.sendSyncMessage("RIL:GetRilContext")[0];
     if (!rilContext) {
       debug("Received null rilContext from chrome process.");
       return;
     }
     this.rilContext.cardState = rilContext.cardState;
-    this.updateICCInfo(rilContext.icc, this.rilContext.iccInfo);
+    this.updateICCInfo(rilContext.iccInfo, this.rilContext.iccInfo);
     this.updateConnectionInfo(rilContext.voice, this.rilContext.voiceConnectionInfo);
     this.updateConnectionInfo(rilContext.data, this.rilContext.dataConnectionInfo);
 
     return this.rilContext;
   },
 
   get iccInfo() {
     return this.getRilContext().iccInfo;
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -210,17 +210,18 @@ function RadioInterfaceLayer() {
   debug("Starting RIL Worker");
   this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
   this.worker.onerror = this.onerror.bind(this);
   this.worker.onmessage = this.onmessage.bind(this);
 
   this.rilContext = {
     radioState:     RIL.GECKO_RADIOSTATE_UNAVAILABLE,
     cardState:      RIL.GECKO_CARDSTATE_UNKNOWN,
-    icc:            null,
+    iccInfo:        null,
+    imsi:           null,
 
     // These objects implement the nsIDOMMozMobileConnectionInfo interface,
     // although the actual implementation lives in the content process. So are
     // the child attributes `network` and `cell`, which implement
     // nsIDOMMozMobileNetworkInfo and nsIDOMMozMobileCellInfo respectively.
     voice:          {connected: false,
                      emergencyCallsOnly: false,
                      roaming: false,
@@ -602,16 +603,19 @@ RadioInterfaceLayer.prototype = {
         this.handleDataCallList(message);
         break;
       case "nitzTime":
         this.handleNitzTime(message);
         break;
       case "iccinfochange":
         this.handleICCInfoChange(message);
         break;
+      case "iccimsi":
+        this.rilContext.imsi = message.imsi;
+        break;
       case "iccGetCardLock":
       case "iccSetCardLock":
       case "iccUnlockCardLock":
         this.handleICCCardLockResult(message);
         break;
       case "icccontacts":
         if (!this._contactsCallbacks) {
           return;
@@ -818,29 +822,29 @@ RadioInterfaceLayer.prototype = {
   /**
     * Fix the roaming. RIL can report roaming in some case it is not
     * really the case. See bug 787967
     *
     * @param registration  The voiceMessage or dataMessage from which the
     *                      roaming state will be changed (maybe, if needed).
     */
   checkRoamingBetweenOperators: function checkRoamingBetweenOperators(registration) {
-    let icc = this.rilContext.icc;
-    if (!icc || !registration.connected) {
+    let iccInfo = this.rilContext.iccInfo;
+    if (!iccInfo || !registration.connected) {
       return;
     }
 
-    let spn = icc.spn && icc.spn.toLowerCase();
+    let spn = iccInfo.spn && iccInfo.spn.toLowerCase();
     let operator = registration.network;
     let longName = operator.longName && operator.longName.toLowerCase();
     let shortName = operator.shortName && operator.shortName.toLowerCase();
 
     let equalsLongName = longName && (spn == longName);
     let equalsShortName = shortName && (spn == shortName);
-    let equalsMcc = icc.mcc == operator.mcc;
+    let equalsMcc = iccInfo.mcc == operator.mcc;
 
     registration.roaming = registration.roaming &&
                            !(equalsMcc && (equalsLongName || equalsShortName));
   },
 
   /**
    * Sends the RIL:VoiceInfoChanged message when the voice
    * connection's state has changed.
@@ -1382,17 +1386,17 @@ RadioInterfaceLayer.prototype = {
       debug("Got port addressed SMS but not encoded in 8-bit alphabet. Drop!");
       return;
     }
 
     let options = {
       bearer: WAP.WDP_BEARER_GSM_SMS_GSM_MSISDN,
       sourceAddress: message.sender,
       sourcePort: message.header.originatorPort,
-      destinationAddress: this.rilContext.icc.msisdn,
+      destinationAddress: this.rilContext.iccInfo.msisdn,
       destinationPort: message.header.destinationPort,
     };
     WAP.WapPushManager.receiveWdpPDU(message.fullData, message.fullData.length,
                                      0, options);
   },
 
   portAddressedSmsApps: null,
   handleSmsReceived: function handleSmsReceived(message) {
@@ -1663,36 +1667,36 @@ RadioInterfaceLayer.prototype = {
 
     voicemailInfo.number = message.number;
     voicemailInfo.displayName = message.alphaId;
 
     this._sendTargetMessage("voicemail", "RIL:VoicemailInfoChanged", voicemailInfo);
   },
 
   handleICCInfoChange: function handleICCInfoChange(message) {
-    let oldIcc = this.rilContext.icc;
-    this.rilContext.icc = message;
-
-    let iccInfoChanged = !oldIcc ||
-                         oldIcc.iccid != message.iccid ||
-                         oldIcc.mcc != message.mcc ||
-                         oldIcc.mnc != message.mnc ||
-                         oldIcc.spn != message.spn ||
-                         oldIcc.isDisplayNetworkNameRequired != message.isDisplayNetworkNameRequired ||
-                         oldIcc.isDisplaySpnRequired != message.isDisplaySpnRequired ||
-                         oldIcc.msisdn != message.msisdn;
+    let oldIccInfo = this.rilContext.iccInfo;
+    this.rilContext.iccInfo = message;
+
+    let iccInfoChanged = !oldIccInfo ||
+                          oldIccInfo.iccid != message.iccid ||
+                          oldIccInfo.mcc != message.mcc ||
+                          oldIccInfo.mnc != message.mnc ||
+                          oldIccInfo.spn != message.spn ||
+                          oldIccInfo.isDisplayNetworkNameRequired != message.isDisplayNetworkNameRequired ||
+                          oldIccInfo.isDisplaySpnRequired != message.isDisplaySpnRequired ||
+                          oldIccInfo.msisdn != message.msisdn;
     if (!iccInfoChanged) {
       return;
     }
     // RIL:IccInfoChanged corresponds to a DOM event that gets fired only
     // when the MCC or MNC codes have changed.
     this._sendTargetMessage("mobileconnection", "RIL:IccInfoChanged", message);
 
     // If spn becomes available, we should check roaming again.
-    let oldSpn = oldIcc ? oldIcc.spn : null;
+    let oldSpn = oldIccInfo ? oldIccInfo.spn : null;
     if (!oldSpn && message.spn) {
       let voice = this.rilContext.voice;
       let data = this.rilContext.data;
       let voiceRoaming = voice.roaming;
       let dataRoaming = data.roaming;
       this.checkRoamingBetweenOperators(voice);
       this.checkRoamingBetweenOperators(data);
       if (voiceRoaming != voice.roaming) {
--- a/dom/system/gonk/nsIRadioInterfaceLayer.idl
+++ b/dom/system/gonk/nsIRadioInterfaceLayer.idl
@@ -235,91 +235,34 @@ interface nsIRILContentHelper : nsIMobil
   attribute bool microphoneMuted;
   attribute bool speakerEnabled;
 
   readonly attribute nsIDOMMozVoicemailStatus voicemailStatus;
   readonly attribute DOMString voicemailNumber;
   readonly attribute DOMString voicemailDisplayName;
 };
 
-[scriptable, uuid(7cb249b8-7ec9-4e31-a043-293121574dd0)]
-interface nsIICCRecords : nsISupports
-{
-  /**
-   * Integrated Circuit Card Identifier.
-   */
-  readonly attribute DOMString iccid;
-
-  /**
-   * Mobile Subscriber ISDN Number
-   */
-  readonly attribute DOMString msisdn;
-
-  /**
-   * Administrative Data
-   */
-  readonly attribute jsval ad;
-
-  /**
-   * International Mobile Subscriber Identity
-   */
-  readonly attribute DOMString imsi;
-
-  /**
-   * Mobile Country Code
-   */
-  readonly attribute unsigned short mcc;
-
-  /**
-   * Mobile Network Code
-   */
-  readonly attribute unsigned short mnc;
-
-  /**
-   * Abbreviated dialling numbers
-   */
-  readonly attribute jsval adn;
-
-  /**
-   * Fixed Dialling Numbers
-   */
-  readonly attribute jsval fdn;
-
-  /**
-   * Service Provider Name (SPN) of the subscriber's home network.
-   */
-  readonly attribute DOMString spn;
-
-  /**
-   * Network name must be a part of displayed carrier name.
-   */
-  readonly attribute boolean isDisplayNetworkNameRequired;
-
-  /**
-   * Service provider name must be a part of displayed carrier name.
-   */
-  readonly attribute boolean isDisplaySpnRequired;
-};
-
 [scriptable, uuid(c0c5cb9f-6372-4b5a-b74c-baacc2da5e4f)]
 interface nsIVoicemailInfo : nsISupports
 {
   readonly attribute DOMString number;
 
   readonly attribute DOMString displayName;
 };
 
-[scriptable, uuid(e6dc89f2-0d4e-46fc-902c-cfeeaee15e40)]
+[scriptable, uuid(a09c42c3-1063-42f6-8022-268c6a0fe5e8)]
 interface nsIRilContext : nsISupports
 {
   readonly attribute DOMString radioState;
 
   readonly attribute DOMString cardState;
 
-  readonly attribute nsIICCRecords icc;
+  readonly attribute DOMString imsi;
+
+  readonly attribute nsIDOMMozMobileICCInfo iccInfo;
 
   readonly attribute nsIDOMMozMobileConnectionInfo voice;
 
   readonly attribute nsIDOMMozMobileConnectionInfo data;
 };
 
 [scriptable, uuid(385345ee-f78c-4be4-abd2-07d3dae4e208)]
 interface nsIRadioInterfaceLayer : nsISupports
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -788,17 +788,17 @@ let RIL = {
     this.SMSC = null;
 
     /**
      * ICC information that is not exposed to Gaia.
      */
     this.iccInfoPrivate = {};
 
     /**
-     * ICC information, such as MSISDN, IMSI, ...etc.
+     * ICC information, such as MSISDN, MCC, MNC, SPN...etc.
      */
     this.iccInfo = {};
 
     /**
      * Application identification for apps in ICC.
      */
     this.aid = null;
 
@@ -4350,17 +4350,24 @@ RIL[REQUEST_DIAL] = function REQUEST_DIA
     return;
   }
 };
 RIL[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) {
   if (options.rilRequestError) {
     return;
   }
 
-  this.iccInfo.imsi = Buf.readString();
+  this.iccInfoPrivate.imsi = Buf.readString();
+  if (DEBUG) {
+    debug("IMSI: " + this.iccInfoPrivate.imsi);
+  }
+
+  options.rilMessageType = "iccimsi";
+  options.imsi = this.iccInfoPrivate.imsi;
+  this.sendDOMMessage(options);
 };
 RIL[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) {
   if (options.rilRequestError) {
     return;
   }
 
   this.getCurrentCalls();
 };
@@ -8846,32 +8853,33 @@ let ICCRecordHelper = {
   /**
    * Read the AD (Administrative Data) from the ICC.
    */
   getAD: function getAD() {
     function callback() {
       let length = Buf.readUint32();
       // Each octet is encoded into two chars.
       let len = length / 2;
-      RIL.iccInfo.ad = GsmPDUHelper.readHexOctetArray(len);
+      let ad = GsmPDUHelper.readHexOctetArray(len);
       Buf.readStringDelimiter(length);
 
       if (DEBUG) {
         let str = "";
-        for (let i = 0; i < RIL.iccInfo.ad.length; i++) {
-          str += RIL.iccInfo.ad[i] + ", ";
+        for (let i = 0; i < ad.length; i++) {
+          str += ad[i] + ", ";
         }
         debug("AD: " + str);
       }
 
-      if (RIL.iccInfo.imsi) {
+      let imsi = RIL.iccInfoPrivate.imsi;
+      if (imsi) {
         // MCC is the first 3 digits of IMSI.
-        RIL.iccInfo.mcc = parseInt(RIL.iccInfo.imsi.substr(0,3));
+        RIL.iccInfo.mcc = parseInt(imsi.substr(0,3));
         // The 4th byte of the response is the length of MNC.
-        RIL.iccInfo.mnc = parseInt(RIL.iccInfo.imsi.substr(3, RIL.iccInfo.ad[3]));
+        RIL.iccInfo.mnc = parseInt(imsi.substr(3, ad[3]));
         if (DEBUG) debug("MCC: " + RIL.iccInfo.mcc + " MNC: " + RIL.iccInfo.mnc);
         ICCUtilsHelper.handleICCInfoChange();
       }
     }
 
     ICCIOHelper.loadTransparentEF({fileId: ICC_EF_AD,
                                    callback: callback.bind(this)});
   },
@@ -8910,23 +8918,23 @@ let ICCRecordHelper = {
   /**
    * Read the (U)SIM Service Table from the ICC.
    */
   getSST: function getSST() {
     function callback() {
       let length = Buf.readUint32();
       // Each octet is encoded into two chars.
       let len = length / 2;
-      RIL.iccInfo.sst = GsmPDUHelper.readHexOctetArray(len);
+      let sst = GsmPDUHelper.readHexOctetArray(len);
       Buf.readStringDelimiter(length);
-
+      RIL.iccInfoPrivate.sst = sst;
       if (DEBUG) {
         let str = "";
-        for (let i = 0; i < RIL.iccInfo.sst.length; i++) {
-          str += RIL.iccInfo.sst[i] + ", ";
+        for (let i = 0; i < sst.length; i++) {
+          str += sst[i] + ", ";
         }
         debug("SST: " + str);
       }
 
       // Fetch SPN and PLMN list, if some of them are available.
       if (ICCUtilsHelper.isICCServiceAvailable("SPN")) {
         if (DEBUG) debug("SPN: SPN is available");
         this.getSPN();
@@ -9681,17 +9689,17 @@ let ICCUtilsHelper = {
    * Get whether specificed (U)SIM service is available.
    *
    * @param geckoService
    *        Service name like "ADN", "BDN", etc.
    *
    * @return true if the service is enabled, false otherwise.
    */
   isICCServiceAvailable: function isICCServiceAvailable(geckoService) {
-    let serviceTable = RIL.iccInfo.sst;
+    let serviceTable = RIL.iccInfoPrivate.sst;
     let index, bitmask;
     if (RIL.appType == CARD_APPTYPE_SIM) {
       /**
        * Service id is valid in 1..N, and 2 bits are used to code each service.
        *
        * +----+--  --+----+----+
        * | b8 | ...  | b2 | b1 |
        * +----+--  --+----+----+
--- a/dom/system/gonk/tests/test_ril_worker_icc.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc.js
@@ -451,17 +451,17 @@ add_test(function test_octect_BCD() {
 /**
  * Verify ICCUtilsHelper.isICCServiceAvailable.
  */
 add_test(function test_is_icc_service_available() {
   let worker = newUint8Worker();
   let ICCUtilsHelper = worker.ICCUtilsHelper;
 
   function test_table(sst, geckoService, simEnabled, usimEnabled) {
-    worker.RIL.iccInfo.sst = sst;
+    worker.RIL.iccInfoPrivate.sst = sst;
     worker.RIL.appType = CARD_APPTYPE_SIM;
     do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), simEnabled);
     worker.RIL.appType = CARD_APPTYPE_USIM;
     do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), usimEnabled);
   }
 
   test_table([0x08], "ADN", true, false);
   test_table([0x08], "FDN", false, false);
new file mode 100644
--- /dev/null
+++ b/dom/webidl/HTMLBRElement.webidl
@@ -0,0 +1,23 @@
+/* -*- Mode: IDL; 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/.
+ *
+ * The origin of this IDL file is
+ * http://www.whatwg.org/specs/web-apps/current-work/#the-br-element
+ * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
+ *
+ * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
+ * Opera Software ASA. You are granted a license to use, reproduce
+ * and create derivative works of this document.
+ */
+
+// http://www.whatwg.org/specs/web-apps/current-work/#the-br-element
+interface HTMLBRElement : HTMLElement {};
+
+// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
+partial interface HTMLBRElement {
+             [SetterThrows]
+             attribute DOMString clear;
+};
+
new file mode 100644
--- /dev/null
+++ b/dom/webidl/HTMLStyleElement.webidl
@@ -0,0 +1,22 @@
+/* -*- Mode: IDL; 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/.
+ *
+ * The origin of this IDL file is
+ * http://www.whatwg.org/specs/web-apps/current-work/#the-style-element
+ * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
+ */
+
+interface HTMLStyleElement : HTMLElement {
+           [SetterThrows]
+           attribute boolean disabled;
+           [SetterThrows]
+           attribute DOMString media;
+           [SetterThrows]
+           attribute DOMString type;
+           [SetterThrows]
+           attribute boolean scoped;
+};
+HTMLStyleElement implements LinkStyle;
+
new file mode 100644
--- /dev/null
+++ b/dom/webidl/LinkStyle.webidl
@@ -0,0 +1,14 @@
+/* -*- Mode: IDL; 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/.
+ *
+ * The origin of this IDL file is
+ * http://dev.w3.org/csswg/cssom/#the-linkstyle-interface
+ */
+
+[NoInterfaceObject]
+interface LinkStyle {
+      readonly attribute StyleSheet? sheet;
+};
+
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -52,16 +52,17 @@ webidl_files = \
   FileHandle.webidl \
   FileList.webidl \
   FileReaderSync.webidl \
   FormData.webidl \
   Function.webidl \
   GainNode.webidl \
   HTMLAnchorElement.webidl \
   HTMLBodyElement.webidl \
+  HTMLBRElement.webidl \
   HTMLCollection.webidl \
   HTMLDataListElement.webidl \
   HTMLDivElement.webidl \
   HTMLDListElement.webidl \
   HTMLDocument.webidl \
   HTMLElement.webidl \
   HTMLFontElement.webidl \
   HTMLFrameSetElement.webidl \
@@ -71,25 +72,27 @@ webidl_files = \
   HTMLLIElement.webidl \
   HTMLOListElement.webidl \
   HTMLOptionsCollection.webidl \
   HTMLParagraphElement.webidl \
   HTMLPreElement.webidl \
   HTMLPropertiesCollection.webidl \
   HTMLScriptElement.webidl \
   HTMLSpanElement.webidl \
+  HTMLStyleElement.webidl \
   HTMLTableCaptionElement.webidl \
   HTMLTableCellElement.webidl \
   HTMLTableColElement.webidl \
   HTMLTableElement.webidl \
   HTMLTableRowElement.webidl \
   HTMLTableSectionElement.webidl \
   HTMLTitleElement.webidl \
   HTMLUListElement.webidl \
   ImageData.webidl \
+  LinkStyle.webidl \
   Location.webidl \
   MutationObserver.webidl \
   Node.webidl \
   NodeFilter.webidl \
   NodeList.webidl \
   PaintRequest.webidl \
   PaintRequestList.webidl \
   PannerNode.webidl \
--- a/gfx/cairo/libpixman/src/pixman-private.h
+++ b/gfx/cairo/libpixman/src/pixman-private.h
@@ -9,17 +9,17 @@
 #ifndef MOZILLA_VERSION
 #error "Need mozilla headers"
 #endif
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
 #define LOW_QUALITY_INTERPOLATION
 #define LOWER_QUALITY_INTERPOLATION
 #define BILINEAR_INTERPOLATION_BITS 4
 #else
-#define BILINEAR_INTERPOLATION_BITS 8
+#define BILINEAR_INTERPOLATION_BITS 7
 #endif
 #define BILINEAR_INTERPOLATION_RANGE (1 << BILINEAR_INTERPOLATION_BITS)
 
 /*
  * C specific part
  */
 
 #ifndef __ASSEMBLER__
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -76,17 +76,17 @@ frontend::CompileScript(JSContext *cx, H
     JS_ASSERT_IF(staticLevel != 0, callerFrame);
 
     if (!CheckLength(cx, length))
         return UnrootedScript(NULL);
     JS_ASSERT_IF(staticLevel != 0, options.sourcePolicy != CompileOptions::LAZY_SOURCE);
     ScriptSource *ss = cx->new_<ScriptSource>();
     if (!ss)
         return UnrootedScript(NULL);
-    ScriptSourceHolder ssh(cx->runtime, ss);
+    ScriptSourceHolder ssh(ss);
     SourceCompressionToken sct(cx);
     switch (options.sourcePolicy) {
       case CompileOptions::SAVE_SOURCE:
         if (!ss->setSourceCopy(cx, chars, length, false, &sct))
             return UnrootedScript(NULL);
         break;
       case CompileOptions::LAZY_SOURCE:
         ss->setSourceRetrievable();
@@ -227,17 +227,17 @@ bool
 frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions options,
                               const AutoNameVector &formals, StableCharPtr chars, size_t length)
 {
     if (!CheckLength(cx, length))
         return false;
     ScriptSource *ss = cx->new_<ScriptSource>();
     if (!ss)
         return false;
-    ScriptSourceHolder ssh(cx->runtime, ss);
+    ScriptSourceHolder ssh(ss);
     SourceCompressionToken sct(cx);
     JS_ASSERT(options.sourcePolicy != CompileOptions::LAZY_SOURCE);
     if (options.sourcePolicy == CompileOptions::SAVE_SOURCE) {
         if (!ss->setSourceCopy(cx, chars, length, true, &sct))
             return false;
     }
 
     options.setCompileAndGo(false);
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -846,17 +846,17 @@ JSRuntime::JSRuntime(JSUseHelperThreads 
     hadOutOfMemory(false),
     data(NULL),
     gcLock(NULL),
     gcHelperThread(thisFromCtor()),
 #ifdef JS_THREADSAFE
 #ifdef JS_ION
     workerThreadState(NULL),
 #endif
-    sourceCompressorThread(thisFromCtor()),
+    sourceCompressorThread(),
 #endif
     defaultFreeOp_(thisFromCtor(), false),
     debuggerMutations(0),
     securityCallbacks(const_cast<JSSecurityCallbacks *>(&NullSecurityCallbacks)),
     DOMcallbacks(NULL),
     destroyPrincipals(NULL),
     structuredCloneCallbacks(NULL),
     telemetryCallback(NULL),
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -987,15 +987,15 @@ js::SetCTypesActivityCallback(JSRuntime 
 {
     rt->ctypesActivityCallback = cb;
 }
 
 js::AutoCTypesActivityCallback::AutoCTypesActivityCallback(JSContext *cx,
                                                            js::CTypesActivityType beginType,
                                                            js::CTypesActivityType endType
                                                            MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
-  : cx(cx), callback(cx->runtime->ctypesActivityCallback), beginType(beginType), endType(endType)
+  : cx(cx), callback(cx->runtime->ctypesActivityCallback), endType(endType)
 {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 
     if (callback)
         callback(cx, beginType);
 }
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -1383,17 +1383,16 @@ typedef void
  */
 JS_FRIEND_API(void)
 SetCTypesActivityCallback(JSRuntime *rt, CTypesActivityCallback cb);
 
 class JS_FRIEND_API(AutoCTypesActivityCallback) {
   private:
     JSContext *cx;
     CTypesActivityCallback callback;
-    CTypesActivityType beginType;
     CTypesActivityType endType;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
   public:
     AutoCTypesActivityCallback(JSContext *cx, CTypesActivityType beginType,
                                CTypesActivityType endType
                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
     ~AutoCTypesActivityCallback() {
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -93,17 +93,19 @@ fun_getProperty(JSContext *cx, HandleObj
 
     /*
      * Mark the function's script as uninlineable, to expand any of its
      * frames on the stack before we go looking for them. This allows the
      * below walk to only check each explicit frame rather than needing to
      * check any calls that were inlined.
      */
     if (fun->isInterpreted()) {
-        fun->getOrCreateScript(cx)->uninlineable = true;
+        if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
+            return false;
+        fun->nonLazyScript()->uninlineable = true;
         MarkTypeObjectFlags(cx, fun, OBJECT_FLAG_UNINLINEABLE);
     }
 
     /* Set to early to null in case of error */
     vp.setNull();
 
     /* Find fun's top-most activation record. */
     NonBuiltinScriptFrameIter iter(cx);
@@ -319,19 +321,20 @@ fun_resolve(JSContext *cx, HandleObject 
         return true;
     }
 
     if (JSID_IS_ATOM(id, cx->names().length) || JSID_IS_ATOM(id, cx->names().name)) {
         JS_ASSERT(!IsInternalFunctionObject(obj));
 
         RootedValue v(cx);
         if (JSID_IS_ATOM(id, cx->names().length)) {
-            //FIXME: bug 810715 - deal with lazy interpreted functions with default args
-            uint16_t defaults = fun->hasScript() ? fun->nonLazyScript()->ndefaults : 0;
-            v.setInt32(fun->nargs - defaults - fun->hasRest());
+            if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
+                return false;
+            uint16_t ndefaults = fun->hasScript() ? fun->nonLazyScript()->ndefaults : 0;
+            v.setInt32(fun->nargs - ndefaults - fun->hasRest());
         } else {
             v.setString(fun->atom() == NULL ?  cx->runtime->emptyString : fun->atom());
         }
 
         if (!DefineNativeProperty(cx, fun, id, v, JS_PropertyStub, JS_StrictPropertyStub,
                                   JSPROP_PERMANENT | JSPROP_READONLY, 0, 0)) {
             return false;
         }
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -546,17 +546,17 @@ js::XDRScript(XDRState<mode> *xdr, Handl
         if (scriptBits & (1 << OwnSource)) {
             ss = cx->new_<ScriptSource>();
             if (!ss)
                 return false;
         } else {
             JS_ASSERT(enclosingScript);
             ss = enclosingScript->scriptSource();
         }
-        ScriptSourceHolder ssh(cx->runtime, ss);
+        ScriptSourceHolder ssh(ss);
         script = JSScript::Create(cx, enclosingScope, !!(scriptBits & (1 << SavedCallerFun)),
                                   options, /* staticLevel = */ 0, ss, 0, 0);
         if (!script)
             return false;
     }
 
     /* JSScript::partiallyInit assumes script->bindings is fully initialized. */
     LifoAllocScope las(&cx->tempLifoAlloc());
@@ -1287,17 +1287,17 @@ SourceCompressionToken::abort()
 {
     JS_ASSERT(active());
 #ifdef JS_THREADSAFE
     cx->runtime->sourceCompressorThread.abort(this);
 #endif
 }
 
 void
-ScriptSource::destroy(JSRuntime *rt)
+ScriptSource::destroy()
 {
     JS_ASSERT(ready());
     adjustDataSize(0);
     js_free(sourceMap_);
     ready_ = false;
     js_free(this);
 }
 
@@ -1935,17 +1935,17 @@ JSScript::finalize(FreeOp *fop)
     mjit::ReleaseScriptCode(fop, this);
 # ifdef JS_ION
     ion::DestroyIonScripts(fop, this);
 # endif
 #endif
 
     destroyScriptCounts(fop);
     destroyDebugScript(fop);
-    scriptSource_->decref(fop->runtime());
+    scriptSource_->decref();
 
     if (data) {
         JS_POISON(data, 0xdb, computedSizeOfData());
         fop->free_(data);
     }
 }
 
 static const uint32_t GSN_CACHE_THRESHOLD = 100;
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -1050,20 +1050,20 @@ struct ScriptSource
         sourceMap_(NULL),
         sourceRetrievable_(false),
         argumentsNotIncluded_(false),
         ready_(true)
     {
         data.source = NULL;
     }
     void incref() { refs++; }
-    void decref(JSRuntime *rt) {
+    void decref() {
         JS_ASSERT(refs != 0);
         if (--refs == 0)
-            destroy(rt);
+            destroy();
     }
     bool setSourceCopy(JSContext *cx,
                        StableCharPtr src,
                        uint32_t length,
                        bool argumentsNotIncluded,
                        SourceCompressionToken *tok);
     void setSource(const jschar *src, uint32_t length);
     bool ready() const { return ready_; }
@@ -1086,38 +1086,36 @@ struct ScriptSource
     bool performXDR(XDRState<mode> *xdr);
 
     // Source maps
     bool setSourceMap(JSContext *cx, jschar *sourceMapURL, const char *filename);
     const jschar *sourceMap();
     bool hasSourceMap() const { return sourceMap_ != NULL; }
 
   private:
-    void destroy(JSRuntime *rt);
+    void destroy();
     bool compressed() const { return compressedLength_ != 0; }
     size_t computedSizeOfData() const {
         return compressed() ? compressedLength_ : sizeof(jschar) * length_;
     }
     bool adjustDataSize(size_t nbytes);
 };
 
 class ScriptSourceHolder
 {
-    JSRuntime *rt;
     ScriptSource *ss;
   public:
-    ScriptSourceHolder(JSRuntime *rt, ScriptSource *ss)
-      : rt(rt),
-        ss(ss)
+    explicit ScriptSourceHolder(ScriptSource *ss)
+      : ss(ss)
     {
         ss->incref();
     }
     ~ScriptSourceHolder()
     {
-        ss->decref(rt);
+        ss->decref();
     }
 };
 
 #ifdef JS_THREADSAFE
 /*
  * Background thread to compress JS source code. This happens only while parsing
  * and bytecode generation is happening in the main thread. If needed, the
  * compiler waits for compression to complete before returning.
@@ -1154,17 +1152,17 @@ class SourceCompressorThread
     // Flag which can be set by the main thread to ask compression to abort.
     volatile bool stop;
 
     bool internalCompress();
     void threadLoop();
     static void compressorThread(void *arg);
 
   public:
-    explicit SourceCompressorThread(JSRuntime *rt)
+    explicit SourceCompressorThread()
     : state(IDLE),
       tok(NULL),
       thread(NULL),
       lock(NULL),
       wakeup(NULL),
       done(NULL) {}
     void finish();
     bool init();
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -3069,18 +3069,20 @@ str_concat(JSContext *cx, unsigned argc,
         if (!argStr) {
             RootedString strRoot(cx, str);
             argStr = ToString<CanGC>(cx, args[i]);
             if (!argStr)
                 return false;
             str = strRoot;
         }
 
-        str = ConcatStrings<NoGC>(cx, str, argStr);
-        if (!str) {
+        JSString *next = ConcatStrings<NoGC>(cx, str, argStr);
+        if (next) {
+            str = next;
+        } else {
             RootedString strRoot(cx, str), argStrRoot(cx, argStr);
             str = ConcatStrings<CanGC>(cx, strRoot, argStrRoot);
             if (!str)
                 return false;
         }
     }
 
     args.rval().setString(str);
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -229,17 +229,17 @@ GlobalObject::initFunctionAndObjectClass
         jschar *source = InflateString(cx, rawSource, &sourceLen);
         if (!source)
             return NULL;
         ScriptSource *ss = cx->new_<ScriptSource>();
         if (!ss) {
             js_free(source);
             return NULL;
         }
-        ScriptSourceHolder ssh(cx->runtime, ss);
+        ScriptSourceHolder ssh(ss);
         ss->setSource(source, sourceLen);
 
         CompileOptions options(cx);
         options.setNoScriptRval(true)
                .setVersion(JSVERSION_DEFAULT);
         RootedScript script(cx, JSScript::Create(cx,
                                                  /* enclosingScope = */ NullPtr(),
                                                  /* savedCallerFun = */ false,
--- a/js/src/vm/Monitor.h
+++ b/js/src/vm/Monitor.h
@@ -47,26 +47,30 @@ class Monitor
     }
 
     bool init();
 };
 
 class AutoLockMonitor
 {
   private:
+#ifdef JS_THREADSAFE
     Monitor &monitor;
+#endif
 
   public:
     AutoLockMonitor(Monitor &monitor)
+#ifdef JS_THREADSAFE
       : monitor(monitor)
     {
-#ifdef JS_THREADSAFE
         PR_Lock(monitor.lock_);
+    }
+#else
+    {}
 #endif
-    }
 
     ~AutoLockMonitor() {
 #ifdef JS_THREADSAFE
         PR_Unlock(monitor.lock_);
 #endif
     }
 
     void wait() {
@@ -88,26 +92,30 @@ class AutoLockMonitor
         PR_NotifyAllCondVar(monitor.condVar_);
 #endif
     }
 };
 
 class AutoUnlockMonitor
 {
   private:
+#ifdef JS_THREADSAFE
     Monitor &monitor;
+#endif
 
   public:
     AutoUnlockMonitor(Monitor &monitor)
+#ifdef JS_THREADSAFE
       : monitor(monitor)
     {
-#ifdef JS_THREADSAFE
         PR_Unlock(monitor.lock_);
+    }
+#else
+    {}
 #endif
-    }
 
     ~AutoUnlockMonitor() {
 #ifdef JS_THREADSAFE
         PR_Lock(monitor.lock_);
 #endif
     }
 };
 
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -344,51 +344,51 @@ public:
   }
 
 #ifdef DEBUG
   /** @see nsIFrame::GetFrameName */
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   /** return the width of the column at aColIndex    */
-  virtual int32_t GetColumnWidth(int32_t aColIndex);
+  int32_t GetColumnWidth(int32_t aColIndex);
 
   /** helper to get the cell spacing X style value */
-  virtual nscoord GetCellSpacingX();
+  nscoord GetCellSpacingX();
 
   /** helper to get the cell spacing Y style value */
-  virtual nscoord GetCellSpacingY();
+  nscoord GetCellSpacingY();
  
   virtual nscoord GetBaseline() const;
   /** return the row span of a cell, taking into account row span magic at the bottom
     * of a table. The row span equals the number of rows spanned by aCell starting at
     * aStartRowIndex, and can be smaller if aStartRowIndex is greater than the row
     * index in which aCell originates.
     *
     * @param aStartRowIndex the cell
     * @param aCell          the cell
     *
     * @return  the row span, correcting for row spans that extend beyond the bottom
     *          of the table.
     */
-  virtual int32_t  GetEffectiveRowSpan(int32_t                 aStartRowIndex,
-                                       const nsTableCellFrame& aCell) const;
-  virtual int32_t  GetEffectiveRowSpan(const nsTableCellFrame& aCell,
-                                       nsCellMap*              aCellMap = nullptr);
+  int32_t  GetEffectiveRowSpan(int32_t                 aStartRowIndex,
+                               const nsTableCellFrame& aCell) const;
+  int32_t  GetEffectiveRowSpan(const nsTableCellFrame& aCell,
+                               nsCellMap*              aCellMap = nullptr);
 
   /** return the col span of a cell, taking into account col span magic at the edge
     * of a table.
     *
     * @param aCell      the cell
     *
     * @return  the col span, correcting for col spans that extend beyond the edge
     *          of the table.
     */
-  virtual int32_t  GetEffectiveColSpan(const nsTableCellFrame& aCell,
-                                       nsCellMap*              aCellMap = nullptr) const;
+  int32_t  GetEffectiveColSpan(const nsTableCellFrame& aCell,
+                               nsCellMap*              aCellMap = nullptr) const;
 
   /** indicate whether the row has more than one cell that either originates
     * or is spanned from the rows above
     */
   bool HasMoreThanOneCell(int32_t aRowIndex) const;
 
   /** return the column frame associated with aColIndex
     * returns nullptr if the col frame has not yet been allocated, or if
@@ -422,51 +422,51 @@ public:
                                 bool                  aAddToTable);
 
   void MatchCellMapToColCache(nsTableCellMap* aCellMap);
   /** empty the column frame cache */
   void ClearColCache();
 
   void DidResizeColumns();
 
-  virtual void AppendCell(nsTableCellFrame& aCellFrame,
-                          int32_t           aRowIndex);
+  void AppendCell(nsTableCellFrame& aCellFrame,
+                  int32_t           aRowIndex);
 
-  virtual void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
-                           int32_t                      aRowIndex,
-                           int32_t                      aColIndexBefore);
+  void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
+                   int32_t                      aRowIndex,
+                   int32_t                      aColIndexBefore);
 
-  virtual void RemoveCell(nsTableCellFrame* aCellFrame,
-                          int32_t           aRowIndex);
+  void RemoveCell(nsTableCellFrame* aCellFrame,
+                  int32_t           aRowIndex);
 
   void AppendRows(nsTableRowGroupFrame*       aRowGroupFrame,
                   int32_t                     aRowIndex,
                   nsTArray<nsTableRowFrame*>& aRowFrames);
 
   int32_t InsertRows(nsTableRowGroupFrame*       aRowGroupFrame,
                      nsTArray<nsTableRowFrame*>& aFrames,
                      int32_t                     aRowIndex,
                      bool                        aConsiderSpans);
 
-  virtual void RemoveRows(nsTableRowFrame& aFirstRowFrame,
-                          int32_t          aNumRowsToRemove,
-                          bool             aConsiderSpans);
+  void RemoveRows(nsTableRowFrame& aFirstRowFrame,
+                  int32_t          aNumRowsToRemove,
+                  bool             aConsiderSpans);
 
   /** Insert multiple rowgroups into the table cellmap handling
     * @param aRowGroups - iterator that iterates over the rowgroups to insert
     */
   void InsertRowGroups(const nsFrameList::Slice& aRowGroups);
 
   void InsertColGroups(int32_t                   aStartColIndex,
                        const nsFrameList::Slice& aColgroups);
 
-  virtual void RemoveCol(nsTableColGroupFrame* aColGroupFrame,
-                         int32_t               aColIndex,
-                         bool                  aRemoveFromCache,
-                         bool                  aRemoveFromCellMap);
+  void RemoveCol(nsTableColGroupFrame* aColGroupFrame,
+                 int32_t               aColIndex,
+                 bool                  aRemoveFromCache,
+                 bool                  aRemoveFromCellMap);
 
   bool ColumnHasCellSpacingBefore(int32_t aColIndex) const;
 
   bool HasPctCol() const;
   void SetHasPctCol(bool aValue);
 
   bool HasCellSpanningPctCol() const;
   void SetHasCellSpanningPctCol(bool aValue);
@@ -652,17 +652,17 @@ public:
     */
   void SetGeometryDirty() { mBits.mGeometryDirty = true; }
   void ClearGeometryDirty() { mBits.mGeometryDirty = false; }
   bool IsGeometryDirty() const { return mBits.mGeometryDirty; }
 
   /** Get the cell map for this table frame.  It is not always mCellMap.
     * Only the firstInFlow has a legit cell map
     */
-  virtual nsTableCellMap* GetCellMap() const;
+  nsTableCellMap* GetCellMap() const;
 
   /** Iterate over the row groups and adjust the row indices of all rows 
     * whose index is >= aRowIndex.  
     * @param aRowIndex   - start adjusting with this index
     * @param aAdjustment - shift the row index by this amount
     */
   void AdjustRowIndices(int32_t aRowIndex,
                         int32_t aAdjustment);
@@ -714,17 +714,17 @@ public: /* ----- Cell Map public methods
   {
     return GetCellMap()->GetColCount();
   }
 
   // return the last col index which isn't of type eColAnonymousCell
   int32_t GetIndexOfLastRealCol();
 
   /** returns true if table-layout:auto  */
-  virtual bool IsAutoLayout();
+  bool IsAutoLayout();
 
 public:
  
 #ifdef DEBUG
   void Dump(bool            aDumpRows,
             bool            aDumpCols, 
             bool            aDumpCellMap);
 #endif
new file mode 100644
--- /dev/null
+++ b/media/libtheora/bug703135.patch
@@ -0,0 +1,43 @@
+diff --git a/media/libtheora/lib/huffdec.c b/media/libtheora/lib/huffdec.c
+--- a/media/libtheora/lib/huffdec.c
++++ b/media/libtheora/lib/huffdec.c
+@@ -320,16 +320,19 @@ static size_t oc_huff_node_size(int _nbi
+ /*Produces a collapsed-tree representation of the given token list.
+   _tree: The storage for the collapsed Huffman tree.
+          This may be NULL to compute the required storage size instead of
+           constructing the tree.
+   _tokens:  A list of internal tokens, in the order they are found in the
+              codebook, and the lengths of their corresponding codewords.
+   _ntokens: The number of tokens corresponding to this tree node.
+   Return: The number of words required to store the tree.*/
++#if defined(_MSC_VER) && _MSC_VER >= 1700
++#pragma optimize( "", off )
++#endif
+ static size_t oc_huff_tree_collapse(ogg_int16_t *_tree,
+  unsigned char _tokens[][2],int _ntokens){
+   ogg_int16_t   node[34];
+   unsigned char depth[34];
+   unsigned char last[34];
+   size_t        ntree;
+   int           ti;
+   int           l;
+@@ -367,16 +370,19 @@ static size_t oc_huff_tree_collapse(ogg_
+       /*Pop back up a level of recursion.*/
+       else if(l-->0)nbits=depth[l+1]-depth[l];
+     }
+     while(l>=0);
+   }
+   while(l>=0);
+   return ntree;
+ }
++#if defined(_MSC_VER) && _MSC_VER >= 1700
++#pragma optimize( "", on )
++#endif
+ 
+ /*Unpacks a set of Huffman trees, and reduces them to a collapsed
+    representation.
+   _opb:   The buffer to unpack the trees from.
+   _nodes: The table to fill with the Huffman trees.
+   Return: 0 on success, or a negative value on error.
+           The caller is responsible for cleaning up any partially initialized
+            _nodes on failure.*/
--- a/media/libtheora/lib/huffdec.c
+++ b/media/libtheora/lib/huffdec.c
@@ -320,16 +320,19 @@ static size_t oc_huff_node_size(int _nbi
 /*Produces a collapsed-tree representation of the given token list.
   _tree: The storage for the collapsed Huffman tree.
          This may be NULL to compute the required storage size instead of
           constructing the tree.
   _tokens:  A list of internal tokens, in the order they are found in the
              codebook, and the lengths of their corresponding codewords.
   _ntokens: The number of tokens corresponding to this tree node.
   Return: The number of words required to store the tree.*/
+#if defined(_MSC_VER) && _MSC_VER >= 1700
+#pragma optimize( "", off )
+#endif
 static size_t oc_huff_tree_collapse(ogg_int16_t *_tree,
  unsigned char _tokens[][2],int _ntokens){
   ogg_int16_t   node[34];
   unsigned char depth[34];
   unsigned char last[34];
   size_t        ntree;
   int           ti;
   int           l;
@@ -367,16 +370,19 @@ static size_t oc_huff_tree_collapse(ogg_
       /*Pop back up a level of recursion.*/
       else if(l-->0)nbits=depth[l+1]-depth[l];
     }
     while(l>=0);
   }
   while(l>=0);
   return ntree;
 }
+#if defined(_MSC_VER) && _MSC_VER >= 1700
+#pragma optimize( "", on )
+#endif
 
 /*Unpacks a set of Huffman trees, and reduces them to a collapsed
    representation.
   _opb:   The buffer to unpack the trees from.
   _nodes: The table to fill with the Huffman trees.
   Return: 0 on success, or a negative value on error.
           The caller is responsible for cleaning up any partially initialized
            _nodes on failure.*/
--- a/media/libtheora/update.sh
+++ b/media/libtheora/update.sh
@@ -77,8 +77,9 @@ cp $1/lib/x86_vc/x86state.c ./lib/x86_vc
 cp $1/include/theora/theora.h ./include/theora/theora.h
 cp $1/include/theora/theoradec.h ./include/theora/theoradec.h
 cp $1/include/theora/theoraenc.h ./include/theora/theoraenc.h
 cp $1/include/theora/codec.h ./include/theora/codec.h
 patch -p3 < ./bug625773-r17780.patch
 patch -p3 < ./bug468275-r18219.patch
 patch -p3 < ./bug752139-r18031.patch
 patch -p3 < ./bug752668-r18268.patch
+patch -p3 < ./bug703135.patch
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -596,24 +596,26 @@ class LocationService
 
   typedef js::HashSet<const char*, StringHasher, InfallibleAllocPolicy>
           StringTable;
 
   StringTable mLibraryStrings;
 
   struct Entry
   {
-    const void* mPc;        // the entry is unused if this is null
+    static const void* const kUnused;
+
+    const void* mPc;        // if mPc==kUnused, the entry is unused
     char*       mFunction;  // owned by the Entry;  may be null
     const char* mLibrary;   // owned by mLibraryStrings;  never null
                             //   in a non-empty entry is in use
     ptrdiff_t   mLOffset;
 
     Entry()
-      : mPc(nullptr), mFunction(nullptr), mLibrary(nullptr), mLOffset(0)
+      : mPc(kUnused), mFunction(nullptr), mLibrary(nullptr), mLOffset(0)
     {}
 
     ~Entry()
     {
       // We don't free mLibrary because it's externally owned.
       InfallibleAllocPolicy::free_(mFunction);
     }
 
@@ -660,17 +662,17 @@ public:
   void WriteLocation(const Writer& aWriter, const void* aPc)
   {
     MOZ_ASSERT(gStateLock->IsLocked());
 
     uint32_t index = HashGeneric(aPc) & kMask;
     MOZ_ASSERT(index < kNumEntries);
     Entry& entry = mEntries[index];
 
-    MOZ_ASSERT(aPc);    // important, because null represents an empty entry
+    MOZ_ASSERT(aPc != Entry::kUnused);
     if (entry.mPc != aPc) {
       mNumCacheMisses++;
 
       // NS_DescribeCodeAddress can (on Linux) acquire a lock inside
       // the shared library loader.  Another thread might call malloc
       // while holding that lock (when loading a shared library).  So
       // we have to exit gStateLock around this call.  For details, see
       // https://bugzilla.mozilla.org/show_bug.cgi?id=363334#c3
@@ -727,27 +729,31 @@ public:
   }
 
   size_t CacheCapacity() const { return kNumEntries; }
 
   size_t CacheCount() const
   {
     size_t n = 0;
     for (size_t i = 0; i < kNumEntries; i++) {
-      if (mEntries[i].mPc) {
+      if (mEntries[i].mPc != Entry::kUnused) {
         n++;
       }
     }
     return n;
   }
 
   size_t NumCacheHits()   const { return mNumCacheHits; }
   size_t NumCacheMisses() const { return mNumCacheMisses; }
 };
 
+// We can't use 0 because that sometimes shows up as a PC in stack traces.
+const void* const LocationService::Entry::kUnused =
+  reinterpret_cast<const void* const>(intptr_t(-1));
+
 //---------------------------------------------------------------------------
 // Stack traces
 //---------------------------------------------------------------------------
 
 class StackTrace
 {
 public:
   static const uint32_t MaxFrames = 24;