Bug 1270740 - remove requestAutocomplete DOM code. r=smaug draft
authorJonathan Guillotte-Blouin <jguillotteblouin@mozilla.com>
Thu, 11 May 2017 15:03:57 -0700
changeset 577120 41c3b64ae55b31b6ef8130b3b5f3d3a4547c303a
parent 577119 70e5d3a497dfa31970dbfaa5d14f5f0b4b78a9ff
child 628432 94597435283a15411dde8ac1bac6675e12f216f4
push id58617
push userbmo:jguillotteblouin@mozilla.com
push dateFri, 12 May 2017 21:20:25 +0000
reviewerssmaug
bugs1270740
milestone55.0a1
Bug 1270740 - remove requestAutocomplete DOM code. r=smaug MozReview-Commit-ID: FPHXkOlLbKF
dom/html/HTMLFormElement.cpp
dom/html/HTMLFormElement.h
dom/webidl/AutocompleteErrorEvent.webidl
dom/webidl/HTMLFormElement.webidl
dom/webidl/moz.build
modules/libpref/init/all.js
servo/components/script/dom/webidls/HTMLFormElement.webidl
testing/web-platform/meta/html/dom/interfaces.html.ini
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -6,17 +6,16 @@
 
 #include "mozilla/dom/HTMLFormElement.h"
 
 #include "jsapi.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
-#include "mozilla/dom/AutocompleteErrorEvent.h"
 #include "mozilla/dom/nsCSPUtils.h"
 #include "mozilla/dom/nsCSPContext.h"
 #include "mozilla/dom/nsMixedContentBlocker.h"
 #include "mozilla/dom/HTMLFormControlsCollection.h"
 #include "mozilla/dom/HTMLFormElementBinding.h"
 #include "mozilla/Move.h"
 #include "nsIHTMLDocument.h"
 #include "nsGkAtoms.h"
@@ -27,17 +26,16 @@
 #include "nsError.h"
 #include "nsContentUtils.h"
 #include "nsInterfaceHashtable.h"
 #include "nsContentList.h"
 #include "nsCOMArray.h"
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
 #include "nsIMutableArray.h"
-#include "nsIFormAutofillContentService.h"
 #include "mozilla/BinarySearch.h"
 #include "nsQueryObject.h"
 
 // form submission
 #include "HTMLFormSubmissionConstants.h"
 #include "mozilla/dom/FormData.h"
 #include "mozilla/Telemetry.h"
 #include "nsIFormSubmitObserver.h"
@@ -281,41 +279,16 @@ HTMLFormElement::Reset()
 
 NS_IMETHODIMP
 HTMLFormElement::CheckValidity(bool* retVal)
 {
   *retVal = CheckValidity();
   return NS_OK;
 }
 
