From 92f9eb2ffa5071f80b35d77d7784ffe8eebf4cfd Mon Sep 17 00:00:00 2001 From: "alqahira%ardisson.org" Date: Sun, 10 Feb 2008 21:17:28 +0000 Subject: [PATCH] Bug 391683 - Tabs can't handle the 'close' command from AppleScript. Patch by Peter Jaros , r=jeff, sr=smorgan git-svn-id: svn://10.0.0.236/trunk@245371 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/camino/resources/application/Camino.sdef | 3 +++ mozilla/camino/src/appleevents/ScriptingSupport.mm | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mozilla/camino/resources/application/Camino.sdef b/mozilla/camino/resources/application/Camino.sdef index 86713292331..9d3369752e5 100644 --- a/mozilla/camino/resources/application/Camino.sdef +++ b/mozilla/camino/resources/application/Camino.sdef @@ -258,6 +258,9 @@ + + + diff --git a/mozilla/camino/src/appleevents/ScriptingSupport.mm b/mozilla/camino/src/appleevents/ScriptingSupport.mm index 97588ea4bc1..66714e979c0 100644 --- a/mozilla/camino/src/appleevents/ScriptingSupport.mm +++ b/mozilla/camino/src/appleevents/ScriptingSupport.mm @@ -45,6 +45,7 @@ #import "Bookmark.h" #import "AutoCompleteTextField.h" #import "BrowserWindowController.h" +#import "BrowserTabViewItem.h" // This file adds scripting support to various classes. @@ -300,7 +301,7 @@ } } -// BrowserWindow implements a -currentURI but not a -setCurrentURI:. +// BrowserWrapper implements a -currentURI but not a -setCurrentURI:. // This method lets "tab's URL" be a read/write property. - (void)setCurrentURI:(NSString *)newURI { @@ -316,6 +317,16 @@ [self loadURI:newURI referrer:nil flags:NSLoadFlagsNone focusContent:YES allowPopups:NO]; } +// Allow tabs to respond to "close" command. +- (id)close:(NSCloseCommand *)command +{ + if ([[[self tab] tabView] numberOfTabViewItems] > 1) + [(BrowserTabViewItem *)[self tab] closeTab:self]; + else + [[self nativeWindow] performClose:self]; + return nil; +} + @end