Simplify nsCommandLineServiceMac, make it easier to understand and faster. Remove unused code. b=542936 r=mstange r=bsmedberg

This commit is contained in:
Josh Aas 2010-06-08 18:26:12 -04:00
Родитель 39732698ea
Коммит 9f7736e493
6 изменённых файлов: 87 добавлений и 353 удалений

Просмотреть файл

@ -51,7 +51,6 @@
#include "nsINativeAppSupport.h" #include "nsINativeAppSupport.h"
#include "nsAppRunner.h" #include "nsAppRunner.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsCommandLineServiceMac.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsIAppStartup.h" #include "nsIAppStartup.h"
@ -63,6 +62,8 @@
#include "nsICommandLineRunner.h" #include "nsICommandLineRunner.h"
#include "nsIMacDockSupport.h" #include "nsIMacDockSupport.h"
#include "nsIStandaloneNativeMenu.h" #include "nsIStandaloneNativeMenu.h"
#include "nsILocalFileMac.h"
#include "nsString.h"
@interface MacApplicationDelegate : NSObject @interface MacApplicationDelegate : NSObject
{ {
@ -152,14 +153,9 @@ SetupMacApplicationDelegate()
NS_OBJC_END_TRY_ABORT_BLOCK; NS_OBJC_END_TRY_ABORT_BLOCK;
} }
// Opening the application is handled specially elsewhere,
// don't define applicationOpenUntitledFile: .
// The method that NSApplication calls upon a request to reopen, such as when // The method that NSApplication calls upon a request to reopen, such as when
// the Dock icon is clicked and no windows are open. // the Dock icon is clicked and no windows are open. A "visible" window may be
// miniaturized, so we can't skip nsCocoaNativeReOpen() if 'flag' is 'true'.
// A "visible" window may be miniaturized, so we can't skip
// nsCocoaNativeReOpen() if 'flag' is 'true'.
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApp hasVisibleWindows:(BOOL)flag - (BOOL)applicationShouldHandleReopen:(NSApplication*)theApp hasVisibleWindows:(BOOL)flag
{ {
nsCOMPtr<nsINativeAppSupport> nas = do_CreateInstance(NS_NATIVEAPPSUPPORT_CONTRACTID); nsCOMPtr<nsINativeAppSupport> nas = do_CreateInstance(NS_NATIVEAPPSUPPORT_CONTRACTID);
@ -175,19 +171,42 @@ SetupMacApplicationDelegate()
// The method that NSApplication calls when documents are requested to be opened. // The method that NSApplication calls when documents are requested to be opened.
// It will be called once for each selected document. // It will be called once for each selected document.
- (BOOL)application:(NSApplication*)theApplication openFile:(NSString*)filename - (BOOL)application:(NSApplication*)theApplication openFile:(NSString*)filename
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
// Take advantage of the existing "command line" code for Macs. NSString *escapedPath = [filename stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
nsMacCommandLine& cmdLine = nsMacCommandLine::GetMacCommandLine();
// URLWithString expects our string to be a legal URL with percent escapes.
filename = [filename stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// We don't actually care about Mac filetypes in this context, just pass a placeholder.
cmdLine.HandleOpenOneDoc((CFURLRef)[NSURL URLWithString:filename], 'abcd');
return YES; nsCOMPtr<nsILocalFileMac> inFile;
nsresult rv = NS_NewLocalFileWithCFURL((CFURLRef)[NSURL URLWithString:escapedPath], PR_TRUE, getter_AddRefs(inFile));
if (NS_FAILED(rv))
return NO;
nsCOMPtr<nsICommandLineRunner> cmdLine(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
if (!cmdLine) {
NS_ERROR("Couldn't create command line!");
return NO;
}
nsCString filePath;
rv = inFile->GetNativePath(filePath);
if (NS_FAILED(rv))
return NO;
nsCOMPtr<nsIFile> workingDir;
rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(workingDir));
if (NS_FAILED(rv))
return NO;
const char *argv[3] = {nsnull, "-file", filePath.get()};
rv = cmdLine->Init(3, const_cast<char**>(argv), workingDir, nsICommandLine::STATE_REMOTE_EXPLICIT);
if (NS_FAILED(rv))
return NO;
if (NS_SUCCEEDED(cmdLine->Run()))
return YES;
return NO;
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO); NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
} }
@ -195,23 +214,12 @@ SetupMacApplicationDelegate()
// The method that NSApplication calls when documents are requested to be printed // The method that NSApplication calls when documents are requested to be printed
// from the Finder (under the "File" menu). // from the Finder (under the "File" menu).
// It will be called once for each selected document. // It will be called once for each selected document.
- (BOOL)application:(NSApplication*)theApplication printFile:(NSString*)filename - (BOOL)application:(NSApplication*)theApplication printFile:(NSString*)filename
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; return NO;
// Take advantage of the existing "command line" code for Macs.
nsMacCommandLine& cmdLine = nsMacCommandLine::GetMacCommandLine();
// We don't actually care about Mac filetypes in this context, just pass a placeholder.
cmdLine.HandlePrintOneDoc((CFURLRef)[NSURL URLWithString:filename], 'abcd');
return YES;
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
} }
// Create the menu that shows up in the Dock. // Create the menu that shows up in the Dock.
- (NSMenu*)applicationDockMenu:(NSApplication*)sender - (NSMenu*)applicationDockMenu:(NSApplication*)sender
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;

