Bug 1499567 - Do not append an empty text node when creating options from HTMLOptionCollection::SetLength. r=bzbarsky
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 17 Oct 2018 00:10:46 +0000
changeset 500030 ce783284cca7bb33684bf6fbf197387afcd2c3b4
parent 500029 a230ab0deaba1e1940b141c74278eb563b48e0cf
child 500031 f7d1fd195963da3c729622e97599debeb425c335
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1499567
milestone64.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 1499567 - Do not append an empty text node when creating options from HTMLOptionCollection::SetLength. r=bzbarsky Only we do that. Align with other browsers instead. I removed the max-asserts as well because I cannot make my browser assert when running this test on a debug build. Differential Revision: https://phabricator.services.mozilla.com/D8929
dom/html/HTMLSelectElement.cpp
testing/web-platform/meta/html/semantics/forms/the-select-element/common-HTMLOptionsCollection.html.ini
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -637,24 +637,16 @@ HTMLSelectElement::SetLength(uint32_t aL
     }
 
     RefPtr<mozilla::dom::NodeInfo> nodeInfo;
 
     nsContentUtils::QNameChanged(mNodeInfo, nsGkAtoms::option,
                                  getter_AddRefs(nodeInfo));
 
     nsCOMPtr<nsINode> node = NS_NewHTMLOptionElement(nodeInfo.forget());
-
-    RefPtr<nsTextNode> text = new nsTextNode(mNodeInfo->NodeInfoManager());
-
-    aRv = node->AppendChildTo(text, false);
-    if (aRv.Failed()) {
-      return;
-    }
-
     for (uint32_t i = curlen; i < aLength; i++) {
       nsINode::AppendChild(*node, aRv);
       if (aRv.Failed()) {
         return;
       }
 
       if (i + 1 < aLength) {
         node = node->CloneNode(true, aRv);
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/forms/the-select-element/common-HTMLOptionsCollection.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[common-HTMLOptionsCollection.html]
-  max-asserts: 3
-  [Changing the length adds new nodes; The number of new nodes = new length minus old length]
-    expected: FAIL
-