diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 1591f2364852..754361754e20 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -713,9 +713,10 @@ var BrowserUI = { let engine = Services.search.getEngineByName(aName); let submission = engine.getSubmission(searchValue, null); - Browser.selectedBrowser.userTypedValue = submission.uri.spec; Browser.loadURI(submission.uri.spec, { postData: submission.postData }); + // loadURI may open a new tab, so get the selectedBrowser afterward. + Browser.selectedBrowser.userTypedValue = submission.uri.spec; this._titleChanged(Browser.selectedBrowser); }, diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 8d4b92693c4c..8189ce927189 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -601,8 +601,7 @@ var Browser = { this.closeTab(oldTab, { forceClose: true }); oldTab = null; } - } - else { + } else { let params = aParams || {}; let flags = params.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE; browser.loadURIWithFlags(aURI, flags, params.referrerURI, params.charset, params.postData); @@ -2942,7 +2941,7 @@ Tab.prototype = { try { let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE; - let postData = "postData" in aParams ? aParams.postData.value : null; + let postData = ("postData" in aParams && aParams.postData) ? aParams.postData.value : null; let referrerURI = "referrerURI" in aParams ? aParams.referrerURI : null; let charset = "charset" in aParams ? aParams.charset : null; browser.loadURIWithFlags(aURI, flags, referrerURI, charset, postData);