Просмотреть файл

@ -117,12 +117,10 @@ endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CMMSRCS += MacLaunchHelper.mm CMMSRCS += MacLaunchHelper.mm
CPPSRCS += nsCommandLineServiceMac.cpp
OS_CXXFLAGS += -fexceptions
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CMMSRCS += MacApplicationDelegate.mm CMMSRCS += MacApplicationDelegate.mm
CMMSRCS += MacAutoreleasePool.mm CMMSRCS += MacAutoreleasePool.mm
CPPSRCS += nsCommandLineServiceMac.cpp
OS_CXXFLAGS += -fexceptions
endif endif
ifdef MOZ_X11 ifdef MOZ_X11

Просмотреть файл

@ -1757,7 +1757,7 @@ static nsresult LaunchChild(nsINativeAppSupport* aNative,
mozilla::AndroidBridge::Bridge()->ScheduleRestart(); mozilla::AndroidBridge::Bridge()->ScheduleRestart();
#else #else
#if defined(XP_MACOSX) #if defined(XP_MACOSX)
SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE);
LaunchChildMac(gRestartArgc, gRestartArgv); LaunchChildMac(gRestartArgc, gRestartArgv);
#else #else
nsCOMPtr<nsILocalFile> lf; nsCOMPtr<nsILocalFile> lf;
@ -1963,7 +1963,7 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
#ifdef XP_MACOSX #ifdef XP_MACOSX
SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE);
#endif #endif
#ifdef XP_WIN #ifdef XP_WIN
@ -2053,7 +2053,7 @@ ImportProfiles(nsIToolkitProfileService* aPService,
xpcom.RegisterProfileService(); xpcom.RegisterProfileService();
#ifdef XP_MACOSX #ifdef XP_MACOSX
SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE);
#endif #endif
nsCOMPtr<nsIProfileMigrator> migrator nsCOMPtr<nsIProfileMigrator> migrator
@ -3571,14 +3571,13 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
cmdLine = do_CreateInstance("@mozilla.org/toolkit/command-line;1"); cmdLine = do_CreateInstance("@mozilla.org/toolkit/command-line;1");
NS_ENSURE_TRUE(cmdLine, 1); NS_ENSURE_TRUE(cmdLine, 1);
SetupMacCommandLine(gArgc, gArgv, PR_FALSE); CommandLineServiceMac::SetupMacCommandLine(gArgc, gArgv, PR_FALSE);
rv = cmdLine->Init(gArgc, gArgv, rv = cmdLine->Init(gArgc, gArgv,
workingDir, nsICommandLine::STATE_INITIAL_LAUNCH); workingDir, nsICommandLine::STATE_INITIAL_LAUNCH);
NS_ENSURE_SUCCESS(rv, 1); NS_ENSURE_SUCCESS(rv, 1);
#endif
#ifdef MOZ_WIDGET_COCOA // Set up ability to respond to system (Apple) events.
// Prepare Cocoa's form of Apple Event handling.
SetupMacApplicationDelegate(); SetupMacApplicationDelegate();
#endif #endif
@ -3614,7 +3613,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
PromiseFlatCString(profileName).get()); PromiseFlatCString(profileName).get());
#endif /* MOZ_ENABLE_XREMOTE */ #endif /* MOZ_ENABLE_XREMOTE */
// enable win32 DDE responses and Mac appleevents responses
nativeApp->Enable(); nativeApp->Enable();
} }
@ -3670,7 +3668,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
#endif #endif
#ifdef XP_MACOSX #ifdef XP_MACOSX
SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE);
#endif #endif
} }
} }

Просмотреть файл

