Bug 1278968 - suppress warnings about params is null in nsAb*AutoComplete*.js. r=mkmelin

This commit is contained in:
aceman 2016-07-11 19:53:01 +02:00
Родитель 054d2ec73d
Коммит 029ede1d80
4 изменённых файлов: 11 добавлений и 11 удалений

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

@ -18,12 +18,12 @@ nsAbAutoCompleteMyDomain.prototype = {
applicableHeaders: new Set(["addr_to", "addr_cc", "addr_bcc", "addr_reply"]),
startSearch: function(aString, aSearchParam, aResult, aListener) {
let params = JSON.parse(aSearchParam);
let applicable = this.applicableHeaders.has(params.type);
let params = aSearchParam ? JSON.parse(aSearchParam) : {};
let applicable = ("type" in params) && this.applicableHeaders.has(params.type);
const ACR = Components.interfaces.nsIAutoCompleteResult;
var address = null;
if (applicable && aString && !aString.includes(",")) {
if (params.idKey != this.cachedIdKey) {
if (("idKey" in params) && (params.idKey != this.cachedIdKey)) {
this.cachedIdentity = MailServices.accounts.getIdentity(params.idKey);
this.cachedIdKey = params.idKey;
}

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

@ -333,9 +333,9 @@ nsAbAutoCompleteSearch.prototype = {
*/
startSearch: function startSearch(aSearchString, aSearchParam,
aPreviousResult, aListener) {
let params = JSON.parse(aSearchParam);
let params = aSearchParam ? JSON.parse(aSearchParam) : {};
var result = new nsAbAutoCompleteResult(aSearchString);
if (params.type && !this.applicableHeaders.has(params.type)) {
if (("type" in params) && !this.applicableHeaders.has(params.type)) {
result.searchResult = ACR.RESULT_IGNORED;
aListener.onSearchResult(this, result);
return;

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

@ -167,8 +167,8 @@ nsAbLDAPAutoCompleteSearch.prototype = {
startSearch: function startSearch(aSearchString, aParam,
aPreviousResult, aListener) {
let params = JSON.parse(aParam);
let applicable = !params.type || this.applicableHeaders.has(params.type);
let params = JSON.parse(aParam) || {};
let applicable = !("type" in params) || this.applicableHeaders.has(params.type);
this._result = new nsAbLDAPAutoCompleteResult(aSearchString);
aSearchString = aSearchString.toLocaleLowerCase();
@ -189,7 +189,7 @@ nsAbLDAPAutoCompleteSearch.prototype = {
var acDirURI = null;
var identity;
if (params.idKey) {
if ("idKey" in params) {
try {
identity = MailServices.accounts.getIdentity(params.idKey);
}

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

@ -94,16 +94,16 @@ nsNewsAutoCompleteSearch.prototype = {
// nsIAutoCompleteSearch
startSearch: function startSearch(aSearchString, aSearchParam,
aPreviousResult, aListener) {
let params = JSON.parse(aSearchParam);
let params = aSearchParam ? JSON.parse(aSearchParam) : {};
let result = new nsNewsAutoCompleteResult(aSearchString);
if (!params.type || !params.accountKey ||
if (!("type" in params) || !("accountKey" in params) ||
!kSupportedTypes.has(params.type)) {
result.searchResult = kACR.RESULT_IGNORED;
aListener.onSearchResult(this, result);
return;
}
if (params.accountKey != this.cachedAccountKey) {
if (("accountKey" in params) && (params.accountKey != this.cachedAccountKey)) {
this.cachedAccountKey = params.accountKey;
this.cachedServer = this._findServer(params.accountKey);
}