Bug 689599 - Ensure postData is non-null before accessing it in Browser.loadURI [r=mfinkle]

This commit is contained in:
Matt Brubeck 2011-09-27 12:45:49 -07:00
Родитель 166a386b65
Коммит 0669332574
2 изменённых файлов: 4 добавлений и 4 удалений

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

@ -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);
},

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

@ -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);