Bug 1521280 - Remove special-case that's no longer needed after these patches. r=bgrins
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 13 May 2019 21:47:20 +0000
changeset 532489 0d1dee50991e0efa3b56c843cecb53ec140a6076
parent 532488 fe8d487405110dde4f4ed32a508449c0a00ab149
child 532497 ff1f9537eaae4cb4eb9385b4442566b5fb710bd6
push id11268
push usercsabou@mozilla.com
push dateTue, 14 May 2019 15:24:22 +0000
treeherdermozilla-beta@5fb7fcd568d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1521280
milestone68.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 1521280 - Remove special-case that's no longer needed after these patches. r=bgrins After the patches in this bug, the input in the old about:config will no longer be anonymous, so we don't need this anymore since it'll get handled just fine by CollectFromInputElement. Differential Revision: https://phabricator.services.mozilla.com/D30956
toolkit/components/sessionstore/SessionStoreUtils.cpp
--- a/toolkit/components/sessionstore/SessionStoreUtils.cpp
+++ b/toolkit/components/sessionstore/SessionStoreUtils.cpp
@@ -610,77 +610,25 @@ static void CollectFromSelectElement(JSC
       }
       Record<nsString, OwningStringOrBooleanOrObject>::EntryType* entry =
           AppendEntryToCollectedData(select, id, aGeneratedCount, aRetVal);
       entry->mValue.SetAsObject() = &jsval.toObject();
     }
   }
 }
 
-/*
-  @param aDocument: DOMDocument instance to obtain form data for.
-  @return aRetVal: Form data encoded in an object.
- */
-static void CollectFromXULTextbox(Document& aDocument,
-                                  Nullable<CollectedData>& aRetVal) {
-  nsAutoCString url;
-  Unused << aDocument.GetDocumentURI()->GetSpecIgnoringRef(url);
-  if (!url.EqualsLiteral("about:config")) {
-    return;
-  }
-  RefPtr<nsContentList> aboutConfigElements = NS_GetContentList(
-      &aDocument, kNameSpaceID_XUL, NS_LITERAL_STRING("window"));
-  uint32_t length = aboutConfigElements->Length(true);
-  for (uint32_t i = 0; i < length; ++i) {
-    MOZ_ASSERT(aboutConfigElements->Item(i), "null item in node list!");
-    nsAutoString id, value;
-    aboutConfigElements->Item(i)->AsElement()->GetId(id);
-    if (!id.EqualsLiteral("config")) {
-      continue;
-    }
-    RefPtr<nsContentList> textboxs =
-        NS_GetContentList(aboutConfigElements->Item(i)->AsElement(),
-                          kNameSpaceID_XUL, NS_LITERAL_STRING("textbox"));
-    uint32_t boxsLength = textboxs->Length(true);
-    for (uint32_t idx = 0; idx < boxsLength; idx++) {
-      textboxs->Item(idx)->AsElement()->GetId(id);
-      if (!id.EqualsLiteral("textbox")) {
-        continue;
-      }
-      RefPtr<HTMLInputElement> input = HTMLInputElement::FromNode(
-          nsFocusManager::GetRedirectedFocus(textboxs->Item(idx)));
-      if (!input) {
-        continue;
-      }
-      input->GetValue(value, CallerType::System);
-      if (value.IsEmpty() ||
-          input->AttrValueIs(kNameSpaceID_None, nsGkAtoms::value, value,
-                             eCaseMatters)) {
-        continue;
-      }
-      uint16_t generatedCount = 0;
-      Record<nsString, OwningStringOrBooleanOrObject>::EntryType* entry =
-          AppendEntryToCollectedData(input, id, generatedCount, aRetVal);
-      entry->mValue.SetAsString() = value;
-      return;
-    }
-  }
-}
-
 static void CollectCurrentFormData(JSContext* aCx, Document& aDocument,
                                    Nullable<CollectedData>& aRetVal) {
   uint16_t generatedCount = 0;
   /* textarea element */
   CollectFromTextAreaElement(aDocument, generatedCount, aRetVal);
   /* input element */
   CollectFromInputElement(aCx, aDocument, generatedCount, aRetVal);
   /* select element */
   CollectFromSelectElement(aCx, aDocument, generatedCount, aRetVal);
-  /* special case for about:config's search field */
-  CollectFromXULTextbox(aDocument, aRetVal);
 
   Element* bodyElement = aDocument.GetBody();
   if (aDocument.HasFlag(NODE_IS_EDITABLE) && bodyElement) {
     bodyElement->GetInnerHTML(aRetVal.SetValue().mInnerHTML.Construct(),
                               IgnoreErrors());
   }
 
   if (aRetVal.IsNull()) {