mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Backed out changeset d0012e4d8a9a (bug 991766)
This commit is contained in:
parent
cbdabd4cd4
commit
3c21b66c65
@ -2,7 +2,10 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu, Constructor: CC } = Components;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const CC = Components.Constructor;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
@ -116,8 +119,8 @@ this.WebappOSUtils = {
|
||||
#elifdef XP_MACOSX
|
||||
let uniqueName = this.getUniqueName(aApp);
|
||||
|
||||
let mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
|
||||
createInstance(Ci.nsIMacWebAppUtils);
|
||||
let mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]
|
||||
.createInstance(Ci.nsIMacWebAppUtils);
|
||||
|
||||
try {
|
||||
let path;
|
||||
@ -262,8 +265,8 @@ this.WebappOSUtils = {
|
||||
return false;
|
||||
}
|
||||
|
||||
let mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
|
||||
createInstance(Ci.nsIMacWebAppUtils);
|
||||
let mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]
|
||||
.createInstance(Ci.nsIMacWebAppUtils);
|
||||
|
||||
try {
|
||||
mwaUtils.launchAppWithIdentifier(launchIdentifier);
|
||||
@ -328,25 +331,7 @@ this.WebappOSUtils = {
|
||||
|
||||
return deferred.promise;
|
||||
#elifdef XP_MACOSX
|
||||
let [ , path ] = this.getLaunchTarget(aApp);
|
||||
if (!path) {
|
||||
return Promise.reject("App not found");
|
||||
}
|
||||
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
|
||||
createInstance(Ci.nsIMacWebAppUtils);
|
||||
|
||||
mwaUtils.trashApp(path, (aResult) => {
|
||||
if (aResult == Cr.NS_OK) {
|
||||
deferred.resolve(true);
|
||||
} else {
|
||||
deferred.resolve("Error moving the app to the Trash: " + aResult);
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
return Promise.reject("Uninstallation not yet implemented");
|
||||
#elifdef XP_UNIX
|
||||
let exeFile = this.getLaunchTarget(aApp);
|
||||
if (!exeFile) {
|
||||
|
@ -57,26 +57,3 @@ NS_IMETHODIMP nsMacWebAppUtils::LaunchAppWithIdentifier(const nsAString& bundleI
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMacWebAppUtils::TrashApp(const nsAString& path, nsITrashAppCallback* aCallback) {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
if (NS_WARN_IF(!aCallback)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITrashAppCallback> callback = aCallback;
|
||||
|
||||
NSString* tempString = [NSString stringWithCharacters:reinterpret_cast<const unichar*>(((nsString)path).get())
|
||||
length:path.Length()];
|
||||
|
||||
[[NSWorkspace sharedWorkspace] recycleURLs: [NSArray arrayWithObject:[NSURL fileURLWithPath:tempString]]
|
||||
completionHandler: ^(NSDictionary *newURLs, NSError *error) {
|
||||
nsresult rv = (error == nil) ? NS_OK : NS_ERROR_FAILURE;
|
||||
callback->TrashAppFinished(rv);
|
||||
}];
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
@ -6,17 +6,11 @@
|
||||
|
||||
interface nsIMacWebAppUtils;
|
||||
|
||||
[scriptable, function, uuid(8c899c4f-58c1-4b74-9034-3bb64e484b68)]
|
||||
interface nsITrashAppCallback : nsISupports
|
||||
{
|
||||
void trashAppFinished(in nsresult rv);
|
||||
};
|
||||
|
||||
/**
|
||||
* Allow MozApps API to locate and manipulate natively installed apps
|
||||
*/
|
||||
|
||||
[scriptable, uuid(c69cf343-ea41-428b-b161-4655fd54d8e7)]
|
||||
[scriptable, uuid(e9096367-ddd9-45e4-b762-49c0c18b7119)]
|
||||
interface nsIMacWebAppUtils : nsISupports {
|
||||
/**
|
||||
* Find the path for an app with the given signature.
|
||||
@ -28,8 +22,4 @@ interface nsIMacWebAppUtils : nsISupports {
|
||||
*/
|
||||
void launchAppWithIdentifier(in AString bundleIdentifier);
|
||||
|
||||
/**
|
||||
* Move the app from the given directory to the Trash.
|
||||
*/
|
||||
void trashApp(in AString path, in nsITrashAppCallback callback);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user