Bug 795610 - Part f: Prepare HTMLElement.innerHTML for WebIDL bindings; r=mounir
authorMs2ger <ms2ger@gmail.com>
Sat, 06 Oct 2012 09:19:52 +0200
changeset 109356 9f999446be73dc937b88e8a16565dfc12027cc03
parent 109355 26167a82736dc3355cec1361fdbb3849f2b1859e
child 109357 9d42fde0e996b1ecb0b799a6a5dfaa1fecd2f705
push id23627
push userMs2ger@gmail.com
push dateSat, 06 Oct 2012 07:25:11 +0000
treeherdermozilla-central@2da1f2bde40e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs795610
milestone18.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
Bug 795610 - Part f: Prepare HTMLElement.innerHTML for WebIDL bindings; r=mounir
accessible/src/msaa/nsAccessNodeWrap.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
content/html/content/src/nsHTMLElement.cpp
content/html/content/src/nsHTMLScriptElement.cpp
content/html/content/src/nsHTMLStyleElement.cpp
dom/interfaces/html/nsIDOMHTMLElement.idl
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -496,17 +496,17 @@ nsAccessNodeWrap::get_innerHTML(BSTR __R
 __try {
   *aInnerHTML = nullptr;
 
   nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(GetNode());
   if (!htmlElement)
     return E_FAIL; // Node already shut down
 
   nsAutoString innerHTML;
-  htmlElement->GetInnerHTML(innerHTML);
+  htmlElement->GetDOMInnerHTML(innerHTML);
   if (innerHTML.IsEmpty())
     return S_FALSE;
 
   *aInnerHTML = ::SysAllocStringLen(innerHTML.get(), innerHTML.Length());
   if (!*aInnerHTML)
     return E_OUTOFMEMORY;
 
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1286,19 +1286,20 @@ nsGenericHTMLElement::GetMarkup(bool aIn
   }
   rv = docEncoder->EncodeToString(aMarkup);
   if (!aIncludeSelf) {
     doc->SetCachedEncoder(docEncoder.forget());
   }
   return rv;
 }
 
-nsresult
-nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML) {
-  return GetMarkup(false, aInnerHTML);
+void
+nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
+{
+  aError = GetMarkup(false, aInnerHTML);
 }
 
 NS_IMETHODIMP
 nsGenericHTMLElement::GetOuterHTML(nsAString& aOuterHTML) {
   return GetMarkup(true, aOuterHTML);
 }
 
 void
@@ -1318,18 +1319,19 @@ nsGenericHTMLElement::FireMutationEvents
          child;
          child = child->GetNextSibling()) {
       childNodes.AppendElement(child);
     }
     nsGenericElement::FireNodeInserted(aDoc, aDest, childNodes);
   }
 }
 
