Bug 893909 - Part d: Cleanup HTMLSelectElement::Remove; r=dzbarsky
authorMs2ger <ms2ger@gmail.com>
Wed, 24 Jul 2013 09:36:54 +0200
changeset 151942 8a1ecc6236c1985be069259fbf13650589312d64
parent 151941 b6e69ee84ad3afcd5f609af09fdeb9aebef7192a
child 151943 3ec0906fcf685eb6121323113901a946bcd713b9
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdzbarsky
bugs893909
milestone25.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 893909 - Part d: Cleanup HTMLSelectElement::Remove; r=dzbarsky
content/html/content/src/HTMLSelectElement.cpp
--- a/content/html/content/src/HTMLSelectElement.cpp
+++ b/content/html/content/src/HTMLSelectElement.cpp
@@ -671,29 +671,22 @@ HTMLSelectElement::Add(nsIDOMHTMLElement
   ErrorResult error;
   Add(*htmlElement, index, error);
   return error.ErrorCode();
 }
 
 NS_IMETHODIMP
 HTMLSelectElement::Remove(int32_t aIndex)
 {
-  nsCOMPtr<nsIDOMNode> option;
-  Item(aIndex, getter_AddRefs(option));
-
-  if (option) {
-    nsCOMPtr<nsIDOMNode> parent;
-
-    option->GetParentNode(getter_AddRefs(parent));
-    if (parent) {
-      nsCOMPtr<nsIDOMNode> ret;
-      parent->RemoveChild(option, getter_AddRefs(ret));
-    }
+  nsCOMPtr<nsINode> option = Item(static_cast<uint32_t>(aIndex));
+  if (!option) {
+    return NS_OK;
   }
 
+  option->Remove();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLSelectElement::GetOptions(nsIDOMHTMLOptionsCollection** aValue)
 {
   NS_IF_ADDREF(*aValue = GetOptions());