Bug 1426561 - Fix the null pointer issue caused by FormAutofillContent. r=lchang

MozReview-Commit-ID: 6yIYl4NQGuh

--HG--
extra : rebase_source : c806f3c9eb030cdba3aef71939b961230e84449c
This commit is contained in:
Sean Lee 2017-12-28 15:59:22 +08:00
Родитель 558586f7ec
Коммит 563b632f83
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -446,6 +446,9 @@ var FormAutofillContent = {
*
*/
_getFormHandler(element) {
if (!element) {
return null;
}
let rootElement = FormLikeFactory.findRootForField(element);
return this._formsDetails.get(rootElement);
},
@ -474,6 +477,10 @@ var FormAutofillContent = {
*/
updateActiveInput(element) {
element = element || formFillController.focusedInput;
if (!element) {
this._activeItems = {};
return;
}
let handler = this._getFormHandler(element);
if (handler) {
handler.focusedInput = element;
@ -487,7 +494,8 @@ var FormAutofillContent = {
},
get activeInput() {
return this._activeItems.elementWeakRef.get();
let elementWeakRef = this._activeItems.elementWeakRef;
return elementWeakRef ? elementWeakRef.get() : null;
},
get activeHandler() {