-NS_IMETHODIMP
-nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
+void
+nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML,
+                                   ErrorResult& aError)
 {
   nsIDocument* doc = OwnerDoc();
 
   // Batch possible DOMSubtreeModified events.
   mozAutoSubtreeModified subtree(doc, nullptr);
 
   FireNodeRemovedForChildren();
 
@@ -1340,48 +1342,47 @@ nsGenericHTMLElement::SetInnerHTML(const
   uint32_t childCount = GetChildCount();
   nsAutoMutationBatch mb(this, true, false);
   for (uint32_t i = 0; i < childCount; ++i) {
     RemoveChildAt(0, true);
   }
   mb.RemovalDone();
 
   nsAutoScriptLoaderDisabler sld(doc);
-  
-  nsresult rv = NS_OK;
+
   if (doc->IsHTML()) {
     int32_t oldChildCount = GetChildCount();
-    rv = nsContentUtils::ParseFragmentHTML(aInnerHTML,
-                                           this,
-                                           Tag(),
-                                           GetNameSpaceID(),
-                                           doc->GetCompatibilityMode() ==
-                                             eCompatibility_NavQuirks,
-                                           true);
+    aError = nsContentUtils::ParseFragmentHTML(aInnerHTML,
+                                               this,
+                                               Tag(),
+                                               GetNameSpaceID(),
+                                               doc->GetCompatibilityMode() ==
+                                                 eCompatibility_NavQuirks,
+                                               true);
     mb.NodesAdded();
     // HTML5 parser has notified, but not fired mutation events.
     FireMutationEventsForDirectParsing(doc, this, oldChildCount);
   } else {
     nsCOMPtr<nsIDOMDocumentFragment> df;
-    rv = nsContentUtils::CreateContextualFragment(this, aInnerHTML,
-                                                  true,
-                                                  getter_AddRefs(df));
+    aError = nsContentUtils::CreateContextualFragment(this, aInnerHTML,
+                                                      true,
+                                                      getter_AddRefs(df));
     nsCOMPtr<nsINode> fragment = do_QueryInterface(df);
-    if (NS_SUCCEEDED(rv)) {
+    if (!aError.Failed()) {
       // Suppress assertion about node removal mutation events that can't have
       // listeners anyway, because no one has had the chance to register mutation
       // listeners on the fragment that comes from the parser.
       nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
 
+      nsresult rv = NS_OK;
       static_cast<nsINode*>(this)->AppendChild(fragment, &rv);
+      aError = rv;
       mb.NodesAdded();
     }
   }
-
-  return rv;
 }
 
 NS_IMETHODIMP
 nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
 {
   nsCOMPtr<nsINode> parent = GetNodeParent();
   if (!parent) {
     return NS_OK;
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -102,16 +102,21 @@ public:
   }
   void SetDraggable(bool aDraggable, mozilla::ErrorResult& aError)
   {
     aError = SetAttrHelper(nsGkAtoms::draggable,
                            aDraggable ? NS_LITERAL_STRING("true")
                                       : NS_LITERAL_STRING("false"));
   }
 
+  virtual void GetInnerHTML(nsAString& aInnerHTML,
+                            mozilla::ErrorResult& aError);
+  virtual void SetInnerHTML(const nsAString& aInnerHTML,
+                            mozilla::ErrorResult& aError);
+
   // nsIDOMHTMLElement methods. Note that these are non-virtual
   // methods, implementations are expected to forward calls to these
   // methods.
   nsresult GetId(nsAString& aId);
   nsresult SetId(const nsAString& aId);
   nsresult GetTitle(nsAString& aTitle);
   nsresult SetTitle(const nsAString& aTitle);
   nsresult GetLang(nsAString& aLang);
@@ -149,23 +154,34 @@ public:
   }
   nsresult SetDraggable(bool aDraggable)
   {
     mozilla::ErrorResult rv;
     SetDraggable(aDraggable, rv);
     return rv.ErrorCode();
   }
 
+  nsresult GetDOMInnerHTML(nsAString& aInnerHTML)
+  {
+    mozilla::ErrorResult rv;
+    GetInnerHTML(aInnerHTML, rv);
+    return rv.ErrorCode();
+  }
+  nsresult SetDOMInnerHTML(const nsAString& aInnerHTML)
+  {
+    mozilla::ErrorResult rv;
+    SetInnerHTML(aInnerHTML, rv);
+    return rv.ErrorCode();
+  }
+
   nsresult GetOffsetTop(int32_t* aOffsetTop);
   nsresult GetOffsetLeft(int32_t* aOffsetLeft);
   nsresult GetOffsetWidth(int32_t* aOffsetWidth);
   nsresult GetOffsetHeight(int32_t* aOffsetHeight);
   nsresult GetOffsetParent(nsIDOMElement** aOffsetParent);
-  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
   NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML);
   NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML);
   NS_IMETHOD InsertAdjacentHTML(const nsAString& aPosition,
                                 const nsAString& aText);
   nsresult ScrollIntoView(bool aTop, uint8_t optional_argc);
   // Declare Blur(), GetHidden(), SetHidden(), GetSpellcheck(), and
   // SetSpellcheck() such that classes that inherit interfaces with those
   // methods properly override them.
@@ -1398,178 +1414,16 @@ protected:
     NS_INTERFACE_TABLE_ENTRY(_class, _i5)                                     \
     NS_INTERFACE_TABLE_ENTRY(_class, _i6)                                     \
     NS_INTERFACE_TABLE_ENTRY(_class, _i7)                                     \
     NS_INTERFACE_TABLE_ENTRY(_class, _i8)                                     \
     NS_INTERFACE_TABLE_ENTRY(_class, _i9)                                     \
     NS_INTERFACE_TABLE_ENTRY(_class, _i10)                                    \
   NS_OFFSET_AND_INTERFACE_TABLE_END
 