-void
-HTMLFormElement::RequestAutocomplete()
-{
-  bool dummy;
-  nsCOMPtr<nsIDOMWindow> window =
-    do_QueryInterface(OwnerDoc()->GetScriptHandlingObject(dummy));
-  nsCOMPtr<nsIFormAutofillContentService> formAutofillContentService =
-    do_GetService("@mozilla.org/formautofill/content-service;1");
-
-  if (!formAutofillContentService || !window) {
-    AutocompleteErrorEventInit init;
-    init.mBubbles = true;
-    init.mCancelable = false;
-    init.mReason = AutoCompleteErrorReason::Disabled;
-
-    RefPtr<AutocompleteErrorEvent> event =
-      AutocompleteErrorEvent::Constructor(this, NS_LITERAL_STRING("autocompleteerror"), init);
-
-    (new AsyncEventDispatcher(this, event))->PostDOMEvent();
-    return;
-  }
-
-  formAutofillContentService->RequestAutocomplete(this, window);
-}
-
 bool
 HTMLFormElement::ParseAttribute(int32_t aNamespaceID,
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::method) {
--- a/dom/html/HTMLFormElement.h
+++ b/dom/html/HTMLFormElement.h
@@ -411,18 +411,16 @@ public:
 #ifdef DEBUG
   static void
   AssertDocumentOrder(const nsTArray<nsGenericHTMLFormElement*>& aControls,
                       nsIContent* aForm);
 #endif
 
   js::ExpandoAndGeneration mExpandoAndGeneration;
 
-  void RequestAutocomplete();
-
 protected:
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   void PostPasswordEvent();
 
   RefPtr<AsyncEventDispatcher> mFormPasswordEventDispatcher;
 
   class RemoveElementRunnable;
deleted file mode 100644
--- a/dom/webidl/AutocompleteErrorEvent.webidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/. */
-
-enum AutoCompleteErrorReason {
-  "",
-  "cancel",
-  "disabled",
-  "invalid"
-};
-
-[Pref="dom.forms.requestAutocomplete",
- Constructor(DOMString type, optional AutocompleteErrorEventInit eventInitDict)]
-interface AutocompleteErrorEvent : Event
-{
-  readonly attribute AutoCompleteErrorReason reason;
-};
-
-dictionary AutocompleteErrorEventInit : EventInit
-{
-  AutoCompleteErrorReason reason = "";
-};
--- a/dom/webidl/HTMLFormElement.webidl
+++ b/dom/webidl/HTMLFormElement.webidl
@@ -41,12 +41,9 @@ interface HTMLFormElement : HTMLElement 
   // TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name);
   getter nsISupports (DOMString name);
 
   [Throws]
   void submit();
   void reset();
   boolean checkValidity();
   boolean reportValidity();
-
-  [Pref="dom.forms.requestAutocomplete"]
-  void requestAutocomplete();
 };
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -1049,17 +1049,16 @@ WEBIDL_FILES += [
 if CONFIG['FUZZING']:
     WEBIDL_FILES += [
         'FuzzingFunctions.webidl',
     ]
 
 GENERATED_EVENTS_WEBIDL_FILES = [
     'AddonEvent.webidl',
     'AnimationPlaybackEvent.webidl',
-    'AutocompleteErrorEvent.webidl',
     'BlobEvent.webidl',
     'CaretStateChangedEvent.webidl',
     'CloseEvent.webidl',
     'DeviceLightEvent.webidl',
     'DeviceOrientationEvent.webidl',
     'DeviceProximityEvent.webidl',
     'ErrorEvent.webidl',
     'FontFaceSetLoadEvent.webidl',
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1229,19 +1229,16 @@ pref("dom.forms.datetime", false);
 pref("dom.forms.datetime.others", false);
 
 // Enable time picker UI. By default, disabled.
 pref("dom.forms.datetime.timepicker", false);
 
 // Support for new @autocomplete values
 pref("dom.forms.autocomplete.experimental", false);
 
-// Enables requestAutocomplete DOM API on forms.
-pref("dom.forms.requestAutocomplete", false);
-
 // Enable search in <select> dropdowns (more than 40 options)
 pref("dom.forms.selectSearch", false);
 // Allow for webpages to provide custom styling for <select>
 // popups. Disabled on Linux due to bug 1338283.
 #ifdef XP_LINUX
 pref("dom.forms.select.customstyling", false);
 #else
 pref("dom.forms.select.customstyling", true);
--- a/servo/components/script/dom/webidls/HTMLFormElement.webidl
+++ b/servo/components/script/dom/webidls/HTMLFormElement.webidl
@@ -19,11 +19,9 @@ interface HTMLFormElement : HTMLElement 
   readonly attribute unsigned long length;
   getter Element? (unsigned long index);
   //getter (RadioNodeList or Element) (DOMString name);
 
   void submit();
   void reset();
   //boolean checkValidity();
   //boolean reportValidity();
-
-  //void requestAutocomplete();
 };
--- a/testing/web-platform/meta/html/dom/interfaces.html.ini
+++ b/testing/web-platform/meta/html/dom/interfaces.html.ini
@@ -107,22 +107,16 @@
     expected: FAIL
 
   [Document interface: operation releaseEvents()]
     expected: FAIL
 
   [Document interface: attribute all]
     expected: FAIL
 
-  [Document interface: attribute onautocomplete]
-    expected: FAIL
-
-  [Document interface: attribute onautocompleteerror]
-    expected: FAIL
-
   [Document interface: attribute oncancel]
     expected: FAIL
 
   [Document interface: attribute oncuechange]
     expected: FAIL
 
   [Document interface: attribute onmousewheel]
     expected: FAIL
@@ -155,22 +149,16 @@
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "queryAll" with the proper type (90)]
     expected: FAIL
 
   [Document interface: calling queryAll(DOMString) on iframe.contentDocument with too few arguments must throw TypeError]
     expected: FAIL
 
