From fda6d1707e2653674a376e108ab86f7fd7de180c Mon Sep 17 00:00:00 2001 From: Takanori MATSUURA Date: Sun, 22 Apr 2012 14:27:05 -0700 Subject: [PATCH 1/2] Bug 747041. Fix resource:// path usage in browser. r=felipe a=desktop-only --- browser/base/content/browser.js | 2 +- browser/modules/WebappsInstaller.jsm | 6 +++--- browser/modules/webappsUI.jsm | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 7435e44da18..39c1b43180d 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -157,7 +157,7 @@ __defineSetter__("PluralForm", function (val) { }); XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", - "resource:///modules/TelemetryStopwatch.jsm"); + "resource://gre/modules/TelemetryStopwatch.jsm"); #ifdef MOZ_SERVICES_SYNC XPCOMUtils.defineLazyGetter(this, "Weave", function() { diff --git a/browser/modules/WebappsInstaller.jsm b/browser/modules/WebappsInstaller.jsm index 8f56e922b1a..fc7f6f64f93 100644 --- a/browser/modules/WebappsInstaller.jsm +++ b/browser/modules/WebappsInstaller.jsm @@ -8,9 +8,9 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; -Cu.import("resource:///modules/Services.jsm"); -Cu.import("resource:///modules/FileUtils.jsm"); -Cu.import("resource:///modules/NetUtil.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/FileUtils.jsm"); +Cu.import("resource://gre/modules/NetUtil.jsm"); let WebappsInstaller = { /** diff --git a/browser/modules/webappsUI.jsm b/browser/modules/webappsUI.jsm index 63a9951e43d..3ffb068e6ea 100644 --- a/browser/modules/webappsUI.jsm +++ b/browser/modules/webappsUI.jsm @@ -11,7 +11,7 @@ let Cu = Components.utils; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Webapps.jsm"); -Cu.import("resource://gre/modules/WebappsInstaller.jsm"); +Cu.import("resource:///modules/WebappsInstaller.jsm"); let webappsUI = { init: function webappsUI_init() { From fb1fd0a70afcd35f4cd1d707e34151490d16b7ff Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Sun, 22 Apr 2012 14:30:03 -0700 Subject: [PATCH 2/2] Bug 747601. Only create Info.plist file after webapp icon has been downloaded. r=mstange a=desktop-only. OSX caches the application info when Info.plist is created and if the icon has not yet been embedded in the .app package, Finder might indefinitely cache a no-icon app --- browser/modules/WebappsIconHelpers.js | 2 ++ browser/modules/WebappsInstaller.jsm | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/browser/modules/WebappsIconHelpers.js b/browser/modules/WebappsIconHelpers.js index 5f11e489aee..4e3f7bcd9e5 100644 --- a/browser/modules/WebappsIconHelpers.js +++ b/browser/modules/WebappsIconHelpers.js @@ -105,5 +105,7 @@ function getIconForApp(aShell, callback) { function onIconDownloaded(aShell, aMimeType, aStatusCode, aIcon, aCallback) { if (Components.isSuccessCode(aStatusCode)) { aShell.processIcon(aMimeType, aIcon, aCallback); + } else { + aCallback.call(aShell); } } diff --git a/browser/modules/WebappsInstaller.jsm b/browser/modules/WebappsInstaller.jsm index fc7f6f64f93..f1fc6fda97e 100644 --- a/browser/modules/WebappsInstaller.jsm +++ b/browser/modules/WebappsInstaller.jsm @@ -495,7 +495,7 @@ MacNativeApp.prototype = { throw(ex); } - getIconForApp(this); + getIconForApp(this, this._createPListFile); }, _removeInstallation: function(keepProfile) { @@ -561,7 +561,10 @@ MacNativeApp.prototype = { writer.setString("Webapp", "Name", this.appName); writer.setString("Webapp", "Profile", this.appProfileDir.leafName); writer.writeFile(); + }, + _createPListFile: function() { + // ${InstallDir}/Contents/Info.plist let infoPListContent = '\n\ \n\ \n\ @@ -616,7 +619,7 @@ MacNativeApp.prototype = { * @param aCallback a callback function to be called * after the process finishes */ - processIcon: function(aMimeType, aIcon) { + processIcon: function(aMimeType, aIcon, aCallback) { try { let process = Cc["@mozilla.org/process/util;1"] .createInstance(Ci.nsIProcess); @@ -633,6 +636,8 @@ MacNativeApp.prototype = { 9); } catch(e) { throw(e); + } finally { + aCallback.call(this); } }