-/* Use this macro to declare functions that forward the behavior of this
- * interface to another object. 
- * This macro doesn't forward
- * - GetInnerHTML
- * - SetInnerHTML
- * because sometimes elements want to override them.
- */
-#define NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(_to) \
-  NS_IMETHOD GetId(nsAString& aId) { \
-    return _to GetId(aId); \
-  } \
-  NS_IMETHOD SetId(const nsAString& aId) { \
-    return _to SetId(aId); \
-  } \
-  NS_IMETHOD GetTitle(nsAString& aTitle) { \
-    return _to GetTitle(aTitle); \
-  } \
-  NS_IMETHOD SetTitle(const nsAString& aTitle) { \
-    return _to SetTitle(aTitle); \
-  } \
-  NS_IMETHOD GetLang(nsAString& aLang) { \
-    return _to GetLang(aLang); \
-  } \
-  NS_IMETHOD SetLang(const nsAString& aLang) { \
-    return _to SetLang(aLang); \
-  } \
-  NS_IMETHOD GetDir(nsAString& aDir) { \
-    return _to GetDir(aDir); \
-  } \
-  NS_IMETHOD SetDir(const nsAString& aDir) { \
-    return _to SetDir(aDir); \
-  } \
-  NS_IMETHOD GetClassName(nsAString& aClassName) { \
-    return _to GetClassName(aClassName); \
-  } \
-  NS_IMETHOD SetClassName(const nsAString& aClassName) { \
-    return _to SetClassName(aClassName); \
-  } \
-  NS_IMETHOD GetDataset(nsIDOMDOMStringMap** aDataset) { \
-    return _to GetDataset(aDataset); \
-  } \
-  NS_IMETHOD GetHidden(bool* aHidden) { \
-    return _to GetHidden(aHidden); \
-  } \
-  NS_IMETHOD SetHidden(bool aHidden) { \
-    return _to SetHidden(aHidden); \
-  } \
-  NS_IMETHOD DOMClick() { \
-    return _to DOMClick(); \
-  } \
-  NS_IMETHOD GetTabIndex(int32_t* aTabIndex) { \
-    return _to GetTabIndex(aTabIndex); \
-  } \
-  NS_IMETHOD SetTabIndex(int32_t aTabIndex) { \
-    return _to SetTabIndex(aTabIndex); \
-  } \
-  NS_IMETHOD DOMFocus() { \
-    return _to DOMFocus(); \
-  } \
-  NS_IMETHOD Blur() { \
-    return _to Blur(); \
-  } \
-  NS_IMETHOD GetItemScope(bool* aItemScope) { \
-    return _to GetItemScope(aItemScope); \
-  } \
-  NS_IMETHOD SetItemScope(bool aItemScope) { \
-    return _to SetItemScope(aItemScope); \
-  } \
-  NS_IMETHOD GetItemType(nsIVariant** aType) { \
-    return _to GetItemType(aType); \
-  } \
-  NS_IMETHOD SetItemType(nsIVariant* aType) { \
-    return _to SetItemType(aType); \
-  } \
-  NS_IMETHOD GetItemId(nsAString& aId) { \
-    return _to GetItemId(aId); \
-  } \
-  NS_IMETHOD SetItemId(const nsAString& aId) { \
-    return _to SetItemId(aId); \
-  } \
-  NS_IMETHOD GetProperties(nsIDOMHTMLPropertiesCollection** aReturn) { \
-    return _to GetProperties(aReturn); \
-  } \
-  NS_IMETHOD GetItemValue(nsIVariant** aValue) { \
-    return _to GetItemValue(aValue); \
-  } \
-  NS_IMETHOD SetItemValue(nsIVariant* aValue) { \
-    return _to SetItemValue(aValue); \
-  } \
-  NS_IMETHOD GetItemRef(nsIVariant** aRef) { \
-    return _to GetItemRef(aRef); \
-  } \
-  NS_IMETHOD SetItemRef(nsIVariant* aRef) { \
-    return _to SetItemRef(aRef); \
-  } \
-  NS_IMETHOD GetItemProp(nsIVariant** aProp) { \
-    return _to GetItemProp(aProp); \
-  } \
-  NS_IMETHOD SetItemProp(nsIVariant* aProp) { \
-    return _to SetItemProp(aProp); \
-  } \
-  NS_IMETHOD GetAccessKey(nsAString& aAccessKey) { \
-    return _to GetAccessKey(aAccessKey); \
-  } \
-  NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) { \
-    return _to SetAccessKey(aAccessKey); \
-  } \
-  NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) { \
-    return _to GetAccessKeyLabel(aAccessKeyLabel); \
-  } \
-  NS_IMETHOD GetDraggable(bool* aDraggable) { \
-    return _to GetDraggable(aDraggable); \
-  } \
-  NS_IMETHOD SetDraggable(bool aDraggable) { \
-    return _to SetDraggable(aDraggable); \
-  } \
-  NS_IMETHOD GetContentEditable(nsAString& aContentEditable) { \
-    return _to GetContentEditable(aContentEditable); \
-  } \
-  NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) { \
-    return _to SetContentEditable(aContentEditable); \
-  } \
-  NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) { \
-    return _to GetIsContentEditable(aIsContentEditable); \
-  } \
-  NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) { \
-    return _to GetContextMenu(aContextMenu); \
-  } \
-  NS_IMETHOD GetSpellcheck(bool* aSpellcheck) { \
-    return _to GetSpellcheck(aSpellcheck); \
-  } \
-  NS_IMETHOD SetSpellcheck(bool aSpellcheck) { \
-    return _to SetSpellcheck(aSpellcheck); \
-  } \
-  NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) { \
-    return _to GetOuterHTML(aOuterHTML); \
-  } \
-  NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) { \
-    return _to SetOuterHTML(aOuterHTML); \
-  } \
-  NS_IMETHOD InsertAdjacentHTML(const nsAString& position, const nsAString& text) { \
-    return _to InsertAdjacentHTML(position, text); \
-  } \
-  NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) { \
-    return _to ScrollIntoView(top, _argc); \
-  } \
-  NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { \
-    return _to GetOffsetParent(aOffsetParent); \
-  } \
-  NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) { \
-    return _to GetOffsetTop(aOffsetTop); \
-  } \
-  NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) { \
-    return _to GetOffsetLeft(aOffsetLeft); \
-  } \
-  NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) { \
-    return _to GetOffsetWidth(aOffsetWidth); \
-  } \
-  NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) { \
-    return _to GetOffsetHeight(aOffsetHeight); \
-  }
-
 /**
  * A macro to declare the NS_NewHTMLXXXElement() functions.
  */
 #define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName)                       \
 nsGenericHTMLElement*                                                      \
 NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
                                   mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
 