-  [Document interface: iframe.contentDocument must inherit property "onautocomplete" with the proper type (94)]
-    expected: FAIL
-
-  [Document interface: iframe.contentDocument must inherit property "onautocompleteerror" with the proper type (95)]
-    expected: FAIL
-
   [Document interface: iframe.contentDocument must inherit property "oncancel" with the proper type (97)]
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "oncuechange" with the proper type (104)]
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "onmousewheel" with the proper type (135)]
     expected: FAIL
@@ -338,22 +326,16 @@
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryAll" with the proper type (90)]
     expected: FAIL
 
   [Document interface: calling queryAll(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError]
     expected: FAIL
 
-  [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onautocomplete" with the proper type (94)]
-    expected: FAIL
-
-  [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onautocompleteerror" with the proper type (95)]
-    expected: FAIL
-
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncancel" with the proper type (97)]
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncuechange" with the proper type (104)]
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousewheel" with the proper type (135)]
     expected: FAIL
@@ -455,22 +437,16 @@
     expected: FAIL
 
   [HTMLElement interface: attribute commandDisabled]
     expected: FAIL
 
   [HTMLElement interface: attribute commandChecked]
     expected: FAIL
 
-  [HTMLElement interface: attribute onautocomplete]
-    expected: FAIL
-
-  [HTMLElement interface: attribute onautocompleteerror]
-    expected: FAIL
-
   [HTMLElement interface: attribute oncancel]
     expected: FAIL
 
   [HTMLElement interface: attribute oncuechange]
     expected: FAIL
 
   [HTMLElement interface: attribute onmousewheel]
     expected: FAIL
@@ -500,22 +476,16 @@
     expected: FAIL
 
   [HTMLElement interface: document.createElement("noscript") must inherit property "commandDisabled" with the proper type (23)]
     expected: FAIL
 
   [HTMLElement interface: document.createElement("noscript") must inherit property "commandChecked" with the proper type (24)]
     expected: FAIL
 
-  [HTMLElement interface: document.createElement("noscript") must inherit property "onautocomplete" with the proper type (26)]
-    expected: FAIL
-
-  [HTMLElement interface: document.createElement("noscript") must inherit property "onautocompleteerror" with the proper type (27)]
-    expected: FAIL
-
   [HTMLElement interface: document.createElement("noscript") must inherit property "oncancel" with the proper type (29)]
     expected: FAIL
 
   [HTMLElement interface: document.createElement("noscript") must inherit property "oncuechange" with the proper type (36)]
     expected: FAIL
 
   [HTMLElement interface: document.createElement("noscript") must inherit property "onmousewheel" with the proper type (67)]
     expected: FAIL
@@ -1076,22 +1046,16 @@
     expected: FAIL
 
   [HTMLTableHeaderCellElement interface: document.createElement("th") must inherit property "sorted" with the proper type (2)]
     expected: FAIL
 
   [HTMLTableHeaderCellElement interface: document.createElement("th") must inherit property "sort" with the proper type (3)]
     expected: FAIL
 
-  [HTMLFormElement interface: operation requestAutocomplete()]
-    expected: FAIL
-
-  [HTMLFormElement interface: document.createElement("form") must inherit property "requestAutocomplete" with the proper type (17)]
-    expected: FAIL
-
   [HTMLInputElement interface: attribute dirName]
     expected: FAIL
 
   [HTMLInputElement interface: attribute valueLow]
     expected: FAIL
 
   [HTMLInputElement interface: attribute valueHigh]
     expected: FAIL
@@ -1277,31 +1241,16 @@
     expected: FAIL
 
   [HTMLMeterElement interface: attribute labels]
     expected: FAIL
 
   [HTMLMeterElement interface: document.createElement("meter") must inherit property "labels" with the proper type (6)]
     expected: FAIL
 
-  [AutocompleteErrorEvent interface: existence and properties of interface object]
-    expected: FAIL
-
-  [AutocompleteErrorEvent interface object length]
-    expected: FAIL
-
-  [AutocompleteErrorEvent interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [AutocompleteErrorEvent interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [AutocompleteErrorEvent interface: attribute reason]
-    expected: FAIL
-
   [HTMLMenuItemElement interface: attribute default]
     expected: FAIL
 
   [HTMLMenuItemElement interface: attribute command]
     expected: FAIL
 
   [RelatedEvent interface: existence and properties of interface object]
     expected: FAIL
@@ -1563,22 +1512,16 @@
 
   [DataTransfer interface object length]
     expected: FAIL
 
   [Window interface: operation showModalDialog(DOMString,any)]
     disabled:
       if e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=981796
 
-  [Window interface: attribute onautocomplete]
-    expected: FAIL
-
-  [Window interface: attribute onautocompleteerror]
-    expected: FAIL
-
   [Window interface: attribute oncancel]
     expected: FAIL
 
   [Window interface: attribute oncuechange]
     expected: FAIL
 
   [Window interface: attribute onmousewheel]
     expected: FAIL
@@ -1588,22 +1531,16 @@
 
   [Window interface: operation createImageBitmap(ImageBitmapSource,long,long,long,long)]
     expected: FAIL
 
   [Window interface: window must inherit property "showModalDialog" with the proper type (34)]
     disabled:
       if e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=981796
 
-  [Window interface: window must inherit property "onautocomplete" with the proper type (39)]
-    expected: FAIL
-
-  [Window interface: window must inherit property "onautocompleteerror" with the proper type (40)]
-    expected: FAIL
-
   [Window interface: window must inherit property "oncancel" with the proper type (42)]
     expected: FAIL
 
   [Window interface: window must inherit property "oncuechange" with the proper type (49)]
     expected: FAIL
 
   [Window interface: window must inherit property "onmousewheel" with the proper type (80)]
     expected: FAIL
@@ -1925,22 +1862,16 @@
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "query" with the proper type (90)]
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "queryAll" with the proper type (91)]
     expected: FAIL
 
-  [Document interface: iframe.contentDocument must inherit property "onautocomplete" with the proper type (95)]
-    expected: FAIL
-
-  [Document interface: iframe.contentDocument must inherit property "onautocompleteerror" with the proper type (96)]
-    expected: FAIL
-
   [Document interface: iframe.contentDocument must inherit property "oncancel" with the proper type (98)]
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "oncuechange" with the proper type (105)]
     expected: FAIL
 
   [Document interface: iframe.contentDocument must inherit property "onmousewheel" with the proper type (136)]
     expected: FAIL
@@ -2060,22 +1991,16 @@
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "query" with the proper type (90)]
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryAll" with the proper type (91)]
     expected: FAIL
 
-  [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onautocomplete" with the proper type (95)]
-    expected: FAIL
-
-  [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onautocompleteerror" with the proper type (96)]
-    expected: FAIL
-
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncancel" with the proper type (98)]
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncuechange" with the proper type (105)]
     expected: FAIL
 
   [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousewheel" with the proper type (136)]
     expected: FAIL
@@ -2108,19 +2033,16 @@
     expected: FAIL
 
   [HTMLTableHeaderCellElement interface object name]
     expected: FAIL
 
   [HTMLKeygenElement interface object name]
     expected: FAIL
 
-  [AutocompleteErrorEvent interface object name]
-    expected: FAIL
-
   [RelatedEvent interface object name]
     expected: FAIL
 
   [CanvasProxy interface object name]
     expected: FAIL
 
   [DrawingStyle interface object name]
     expected: FAIL
@@ -2306,22 +2228,16 @@
     expected: FAIL
 
   [Document interface: new Document() must inherit property "queryAll" with the proper type (90)]
     expected: FAIL
 
   [Document interface: calling queryAll(DOMString) on new Document() with too few arguments must throw TypeError]
     expected: FAIL
 
-  [Document interface: new Document() must inherit property "onautocomplete" with the proper type (94)]
-    expected: FAIL
-
-  [Document interface: new Document() must inherit property "onautocompleteerror" with the proper type (95)]
-    expected: FAIL
-
   [Document interface: new Document() must inherit property "oncancel" with the proper type (97)]
     expected: FAIL
 
   [Document interface: new Document() must inherit property "oncuechange" with the proper type (104)]
     expected: FAIL
 
   [Document interface: new Document() must inherit property "onmousewheel" with the proper type (135)]
     expected: FAIL