Bug 1459693, ensure the right anonymous element is focused when calling input.focus(), r=mccr8
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 30 May 2018 17:04:18 +0300
changeset 420503 8398d902299c9df8c0cb522d2d34c1419ee2682b
parent 420502 7a8d360f8c818f8c762f68b795b151db629295a8
child 420504 fc4c476186abb850d78a393eca9996d6ca7f6c83
push id34073
push useraiakab@mozilla.com
push dateWed, 30 May 2018 22:05:51 +0000
treeherdermozilla-central@3931f461c8e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1459693
milestone62.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 1459693, ensure the right anonymous element is focused when calling input.focus(), r=mccr8
dom/html/HTMLInputElement.cpp
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -3173,17 +3173,18 @@ HTMLInputElement::Blur(ErrorResult& aErr
 void
 HTMLInputElement::Focus(ErrorResult& aError)
 {
   if (mType == NS_FORM_INPUT_NUMBER) {
     // Focus our anonymous text control, if we have one.
     nsNumberControlFrame* numberControlFrame =
       do_QueryFrame(GetPrimaryFrame());
     if (numberControlFrame) {
-      HTMLInputElement* textControl = numberControlFrame->GetAnonTextControl();
+      RefPtr<HTMLInputElement> textControl =
+        numberControlFrame->GetAnonTextControl();
       if (textControl) {
         textControl->Focus(aError);
         return;
       }
     }
   }
 
   if ((mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) &&