--- a/content/html/content/src/nsHTMLElement.cpp
+++ b/content/html/content/src/nsHTMLElement.cpp
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMHTMLElement.h"
 
 #include "nsContentUtils.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 class nsHTMLElement : public nsGenericHTMLElement,
                       public nsIDOMHTMLElement
 {
 public:
   nsHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo);
   virtual ~nsHTMLElement();
@@ -22,21 +23,19 @@ public:
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
-    return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
-  }
+  NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
+  virtual void GetInnerHTML(nsAString& aInnerHTML,
+                            mozilla::ErrorResult& aError) MOZ_OVERRIDE;
 
   nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 };
 
@@ -66,27 +65,27 @@ DOMCI_NODE_DATA(HTMLElement, nsHTMLEleme
 NS_INTERFACE_TABLE_HEAD(nsHTMLElement)
   NS_HTML_CONTENT_INTERFACE_TABLE0(nsHTMLElement)
   NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLElement)
 
 NS_IMPL_ELEMENT_CLONE(nsHTMLElement)
 
-nsresult
-nsHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
+void
+nsHTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
 {
   /**
    * nsGenericHTMLElement::GetInnerHTML escapes < and > characters (at least).
    * .innerHTML should return the HTML code for xmp and plaintext element.
    *
    * This code is a workaround until we implement a HTML5 Serializer
    * with this behavior.
    */
   if (mNodeInfo->Equals(nsGkAtoms::xmp) ||
       mNodeInfo->Equals(nsGkAtoms::plaintext)) {
     nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
-    return NS_OK;
+    return;
   }
 
-  return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
+  nsGenericHTMLElement::GetInnerHTML(aInnerHTML, aError);
 }
 
