Bug 1466863 - Just use empty metadata if invalid. r=florian, a=RyanVM
authorMichael Kaply <mozilla@kaply.com>
Wed, 06 Jun 2018 15:58:24 -0500
changeset 471309 70c46487e513
parent 471308 c1e1ada55d72
child 471310 bbba8cee7041
push id9364
push userryanvm@gmail.com
push date2018-06-13 23:32 +0000
treeherdermozilla-beta@91934961833a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, RyanVM
bugs1466863
milestone61.0
Bug 1466863 - Just use empty metadata if invalid. r=florian, a=RyanVM MozReview-Commit-ID: 30Q5Sdi5ZRt
toolkit/components/search/nsSearchService.js
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -2069,17 +2069,17 @@ Engine.prototype = {
     return json;
   },
 
   setAttr(name, val) {
     this._metaData[name] = val;
   },
 
   getAttr(name) {
-    return (this._metaData && this._metaData[name]) || undefined;
+    return this._metaData[name] || undefined;
   },
 
   // nsISearchEngine
   get alias() {
     return this.getAttr("alias");
   },
   set alias(val) {
     var value = val ? val.trim() : null;
@@ -3186,17 +3186,17 @@ SearchService.prototype = {
   _loadEnginesMetadataFromCache: function SRCH_SVC__loadEnginesMetadataFromCache(cache) {
     if (!cache.engines)
       return;
 
     for (let engine of cache.engines) {
       let name = engine._name;
       if (name in this._engines) {
         LOG("_loadEnginesMetadataFromCache, transfering metadata for " + name);
-        this._engines[name]._metaData = engine._metaData;
+        this._engines[name]._metaData = engine._metaData || {};
       }
     }
   },
 
   _loadEnginesFromCache: function SRCH_SVC__loadEnginesFromCache(cache,
                                                                  skipReadOnly) {
     if (!cache.engines)
       return;