Bug 689330 - update LauncherShortcuts to use the new web apps repository [r=mfinkle]
authorFabrice Desré <fabrice@mozilla.com>
Mon, 26 Sep 2011 17:32:16 -0700
changeset 78960 db9f10c18560f582e2e5b064362e6ff950f8906b
parent 78959 b620680b7f08ba31d449a9077c4b3eae9d6b4997
child 78961 6d691de3932bf3d3a6b1a244ab7cb17aa8e226f7
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs689330
milestone9.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 689330 - update LauncherShortcuts to use the new web apps repository [r=mfinkle]
toolkit/mozapps/webapps/OpenWebapps.jsm
--- a/toolkit/mozapps/webapps/OpenWebapps.jsm
+++ b/toolkit/mozapps/webapps/OpenWebapps.jsm
@@ -134,16 +134,24 @@ let OpenWebapps = {
     this.webapps[id] = {
       title: aApplication.title,
       storeURI: aApplication.storeURI,
       appURI: aApplication.appURI,
       installData: aApplication.installData,
       installTime: (new Date()).getTime()
     };
     this._writeFile(this.appsFile, JSON.stringify(this.webapps));
+
+    // now save the icon as icon.png in the app directory
+    let iconFile = dir.clone();
+    iconFile.append("icon.png");
+    let uri = Services.io.newURI(aApplication.iconURI, null, null);
+    let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);
+    persist.persistFlags = persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES | persist.PERSIST_FLAGS_BYPASS_CACHE;
+    persist.saveURI(uri, null, null, null, "", iconFile);
   },
  
   _appId: function(aURI) {
     for (let id in this.webapps) {
       if (this.webapps[id].appURI == aURI)
         return id;
     }
     return null;