Bug 1436005 - Make type of nsIDOMWindowUtils.focusedInputType AString r?hsivonen draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 07 Feb 2018 15:16:41 +0900
changeset 751952 3c16304e05c72d01172a9306074882d45e097e3e
parent 751949 bac2a418dddd392a827188ad02923043ccd6ff3c
child 752007 15fa324e81742813939965054c8d41db06217dca
push id98102
push usermasayuki@d-toybox.com
push dateWed, 07 Feb 2018 07:39:57 +0000
reviewershsivonen
bugs1436005
milestone60.0a1
Bug 1436005 - Make type of nsIDOMWindowUtils.focusedInputType AString r?hsivonen nsIDOMWindowUtils.focusedInputType is necessary to check if IMEStateManager sets InputContext of widget properly. So, let's keep it but make its type AString (nsAString&) rather than string (char**). MozReview-Commit-ID: 1RHhmAsPY5a
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1814,27 +1814,24 @@ nsDOMWindowUtils::GetIMEStatus(uint32_t 
     return NS_ERROR_FAILURE;
 
   InputContext context = widget->GetInputContext();
   *aState = static_cast<uint32_t>(context.mIMEState.mEnabled);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::GetFocusedInputType(char** aType)
+nsDOMWindowUtils::GetFocusedInputType(nsAString& aType)
 {
-  NS_ENSURE_ARG_POINTER(aType);
-
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
 
-  InputContext context = widget->GetInputContext();
-  *aType = ToNewCString(context.mHTMLInputType);
+  aType = widget->GetInputContext().mHTMLInputType;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::GetViewId(nsIDOMElement* aElement, nsViewID* aResult)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
   if (content && nsLayoutUtils::FindIDFor(content, aResult)) {
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1507,17 +1507,17 @@ interface nsIDOMWindowUtils : nsISupport
   AString getUnanimatedComputedStyle(in nsIDOMElement aElement,
                                      in AString aPseudoElement,
                                      in AString aProperty,
                                      in long aFlushType);
 
   /**
    * Get the type of the currently focused html input, if any.
    */
-  readonly attribute string focusedInputType;
+  readonly attribute AString focusedInputType;
 
   /**
    * Find the view ID for a given element. This is the reverse of
    * findElementWithViewId().
    */
   nsViewID getViewId(in nsIDOMElement aElement);
 
   /**