From ea0d8cc6b59cfc7bce00b0a61883e00882e96023 Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Sun, 15 Feb 2009 19:05:55 -0800 Subject: [PATCH] Bug 380163 - Run commandline handlers on Mac when the app is already running, r=josh, sr=bsmedberg --- toolkit/xre/nsCommandLineServiceMac.cpp | 55 ++----------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/toolkit/xre/nsCommandLineServiceMac.cpp b/toolkit/xre/nsCommandLineServiceMac.cpp index c218408ecf2..3e3208252f7 100644 --- a/toolkit/xre/nsCommandLineServiceMac.cpp +++ b/toolkit/xre/nsCommandLineServiceMac.cpp @@ -388,30 +388,6 @@ OSErr nsMacCommandLine::HandleOpenOneDoc(const FSSpec& inFileSpec, OSType inFile return (NS_SUCCEEDED(rv)) ? noErr : errAEEventNotHandled; } -OSErr nsMacCommandLine::OpenURL(const char* aURL) -{ - nsresult rv; - - nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); - - nsXPIDLCString browserURL; - if (NS_SUCCEEDED(rv)) - rv = prefBranch->GetCharPref("browser.chromeURL", getter_Copies(browserURL)); - - if (NS_FAILED(rv)) { - NS_WARNING("browser.chromeURL not supplied! How is the app supposed to know what the main window is?"); - browserURL.Assign("chrome://navigator/content/navigator.xul"); - } - - rv = OpenWindow(browserURL.get(), NS_ConvertASCIItoUTF16(aURL).get()); - if (NS_FAILED(rv)) - return errAEEventNotHandled; - - return noErr; -} - - - //---------------------------------------------------------------------------------------- OSErr nsMacCommandLine::HandlePrintOneDoc(const FSSpec& inFileSpec, OSType fileType) //---------------------------------------------------------------------------------------- @@ -429,39 +405,14 @@ OSErr nsMacCommandLine::HandlePrintOneDoc(const FSSpec& inFileSpec, OSType fileT } - -//---------------------------------------------------------------------------------------- -nsresult nsMacCommandLine::OpenWindow(const char *chrome, const PRUnichar *url) -//---------------------------------------------------------------------------------------- -{ - nsCOMPtr wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); - nsCOMPtr urlWrapper(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID)); - if (!wwatch || !urlWrapper) - return NS_ERROR_FAILURE; - - urlWrapper->SetData(nsDependentString(url)); - - nsCOMPtr newWindow; - nsresult rv; - rv = wwatch->OpenWindow(0, chrome, "_blank", - "chrome,dialog=no,all", urlWrapper, - getter_AddRefs(newWindow)); - - return rv; -} - //---------------------------------------------------------------------------------------- OSErr nsMacCommandLine::DispatchURLToNewBrowser(const char* url) //---------------------------------------------------------------------------------------- { OSErr err = errAEEventNotHandled; - if (mStartedUp) - return OpenURL(url); - else { - err = AddToCommandLine("-url"); - if (err == noErr) - err = AddToCommandLine(url); - } + err = AddToCommandLine("-url"); + if (err == noErr) + err = AddToCommandLine(url); return err; }