@ -38,293 +38,73 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
// Special stuff for the Macintosh implementation of command-line service.
#include "nsCommandLineServiceMac.h" #include "nsCommandLineServiceMac.h"
#include "nsDebug.h" #include <CoreFoundation/CoreFoundation.h>
#include "nsILocalFileMac.h" #include <Carbon/Carbon.h>
#include "nsDebug.h"
#include "nsNetUtil.h"
#include "nsIAppStartup.h"
#include "nsIServiceManager.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsIServiceManager.h"
#include "nsNetCID.h"
#include "nsIDOMWindow.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIWindowWatcher.h"
#include "jsapi.h"
#include "nsReadableUtils.h"
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsICommandLineRunner.h"
#include "nsDirectoryServiceDefs.h"
#include "prmem.h" namespace CommandLineServiceMac {
#include "plstr.h"
#include "prenv.h"
// the static instance static const int kArgsGrowSize = 20;
nsMacCommandLine nsMacCommandLine::sMacCommandLine;
/* static char** sArgs = NULL;
* ReadLine -- static int sArgsAllocated = 0;
* static int sArgsUsed = 0;
* Read in a line of text, terminated by CR or LF, from inStream into buf.
* The terminating CR or LF is not included. The text in buf is terminated
* by a null byte.
* Returns the number of bytes in buf. If EOF and zero bytes were read, returns -1.
*/
static PRInt32 ReadLine(FILE* inStream, char* buf, PRInt32 bufSize) void AddToCommandLine(const char* inArgText)
{ {
PRInt32 charsRead = 0; if (sArgsUsed >= sArgsAllocated - 1) {
int c; // realloc does not free the given pointer if allocation fails
char **temp = static_cast<char**>(realloc(sArgs, (sArgsAllocated + kArgsGrowSize) * sizeof(char*)));
if (bufSize < 2) if (!temp)
return -1; return;
sArgs = temp;
while (charsRead < (bufSize-1)) { sArgsAllocated += kArgsGrowSize;
c = getc(inStream);
if (c == EOF || c == '\n' || c == '\r')
break;
buf[charsRead++] = c;
} }
buf[charsRead] = '\0';
char *temp2 = strdup(inArgText);
return (c == EOF && !charsRead) ? -1 : charsRead; if (!temp2)
return;
sArgs[sArgsUsed++] = temp2;
sArgs[sArgsUsed] = NULL;
return;
} }
nsMacCommandLine::nsMacCommandLine() void SetupMacCommandLine(int& argc, char**& argv, PRBool forRestart)
: mArgs(NULL)
, mArgsAllocated(0)
, mArgsUsed(0)
, mStartedUp(PR_FALSE)
{ {
} sArgs = static_cast<char **>(malloc(kArgsGrowSize * sizeof(char*)));
if (!sArgs)
return;
sArgsAllocated = kArgsGrowSize;
sArgs[0] = NULL;
sArgsUsed = 0;
nsMacCommandLine::~nsMacCommandLine() // Copy args, stripping anything we don't want.
{
if (mArgs) {
for (PRUint32 i = 0; i < mArgsUsed; i++)
free(mArgs[i]);
free(mArgs);
}
}
nsresult nsMacCommandLine::Initialize(int& argc, char**& argv)
{
mArgs = static_cast<char **>(malloc(kArgsGrowSize * sizeof(char *)));
if (!mArgs)
return NS_ERROR_FAILURE;
mArgs[0] = nsnull;
mArgsAllocated = kArgsGrowSize;
mArgsUsed = 0;
// Here, we may actually get useful args.
// Copy them first to mArgv.
for (int arg = 0; arg < argc; arg++) { for (int arg = 0; arg < argc; arg++) {
char* flag = argv[arg]; char* flag = argv[arg];
// don't pass on the psn (Process Serial Number) flag from the OS // Don't pass on the psn (Process Serial Number) flag from the OS.
if (strncmp(flag, "-psn_", 5) != 0) if (strncmp(flag, "-psn_", 5) != 0)
AddToCommandLine(flag); AddToCommandLine(flag);
} }
// we've started up now
mStartedUp = PR_TRUE;
argc = mArgsUsed;
argv = mArgs;
return NS_OK;
}
void nsMacCommandLine::SetupCommandLine(int& argc, char**& argv, PRBool forRestart)
{
// Initializes the command line from Apple Events and other sources,
// as appropriate for OS X.
//
// IMPORTANT: This must be done before XPCOM shutdown if the app is to
// relaunch (i.e. before the ScopedXPCOMStartup object goes out of scope).
// XPCOM shutdown can cause other things to process native events, and
// native event processing can cause the waiting Apple Events to be
// discarded.
// Process Apple Events and put them into the arguments.
Initialize(argc, argv);
if (forRestart) { if (forRestart) {
Boolean isForeground = PR_FALSE;
ProcessSerialNumber psnSelf, psnFront;
// If the process will be relaunched, the child should be in the foreground // If the process will be relaunched, the child should be in the foreground
// if the parent is in the foreground. This will be communicated in a // if the parent is in the foreground. This will be communicated in a
// command-line argument to the child. // command-line argument to the child.
Boolean isForeground = false;
ProcessSerialNumber psnSelf, psnFront;
if (::GetCurrentProcess(&psnSelf) == noErr && if (::GetCurrentProcess(&psnSelf) == noErr &&
::GetFrontProcess(&psnFront) == noErr && ::GetFrontProcess(&psnFront) == noErr &&
::SameProcess(&psnSelf, &psnFront, &isForeground) == noErr && ::SameProcess(&psnSelf, &psnFront, &isForeground) == noErr &&
isForeground) { isForeground) {
// The process is currently in the foreground. The relaunched
// process should come to the front, too.
AddToCommandLine("-foreground"); AddToCommandLine("-foreground");
} }
} }
argc = mArgsUsed; argc = sArgsUsed;
argv = mArgs; argv = sArgs;
} }
nsresult nsMacCommandLine::AddToCommandLine(const char* inArgText) } // namespace CommandLineServiceMac
{
if (mArgsUsed >= mArgsAllocated - 1) {
// realloc does not free the given pointer if allocation fails.
char **temp = static_cast<char **>(realloc(mArgs, (mArgsAllocated + kArgsGrowSize) * sizeof(char *)));
if (!temp)
return NS_ERROR_OUT_OF_MEMORY;
mArgs = temp;
mArgsAllocated += kArgsGrowSize;
}
char *temp2 = strdup(inArgText);
if (!temp2)
return NS_ERROR_OUT_OF_MEMORY;
mArgs[mArgsUsed++] = temp2;
mArgs[mArgsUsed] = nsnull;
return NS_OK;
}
nsresult nsMacCommandLine::AddToCommandLine(const char* inOptionString, const CFURLRef file)
{
CFStringRef string = ::CFURLGetString(file);
if (!string)
return NS_ERROR_FAILURE;
CFIndex length = ::CFStringGetLength(string);
CFIndex bufLen = 0;
::CFStringGetBytes(string, CFRangeMake(0, length), kCFStringEncodingUTF8,
0, PR_FALSE, nsnull, 0, &bufLen);
UInt8 buffer[bufLen + 1];
if (!buffer)
return NS_ERROR_OUT_OF_MEMORY;
::CFStringGetBytes(string, CFRangeMake(0, length), kCFStringEncodingUTF8,
0, PR_FALSE, buffer, bufLen, nsnull);
buffer[bufLen] = 0;
AddToCommandLine(inOptionString);
AddToCommandLine((char*)buffer);
return NS_OK;
}
nsresult nsMacCommandLine::AddToEnvironmentVars(const char* inArgText)
{
(void)PR_SetEnv(inArgText);
return NS_OK;
}
nsresult nsMacCommandLine::HandleOpenOneDoc(const CFURLRef file, OSType inFileType)
{
nsCOMPtr<nsILocalFileMac> inFile;
nsresult rv = NS_NewLocalFileWithCFURL(file, PR_TRUE, getter_AddRefs(inFile));
if (NS_FAILED(rv))
return rv;
if (!mStartedUp) {
// Is it the right type to be a command-line file?
if (inFileType == 'TEXT' || inFileType == 'CMDL') {
// Can we open the file?
FILE *fp = 0;
rv = inFile->OpenANSIFileDesc("r", &fp);
if (NS_SUCCEEDED(rv)) {
Boolean foundArgs = false;
Boolean foundEnv = false;
char chars[1024];
static const char kCommandLinePrefix[] = "ARGS:";
static const char kEnvVarLinePrefix[] = "ENV:";
while (ReadLine(fp, chars, sizeof(chars)) != -1) {
// See if there are any command line or environment var settings
if (PL_strstr(chars, kCommandLinePrefix) == chars) {
AddToCommandLine(chars + sizeof(kCommandLinePrefix) - 1);
foundArgs = true;
}
else if (PL_strstr(chars, kEnvVarLinePrefix) == chars) {
AddToEnvironmentVars(chars + sizeof(kEnvVarLinePrefix) - 1);
foundEnv = true;
}
}
fclose(fp);
// If we found a command line or environment vars we want to return now
// rather than trying to open the file as a URL
if (foundArgs || foundEnv)
return NS_OK;
}
}
// If it's not a command-line argument, and we are starting up the application,
// add a command-line "-url" argument to the global list. This means that if
// the app is opened with documents on the mac, they'll be handled the same
// way as if they had been typed on the command line in Unix or DOS.
return AddToCommandLine("-url", file);
}
// Final case: we're not just starting up, use the arg as a -file <arg>
nsCOMPtr<nsICommandLineRunner> cmdLine
(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
if (!cmdLine) {
NS_ERROR("Couldn't create command line!");
return NS_ERROR_FAILURE;
}
nsCString filePath;
rv = inFile->GetNativePath(filePath);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIFile> workingDir;
rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(workingDir));
if (NS_FAILED(rv))
return rv;
const char *argv[3] = {nsnull, "-file", filePath.get()};
rv = cmdLine->Init(3, const_cast<char**>(argv), workingDir, nsICommandLine::STATE_REMOTE_EXPLICIT);
if (NS_FAILED(rv))
return rv;
rv = cmdLine->Run();
return rv;
}
nsresult nsMacCommandLine::HandlePrintOneDoc(const CFURLRef file, OSType fileType)
{
// If we are starting up the application,
// add a command-line "-print" argument to the global list. This means that if
// the app is opened with documents on the mac, they'll be handled the same
// way as if they had been typed on the command line in Unix or DOS.
if (!mStartedUp)
return AddToCommandLine("-print", file);
// Final case: we're not just starting up. How do we handle this?
NS_NOTYETIMPLEMENTED("Write Me");
return NS_ERROR_FAILURE;
}
nsresult nsMacCommandLine::DispatchURLToNewBrowser(const char* url)
{
nsresult rv = AddToCommandLine("-url");
if (NS_SUCCEEDED(rv))
rv = AddToCommandLine(url);
return rv;
}
#pragma mark -
void SetupMacCommandLine(int& argc, char**& argv, PRBool forRestart)
{
nsMacCommandLine& cmdLine = nsMacCommandLine::GetMacCommandLine();
return cmdLine.SetupCommandLine(argc, argv, forRestart);
}

