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 473750 70c46487e5132963906f5caab8e0181e7b5e772e
parent 473749 c1e1ada55d728167267ff5cb9c6fd30ceb97b71d
child 473751 bbba8cee7041f692f3182a65687f272cc181f20d
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [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;