Bug 1279120 Call revokeObjectURL() on search engine icon blob URLs. r=adw
authorBen Kelly <ben@wanderview.com>
Mon, 27 Jun 2016 08:10:50 -0700
changeset 302707 f0d6274311d480ea61630fa5998511e66f82a774
parent 302706 0cbfbfe2a193c56e656b38cd054a09ea5f4d3076
child 302708 7a6d37ee074f25418bd9ea12309e3a6460022ed3
push id78837
push userbkelly@mozilla.com
push dateMon, 27 Jun 2016 15:10:56 +0000
treeherdermozilla-inbound@f0d6274311d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1279120
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1279120 Call revokeObjectURL() on search engine icon blob URLs. r=adw
browser/base/content/contentSearchUI.js
--- a/browser/base/content/contentSearchUI.js
+++ b/browser/base/content/contentSearchUI.js
@@ -77,16 +77,19 @@ ContentSearchUIController.prototype = {
   // if it's set when the suggestions table is actually opened.
   _pendingOneOffRefresh: undefined,
 
   get defaultEngine() {
     return this._defaultEngine;
   },
 
   set defaultEngine(engine) {
+    if (this._defaultEngine && this._defaultEngine.icon) {
+      URL.revokeObjectURL(this._defaultEngine.icon);
+    }
     let icon;
     if (engine.iconBuffer) {
       icon = this._getFaviconURIFromBuffer(engine.iconBuffer);
     }
     else {
       icon = this._getImageURIForCurrentResolution(
         "chrome://mozapps/skin/places/defaultFavicon.png");
     }
@@ -863,16 +866,20 @@ ContentSearchUIController.prototype = {
       if (engine.iconBuffer) {
         uri = this._getFaviconURIFromBuffer(engine.iconBuffer);
       }
       else {
         uri = this._getImageURIForCurrentResolution(
           "chrome://browser/skin/search-engine-placeholder.png");
       }
       img.setAttribute("src", uri);
+      img.addEventListener("load", function imgLoad() {
+        img.removeEventListener("load", imgLoad);
+        URL.revokeObjectURL(uri);
+      });
       button.appendChild(img);
       button.style.width = buttonWidth + "px";
       button.setAttribute("title", engine.name);
 
       button.engineName = engine.name;
       button.addEventListener("click", this);
       button.addEventListener("mousemove", this);