Bug 366009 - Cocoa should not generate bogus open events for path-like arguments on the command line. r=bsmedberg, smichaud a=bz
authorcbarrett@mozilla.com
Mon, 17 Sep 2007 10:10:52 -0700
changeset 5953 016ae196991209c5f85464dfb1685becdaf3a940
parent 5952 f4e3c316401133c18e32ee73b8c5d794ba2bb7fb
child 5954 3bf4b9cc99afddc697e606380558e5beaed20876
push id3
push userbmcbride@mozilla.com
push dateTue, 03 Mar 2009 05:43:33 +0000
reviewersbsmedberg, smichaud, bz
bugs366009
milestone1.9a8pre
Bug 366009 - Cocoa should not generate bogus open events for path-like arguments on the command line. r=bsmedberg, smichaud a=bz
toolkit/xre/MacApplicationDelegate.mm
--- a/toolkit/xre/MacApplicationDelegate.mm
+++ b/toolkit/xre/MacApplicationDelegate.mm
@@ -72,16 +72,22 @@ void
 EnsureUseCocoaDockAPI()
 {
   [NSApplication sharedApplication];
 }
 
 void
 SetupMacApplicationDelegate()
 {
+  // This call makes it so that application:openFile: doesn't get bogus calls
+  // from Cocoa doing its own parsing of the argument string. And yes, we need
+  // to use a string with a boolean value in it. That's just how it works.
+  [[NSUserDefaults standardUserDefaults] setObject:@"NO"
+                                            forKey:@"NSTreatUnknownArgumentsAsOpen"];
+
   // Create the delegate. This should be around for the lifetime of the app.
   MacApplicationDelegate *delegate = [[MacApplicationDelegate alloc] init];
   [[NSApplication sharedApplication] setDelegate:delegate];
 }
 
 @implementation MacApplicationDelegate
 
 // Opening the application is handled specially elsewhere,