Просмотреть файл

@ -35,63 +35,13 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
// Special stuff for the Macintosh implementation of command-line service.
#ifndef nsCommandLineServiceMac_h_ #ifndef nsCommandLineServiceMac_h_
#define nsCommandLineServiceMac_h_ #define nsCommandLineServiceMac_h_
#include <CoreFoundation/CoreFoundation.h>
#include "nscore.h" #include "nscore.h"
#include "nsError.h"
#include "nsString.h"
class nsMacCommandLine namespace CommandLineServiceMac {
{ void SetupMacCommandLine(int& argc, char**& argv, PRBool forRestart);
public: }
enum
{
kArgsGrowSize = 20
};
nsMacCommandLine();
~nsMacCommandLine();
nsresult Initialize(int& argc, char**& argv);
void SetupCommandLine(int& argc, char**& argv, PRBool forRestart);
nsresult AddToCommandLine(const char* inArgText);
nsresult AddToCommandLine(const char* inOptionString, const CFURLRef file);
nsresult AddToEnvironmentVars(const char* inArgText);
nsresult HandleOpenOneDoc(const CFURLRef file, OSType inFileType);
nsresult HandlePrintOneDoc(const CFURLRef file, OSType fileType);
nsresult DispatchURLToNewBrowser(const char* url);
protected:
nsresult OpenURL(const char* aURL);
nsresult OpenWindow(const char *chrome, const PRUnichar *url);
char** mArgs; // array of arg pointers (augmented argv)
PRUint32 mArgsAllocated; // number of slots available in mArgs
PRUint32 mArgsUsed; // number of slots used in mArgs
PRBool mStartedUp;
public:
static nsMacCommandLine& GetMacCommandLine() { return sMacCommandLine; }
private:
static nsMacCommandLine sMacCommandLine;
};
void SetupMacCommandLine(int& argc, char**& argv, PRBool forRestart);
#endif // nsCommandLineServiceMac_h_ #endif // nsCommandLineServiceMac_h_

Просмотреть файл

@ -542,7 +542,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile,
goto end; goto end;
#ifdef XP_MACOSX #ifdef XP_MACOSX
SetupMacCommandLine(argc, argv, PR_TRUE); CommandLineServiceMac::SetupMacCommandLine(argc, argv, PR_TRUE);
#endif #endif
PR_CreateProcessDetached(updaterPath.get(), argv, nsnull, attr); PR_CreateProcessDetached(updaterPath.get(), argv, nsnull, attr);