diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 31ea9b237f1..3aae623ccef 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -5136,10 +5136,16 @@ var FormAssistant = { // Reset invalid submit state on each pageshow case "pageshow": - let target = aEvent.originalTarget; - let selectedDocument = BrowserApp.selectedBrowser.contentDocument; - if (target == selectedDocument || target.ownerDocument == selectedDocument) - this._invalidSubmit = false; + if (!this._invalidSubmit) + return; + + let selectedBrowser = BrowserApp.selectedBrowser; + if (selectedBrowser) { + let selectedDocument = selectedBrowser.contentDocument; + let target = aEvent.originalTarget; + if (target == selectedDocument || target.ownerDocument == selectedDocument) + this._invalidSubmit = false; + } } },