Bug 896316 - Part 1 - Don't start controlling a read-only input even if it's marked as a login manager field. r=dolske
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 24 Jul 2013 16:57:45 -0700
changeset 139956 10d4c53564bc97d0e96923a964c2caf590dcfe64
parent 139815 7d66decedd217f05183656ebb85501334e6bfae1
child 139957 cb81405573fe2bd178c8b2f5cb62c04e3de297b4
push idunknown
push userunknown
push dateunknown
reviewersdolske
bugs896316
milestone25.0a1
Bug 896316 - Part 1 - Don't start controlling a read-only input even if it's marked as a login manager field. r=dolske
toolkit/components/satchel/nsFormFillController.cpp
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -842,32 +842,34 @@ nsFormFillController::Focus(nsIDOMEvent*
   nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(
     aEvent->InternalDOMEvent()->GetTarget());
   nsCOMPtr<nsINode> inputNode = do_QueryInterface(input);
   if (!inputNode)
     return NS_OK;
 
   bool isReadOnly = false;
   input->GetReadOnly(&isReadOnly);
+  if (isReadOnly)
+    return NS_OK;
 
   bool autocomplete = nsContentUtils::IsAutocompleteEnabled(input);
 
   nsCOMPtr<nsIDOMHTMLElement> datalist;
   input->GetList(getter_AddRefs(datalist));
   bool hasList = datalist != nullptr;
 
   bool dummy;
   bool isPwmgrInput = false;
   if (mPwmgrInputs.Get(inputNode, &dummy))
       isPwmgrInput = true;
 
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(input);
   if (isPwmgrInput || (formControl &&
                        formControl->IsSingleLineTextControl(true) &&
-                       (hasList || autocomplete) && !isReadOnly)) {
+                       (hasList || autocomplete))) {
     StartControllingInput(input);
   }
 
   return NS_OK;
 }
 
 nsresult
 nsFormFillController::KeyPress(nsIDOMEvent* aEvent)