--- a/content/html/content/src/nsHTMLScriptElement.cpp
+++ b/content/html/content/src/nsHTMLScriptElement.cpp
@@ -44,19 +44,21 @@ public:
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
+  NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
+  virtual void GetInnerHTML(nsAString& aInnerHTML,
+                            mozilla::ErrorResult& aError) MOZ_OVERRIDE;
+  virtual void SetInnerHTML(const nsAString& aInnerHTML,
+                            mozilla::ErrorResult& aError) MOZ_OVERRIDE;
 
   // nsIDOMHTMLScriptElement
   NS_DECL_NSIDOMHTMLSCRIPTELEMENT
 
   // nsIScriptElement
   virtual void GetScriptType(nsAString& type);
   virtual void GetScriptText(nsAString& text);
   virtual void GetScriptCharset(nsAString& charset);
@@ -219,27 +221,27 @@ nsHTMLScriptElement::AfterSetAttr(int32_
 {
   if (nsGkAtoms::async == aName && kNameSpaceID_None == aNamespaceID) {
     mForceAsync = false;
   }
   return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
                                             aNotify);
 }
 
-nsresult
-nsHTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML)
+void
+nsHTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
 {
   nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
-  return NS_OK;
 }
 
-nsresult
-nsHTMLScriptElement::SetInnerHTML(const nsAString& aInnerHTML)
+void
+nsHTMLScriptElement::SetInnerHTML(const nsAString& aInnerHTML,
+                                  ErrorResult& aError)
 {
-  return nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
+  aError = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
 }
 
 // variation of this code in nsSVGScriptElement - check if changes
 // need to be transfered when modifying
 
 void
 nsHTMLScriptElement::GetScriptType(nsAString& type)
 {
--- a/content/html/content/src/nsHTMLStyleElement.cpp
+++ b/content/html/content/src/nsHTMLStyleElement.cpp
@@ -13,16 +13,19 @@
 #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();
@@ -32,19 +35,21 @@ public:
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
+  NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
+  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,
@@ -244,34 +249,33 @@ nsHTMLStyleElement::UnsetAttr(int32_t aN
        aAttribute == nsGkAtoms::media ||
        aAttribute == nsGkAtoms::type)) {
     UpdateStyleSheetInternal(nullptr, true);
   }
 
   return rv;
 }
 
-nsresult
-nsHTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML)
+void
+nsHTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
 {
   nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
-  return NS_OK;
 }
 
-nsresult
-nsHTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML)
+void
+nsHTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML,
+                                 ErrorResult& aError)
 {
   SetEnableUpdates(false);
 
-  nsresult rv = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
-  
+  aError = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
+
   SetEnableUpdates(true);
-  
+
   UpdateStyleSheetInternal(nullptr);
-  return rv;
 }
 
 already_AddRefed<nsIURI>
 nsHTMLStyleElement::GetStyleSheetURL(bool* aIsInline)
 {
   *aIsInline = true;
   return nullptr;
 }
--- a/dom/interfaces/html/nsIDOMHTMLElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLElement.idl
@@ -60,16 +60,17 @@ interface nsIDOMHTMLElement : nsIDOMElem
            attribute boolean          draggable;
            attribute DOMString        contentEditable;
   readonly attribute boolean          isContentEditable;
   readonly attribute nsIDOMHTMLMenuElement contextMenu;
            attribute boolean          spellcheck;
 
 
   // DOM Parsing and Serialization
+  [binaryname(DOMInnerHTML)]
            attribute DOMString        innerHTML;
            attribute DOMString        outerHTML;
   void insertAdjacentHTML(in DOMString position,
                           in DOMString text);
 
 
   // CSSOM View
   [optional_argc] void scrollIntoView([optional] in boolean top);