Bug 1418078 - Convert XPIDL, C++ users of nsIDOMHTMLInputElement. r?bz
MozReview-Commit-ID: 9K5wL93cZ4j
--- a/toolkit/components/passwordmgr/nsILoginManager.idl
+++ b/toolkit/components/passwordmgr/nsILoginManager.idl
@@ -4,19 +4,20 @@
#include "nsISupports.idl"
interface nsIURI;
interface nsILoginInfo;
interface nsIAutoCompleteResult;
interface nsIFormAutoCompleteObserver;
-interface nsIDOMHTMLInputElement;
interface nsIPropertyBag;
+webidl HTMLInputElement;
+
[scriptable, uuid(38c7f6af-7df9-49c7-b558-2776b24e6cc1)]
interface nsILoginManager : nsISupports {
/**
* This promise is resolved when initialization is complete, and is rejected
* in case initialization failed. This includes the initial loading of the
* login data as well as any migration from previous versions.
*
* Calling any method of nsILoginManager before this promise is resolved
@@ -221,17 +222,17 @@ interface nsILoginManager : nsISupports
* Generate results for a userfield autocomplete menu.
*
* NOTE: This interface is provided for use only by the FormFillController,
* which calls it directly. This isn't really ideal, it should
* probably be callback registered through the FFC.
*/
void autoCompleteSearchAsync(in AString aSearchString,
in nsIAutoCompleteResult aPreviousResult,
- in nsIDOMHTMLInputElement aElement,
+ in HTMLInputElement aElement,
in nsIFormAutoCompleteObserver aListener);
/**
* Stop a previously-started async search.
*/
void stopSearch();
/**
--- a/toolkit/components/reputationservice/LoginReputation.cpp
+++ b/toolkit/components/reputationservice/LoginReputation.cpp
@@ -1,21 +1,21 @@
/* -*- Mode: C++; tab-width: 4; 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/. */
#include "LoginReputation.h"
-#include "nsIDOMHTMLInputElement.h"
#include "nsThreadUtils.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/ContentChild.h"
+#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/ipc/URIUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
#define PREF_PP_ENABLED "browser.safebrowsing.passwords.enabled"
#define PREF_PASSWORD_ALLOW_TABLE "urlclassifier.passwordAllowTable"
@@ -323,31 +323,28 @@ LoginReputationService::Shutdown()
already_AddRefed<nsILoginReputationQuery>
LoginReputationService::ConstructQueryParam(nsIURI* aURI)
{
RefPtr<ReputationQueryParam> param = new ReputationQueryParam(aURI);
return param.forget();
}
NS_IMETHODIMP
-LoginReputationService::QueryReputationAsync(nsIDOMHTMLInputElement* aInput,
+LoginReputationService::QueryReputationAsync(HTMLInputElement* aInput,
nsILoginReputationQueryCallback* aCallback)
{
NS_ENSURE_ARG_POINTER(aInput);
LR_LOG(("QueryReputationAsync() [this=%p]", this));
if (!sPasswordProtectionEnabled) {
return NS_ERROR_FAILURE;
}
- nsCOMPtr<nsINode> node = do_QueryInterface(aInput);
- NS_ENSURE_STATE(node);
-
- nsIURI* documentURI = node->OwnerDoc()->GetDocumentURI();
+ nsIURI* documentURI = aInput->OwnerDoc()->GetDocumentURI();
NS_ENSURE_STATE(documentURI);
if (XRE_IsContentProcess()) {
using namespace mozilla::ipc;
ContentChild* content = ContentChild::GetSingleton();
if (content->IsShuttingDown()) {
return NS_ERROR_FAILURE;
--- a/toolkit/components/reputationservice/nsILoginReputation.idl
+++ b/toolkit/components/reputationservice/nsILoginReputation.idl
@@ -1,19 +1,20 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
#include "nsISupports.idl"
-interface nsIDOMHTMLInputElement;
interface nsIURI;
+webidl HTMLInputElement;
+
[scriptable, uuid(6219f9da-297e-446d-8d47-ccdd8e72a1d5)]
interface nsILoginReputationVerdictType : nsISupports {
const unsigned long UNSPECIFIED = 0;
const unsigned long SAFE = 1;
const unsigned long LOW_REPUTATION = 2;
const unsigned long PHISHING = 3;
};
@@ -32,15 +33,15 @@ interface nsILoginReputationQueryCallbac
};
[scriptable, uuid(1b3f1dfe-ce3a-486b-953e-ce5ac863eff9)]
interface nsILoginReputationService : nsISupports {
void init();
// If QueryReputationAsync is called from child, it will make a IPC call
// to parent.
- void queryReputationAsync(in nsIDOMHTMLInputElement aInput,
+ void queryReputationAsync(in HTMLInputElement aInput,
in nsILoginReputationQueryCallback aCallback);
// QueryReputation can only be called from parent
void queryReputation(in nsILoginReputationQuery aQuery,
in nsILoginReputationQueryCallback aCallback);
};
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -279,89 +279,86 @@ nsFormFillController::DetachFromBrowser(
mDocShells.RemoveElementAt(index);
mPopups.RemoveElementAt(index);
return NS_OK;
}
NS_IMETHODIMP
-nsFormFillController::MarkAsLoginManagerField(nsIDOMHTMLInputElement *aInput)
+nsFormFillController::MarkAsLoginManagerField(HTMLInputElement *aInput)
{
/*
* The Login Manager can supply autocomplete results for username fields,
* when a user has multiple logins stored for a site. It uses this
* interface to indicate that the form manager shouldn't handle the
* autocomplete. The form manager also checks for this tag when saving
* form history (so it doesn't save usernames).
*/
- nsCOMPtr<nsIContent> node = do_QueryInterface(aInput);
- NS_ENSURE_STATE(node);
+ NS_ENSURE_STATE(aInput);
// If the field was already marked, we don't want to show the popup again.
- if (mPwmgrInputs.Get(node)) {
+ if (mPwmgrInputs.Get(aInput)) {
return NS_OK;
}
- mPwmgrInputs.Put(node, true);
- node->AddMutationObserverUnlessExists(this);
+ mPwmgrInputs.Put(aInput, true);
+ aInput->AddMutationObserverUnlessExists(this);
nsFocusManager *fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIContent> focusedContent = fm->GetFocusedElement();
- if (focusedContent == node) {
+ if (focusedContent == aInput) {
if (!mFocusedInput) {
- MaybeStartControllingInput(HTMLInputElement::FromNode(node));
+ MaybeStartControllingInput(aInput);
}
}
}
if (!mLoginManager) {
mLoginManager = do_GetService("@mozilla.org/login-manager;1");
}
return NS_OK;
}
NS_IMETHODIMP
-nsFormFillController::MarkAsAutofillField(nsIDOMHTMLInputElement *aInput)
+nsFormFillController::MarkAsAutofillField(HTMLInputElement *aInput)
{
/*
* Support other components implementing form autofill and handle autocomplete
* for the field.
*/
- nsCOMPtr<nsIContent> node = do_QueryInterface(aInput);
- NS_ENSURE_STATE(node);
+ NS_ENSURE_STATE(aInput);
MOZ_LOG(sLogger, LogLevel::Verbose,
- ("MarkAsAutofillField: aInput = %p, node = %p", aInput, node.get()));
+ ("MarkAsAutofillField: aInput = %p", aInput));
- if (mAutofillInputs.Get(node)) {
+ if (mAutofillInputs.Get(aInput)) {
return NS_OK;
}
- mAutofillInputs.Put(node, true);
- node->AddMutationObserverUnlessExists(this);
+ mAutofillInputs.Put(aInput, true);
+ aInput->AddMutationObserverUnlessExists(this);
- nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(aInput);
- txtCtrl->EnablePreview();
+ aInput->EnablePreview();
nsFocusManager *fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIContent> focusedContent = fm->GetFocusedElement();
- if (focusedContent == node) {
- MaybeStartControllingInput(HTMLInputElement::FromNode(node));
+ if (focusedContent == aInput) {
+ MaybeStartControllingInput(aInput);
}
}
return NS_OK;
}
NS_IMETHODIMP
-nsFormFillController::GetFocusedInput(nsIDOMHTMLInputElement **aInput)
+nsFormFillController::GetFocusedInput(HTMLInputElement **aInput)
{
*aInput = mFocusedInput;
NS_IF_ADDREF(*aInput);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
//// nsIAutoCompleteInput
@@ -1174,19 +1171,18 @@ nsFormFillController::KeyPress(Event* aE
nsresult
nsFormFillController::MouseDown(Event* aEvent)
{
MouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (!mouseEvent) {
return NS_ERROR_FAILURE;
}
- nsCOMPtr<nsIDOMHTMLInputElement> targetInput =
- do_QueryInterface(aEvent->GetTarget());
- if (!targetInput) {
+ nsCOMPtr<nsINode> targetNode = do_QueryInterface(aEvent->GetTarget());
+ if (!HTMLInputElement::FromNodeOrNull(targetNode)) {
return NS_OK;
}
int16_t button = mouseEvent->Button();
// In case of a right click we set a timestamp that
// will be checked in Focus() to avoid showing
// both contextmenu and popup at the same time.
--- a/toolkit/components/satchel/nsIFormAutoComplete.idl
+++ b/toolkit/components/satchel/nsIFormAutoComplete.idl
@@ -2,26 +2,27 @@
* 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 "nsISupports.idl"
interface nsIAutoCompleteResult;
interface nsIFormAutoCompleteObserver;
-interface nsIDOMHTMLInputElement;
+
+webidl HTMLInputElement;
[scriptable, uuid(bfd9b82b-0ab3-4b6b-9e54-aa961ff4b732)]
interface nsIFormAutoComplete: nsISupports {
/**
* Generate results for a form input autocomplete menu asynchronously.
*/
void autoCompleteSearchAsync(in AString aInputName,
in AString aSearchString,
- in nsIDOMHTMLInputElement aField,
+ in HTMLInputElement aField,
in nsIAutoCompleteResult aPreviousResult,
in nsIAutoCompleteResult aDatalistResult,
in nsIFormAutoCompleteObserver aListener);
/**
* If a search is in progress, stop it. Otherwise, do nothing. This is used
* to cancel an existing search, for example, in preparation for a new search.
*/
--- a/toolkit/components/satchel/nsIFormFillController.idl
+++ b/toolkit/components/satchel/nsIFormFillController.idl
@@ -1,34 +1,35 @@
/* 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/. */
#include "nsISupports.idl"
interface nsIDocShell;
interface nsIAutoCompletePopup;
-interface nsIDOMHTMLInputElement;
+
+webidl HTMLInputElement;
/*
* nsIFormFillController is an interface for controlling form fill behavior
* on HTML documents. Any number of docShells can be controller concurrently.
* While a docShell is attached, all HTML documents that are loaded within it
* will have a focus listener attached that will listen for when a text input
* is focused. When this happens, the input will be bound to the
* global nsIAutoCompleteController service.
*/
[scriptable, uuid(07f0a0dc-f6e9-4cdd-a55f-56d770523a4c)]
interface nsIFormFillController : nsISupports
{
/*
* The input element the form fill controller is currently bound to.
*/
- readonly attribute nsIDOMHTMLInputElement focusedInput;
+ readonly attribute HTMLInputElement focusedInput;
/*
* Start controlling form fill behavior for the given browser
*
* @param docShell - The docShell to attach to
* @param popup - The popup to show when autocomplete results are available
*/
void attachToBrowser(in nsIDocShell docShell, in nsIAutoCompletePopup popup);
@@ -42,23 +43,23 @@ interface nsIFormFillController : nsISup
/*
* Mark the specified <input> element as being managed by password manager.
* Autocomplete requests will be handed off to the password manager, and will
* not be stored in form history.
*
* @param aInput - The HTML <input> element to tag
*/
- void markAsLoginManagerField(in nsIDOMHTMLInputElement aInput);
+ void markAsLoginManagerField(in HTMLInputElement aInput);
/*
* Mark the specified <input> element as being managed by a form autofill component.
* Autocomplete requests will be handed off to the autofill component.
*
* @param aInput - The HTML <input> element to mark
*/
- void markAsAutofillField(in nsIDOMHTMLInputElement aInput);
+ void markAsAutofillField(in HTMLInputElement aInput);
/*
* Open the autocomplete popup, if possible.
*/
void showPopup();
};
--- a/toolkit/components/satchel/nsIInputListAutoComplete.idl
+++ b/toolkit/components/satchel/nsIInputListAutoComplete.idl
@@ -1,17 +1,18 @@
/* 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/. */
#include "nsISupports.idl"
interface nsIAutoCompleteResult;
-interface nsIDOMHTMLInputElement;
+
+webidl HTMLInputElement;
[scriptable, uuid(0e33de3e-4faf-4a1a-b96e-24115b8bfd45)]
interface nsIInputListAutoComplete: nsISupports {
/**
* Generate results for a form input autocomplete menu.
*/
nsIAutoCompleteResult autoCompleteSearch(in AString aSearchString,
- in nsIDOMHTMLInputElement aField);
+ in HTMLInputElement aField);
};