Bug 391683 - Tabs can't handle the 'close' command from AppleScript. Patch by Peter Jaros <peter.a.jaros@gmail.com>, r=jeff, sr=smorgan

git-svn-id: svn://10.0.0.236/trunk@245371 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alqahira%ardisson.org 2008-02-10 21:17:28 +00:00
parent 3e8260e17d
commit 92f9eb2ffa
2 changed files with 15 additions and 1 deletions

View File

@ -258,6 +258,9 @@
<property name="URL" code="pURL" description="The tab&apos;s current URL" type="text">
<cocoa key="currentURI"/>
</property>
<responds-to name="close">
<cocoa method="close:"/>
</responds-to>
</class>
<class name="bookmark item" code="BMIt" plural="bookmark items">
<cocoa class="BookmarkItem"/>

View File

@ -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