Bug 152482 - fix handling of script popup windows by not loading about:blank or the user homepage when they are opened, since we'll race with gecko's document loading. Also, localized the "Loading" and "Untitled" strings. r=pinkerton, sr=sfraser.

This commit is contained in:
bryner%netscape.com 2002-07-02 21:45:09 +00:00
Родитель de2a97e058
Коммит ff3df6116b
26 изменённых файлов: 122 добавлений и 74 удалений

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

@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
// We need to make a new tab.
tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease];
[tabViewItem setLabel: @"Untitled"];
[tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")];
[tabViewItem setView: newView];
[aTabView addTabViewItem: tabViewItem];
}

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

@ -128,6 +128,7 @@ class nsIDOMNode;
NSModalSession mModalSession;
BOOL mShouldAutosave;
BOOL mShouldLoadHomePage;
BOOL mDrawerCachedFrame;
NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should
@ -196,7 +197,7 @@ class nsIDOMNode;
- (void)importBookmarks: (NSString*)aURLSpec;
- (IBAction)toggleSidebar:(id)aSender;
- (void)newTab;
- (void)newTab:(BOOL)allowHomepage;
- (void)closeTab;
- (void)previousTab;
- (void)nextTab;
@ -215,6 +216,7 @@ class nsIDOMNode;
-(void)autosaveWindowFrame;
-(void)disableAutosave;
-(void)disableLoadPage;
-(void)setChromeMask:(unsigned int)aMask;
-(unsigned int)chromeMask;

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

@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil;
mInitialized = NO;
mMoveReentrant = NO;
mShouldAutosave = YES;
mShouldLoadHomePage = YES;
mChromeMask = 0;
mContextMenuFlags = 0;
mContextMenuEvent = nsnull;
@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil;
mShouldAutosave = NO;
}
-(void)disableLoadPage
{
mShouldLoadHomePage = NO;
}
- (void)windowWillClose:(NSNotification *)notification
{
printf("Window will close notification.\n");
@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil;
// We now remove the IB tab, then add one of our own.
[mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]];
[self newTab];
[self newTab:mShouldLoadHomePage];
if (mURL) {
[self loadURL: mURL];
if (mShouldLoadHomePage)
[self loadURL: mURL];
[mURL release];
}
@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil;
[[self window] display];
}
-(void)newTab
-(void)newTab:(BOOL)allowHomepage
{
PRInt32 newTabPage = 0;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")];
PRInt32 newTabPage = 0;
if (allowHomepage) {
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
}
[newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))];
[newTab setView: newView];
[mTabBrowser addTabViewItem: newTab];
[[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
if (allowHomepage)
[[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
[mTabBrowser selectLastTabViewItem: self];
@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil;
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newView setTab: newTab];
[newTab setLabel: @"Loading..."];
[newTab setLabel: NSLocalizedString(@"TabLoading", @"")];
[newTab setView: newView];
[[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone];

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

@ -56,7 +56,6 @@
#include "nsIWebProgressListener.h"
#define DOCUMENT_DONE_STRING @"Document: Done"
#define LOADING_STRING @"Loading..."
static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
[progress setIndeterminate:YES];
[progress startAnimation:self];
loadingStatus = LOADING_STRING;
loadingStatus = NSLocalizedString(@"TabLoading", @"");
[status setStringValue:loadingStatus];
mIsBusy = YES;
[mTab setLabel: LOADING_STRING];
[mTab setLabel: NSLocalizedString(@"TabLoading", @"")];
if (mWindowController) {
[mWindowController updateToolbarItems];
@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
else {
if (!title || [title isEqualToString:@""])
title = [NSString stringWithString:@"Untitled"];
title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")];
mTitle = [title retain];
}
if ( mIsPrimary )
@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
if (title && ![title isEqualToString:@""])
[mTab setLabel:title];
else
[mTab setLabel:@"Untitled"];
[mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")];
}
//
@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
[controller setChromeMask: aMask];
[controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings.
[controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window
[controller enterModalSession];
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
return [[controller getBrowserWrapper] getBrowserView];

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

@ -207,7 +207,7 @@
// We need to make a new tab.
tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [self window]] autorelease];
[tabViewItem setLabel: @"Untitled"];
[tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")];
[tabViewItem setView: newView];
[self addTabViewItem: tabViewItem];

Двоичные данные
camino/English.lproj/Localizable.strings

Двоичный файл не отображается.

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

@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction)newTab:(id)aSender
{
[[[mApplication mainWindow] windowController] newTab];
[[[mApplication mainWindow] windowController] newTab:YES];
}
-(IBAction)closeTab:(id)aSender

Двоичный файл не отображается.

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

@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction)newTab:(id)aSender
{
[[[mApplication mainWindow] windowController] newTab];
[[[mApplication mainWindow] windowController] newTab:YES];
}
-(IBAction)closeTab:(id)aSender

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

@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
// We need to make a new tab.
tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease];
[tabViewItem setLabel: @"Untitled"];
[tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")];
[tabViewItem setView: newView];
[aTabView addTabViewItem: tabViewItem];
}

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

@ -128,6 +128,7 @@ class nsIDOMNode;
NSModalSession mModalSession;
BOOL mShouldAutosave;
BOOL mShouldLoadHomePage;
BOOL mDrawerCachedFrame;
NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should
@ -196,7 +197,7 @@ class nsIDOMNode;
- (void)importBookmarks: (NSString*)aURLSpec;
- (IBAction)toggleSidebar:(id)aSender;
- (void)newTab;
- (void)newTab:(BOOL)allowHomepage;
- (void)closeTab;
- (void)previousTab;
- (void)nextTab;
@ -215,6 +216,7 @@ class nsIDOMNode;
-(void)autosaveWindowFrame;
-(void)disableAutosave;
-(void)disableLoadPage;
-(void)setChromeMask:(unsigned int)aMask;
-(unsigned int)chromeMask;

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

@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil;
mInitialized = NO;
mMoveReentrant = NO;
mShouldAutosave = YES;
mShouldLoadHomePage = YES;
mChromeMask = 0;
mContextMenuFlags = 0;
mContextMenuEvent = nsnull;
@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil;
mShouldAutosave = NO;
}
-(void)disableLoadPage
{
mShouldLoadHomePage = NO;
}
- (void)windowWillClose:(NSNotification *)notification
{
printf("Window will close notification.\n");
@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil;
// We now remove the IB tab, then add one of our own.
[mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]];
[self newTab];
[self newTab:mShouldLoadHomePage];
if (mURL) {
[self loadURL: mURL];
if (mShouldLoadHomePage)
[self loadURL: mURL];
[mURL release];
}
@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil;
[[self window] display];
}
-(void)newTab
-(void)newTab:(BOOL)allowHomepage
{
PRInt32 newTabPage = 0;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")];
PRInt32 newTabPage = 0;
if (allowHomepage) {
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
}
[newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))];
[newTab setView: newView];
[mTabBrowser addTabViewItem: newTab];
[[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
if (allowHomepage)
[[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
[mTabBrowser selectLastTabViewItem: self];
@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil;
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newView setTab: newTab];
[newTab setLabel: @"Loading..."];
[newTab setLabel: NSLocalizedString(@"TabLoading", @"")];
[newTab setView: newView];
[[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone];

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

@ -56,7 +56,6 @@
#include "nsIWebProgressListener.h"
#define DOCUMENT_DONE_STRING @"Document: Done"
#define LOADING_STRING @"Loading..."
static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
[progress setIndeterminate:YES];
[progress startAnimation:self];
loadingStatus = LOADING_STRING;
loadingStatus = NSLocalizedString(@"TabLoading", @"");
[status setStringValue:loadingStatus];
mIsBusy = YES;
[mTab setLabel: LOADING_STRING];
[mTab setLabel: NSLocalizedString(@"TabLoading", @"")];
if (mWindowController) {
[mWindowController updateToolbarItems];
@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
else {
if (!title || [title isEqualToString:@""])
title = [NSString stringWithString:@"Untitled"];
title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")];
mTitle = [title retain];
}
if ( mIsPrimary )
@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
if (title && ![title isEqualToString:@""])
[mTab setLabel:title];
else
[mTab setLabel:@"Untitled"];
[mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")];
}
//
@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
[controller setChromeMask: aMask];
[controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings.
[controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window
[controller enterModalSession];
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
return [[controller getBrowserWrapper] getBrowserView];

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

@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
// We need to make a new tab.
tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease];
[tabViewItem setLabel: @"Untitled"];
[tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")];
[tabViewItem setView: newView];
[aTabView addTabViewItem: tabViewItem];
}

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

@ -128,6 +128,7 @@ class nsIDOMNode;
NSModalSession mModalSession;
BOOL mShouldAutosave;
BOOL mShouldLoadHomePage;
BOOL mDrawerCachedFrame;
NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should
@ -196,7 +197,7 @@ class nsIDOMNode;
- (void)importBookmarks: (NSString*)aURLSpec;
- (IBAction)toggleSidebar:(id)aSender;
- (void)newTab;
- (void)newTab:(BOOL)allowHomepage;
- (void)closeTab;
- (void)previousTab;
- (void)nextTab;
@ -215,6 +216,7 @@ class nsIDOMNode;
-(void)autosaveWindowFrame;
-(void)disableAutosave;
-(void)disableLoadPage;
-(void)setChromeMask:(unsigned int)aMask;
-(unsigned int)chromeMask;

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

@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil;
mInitialized = NO;
mMoveReentrant = NO;
mShouldAutosave = YES;
mShouldLoadHomePage = YES;
mChromeMask = 0;
mContextMenuFlags = 0;
mContextMenuEvent = nsnull;
@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil;
mShouldAutosave = NO;
}
-(void)disableLoadPage
{
mShouldLoadHomePage = NO;
}
- (void)windowWillClose:(NSNotification *)notification
{
printf("Window will close notification.\n");
@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil;
// We now remove the IB tab, then add one of our own.
[mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]];
[self newTab];
[self newTab:mShouldLoadHomePage];
if (mURL) {
[self loadURL: mURL];
if (mShouldLoadHomePage)
[self loadURL: mURL];
[mURL release];
}
@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil;
[[self window] display];
}
-(void)newTab
-(void)newTab:(BOOL)allowHomepage
{
PRInt32 newTabPage = 0;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")];
PRInt32 newTabPage = 0;
if (allowHomepage) {
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
}
[newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))];
[newTab setView: newView];
[mTabBrowser addTabViewItem: newTab];
[[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
if (allowHomepage)
[[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
[mTabBrowser selectLastTabViewItem: self];
@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil;
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newView setTab: newTab];
[newTab setLabel: @"Loading..."];
[newTab setLabel: NSLocalizedString(@"TabLoading", @"")];
[newTab setView: newView];
[[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone];

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

@ -56,7 +56,6 @@
#include "nsIWebProgressListener.h"
#define DOCUMENT_DONE_STRING @"Document: Done"
#define LOADING_STRING @"Loading..."
static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
[progress setIndeterminate:YES];
[progress startAnimation:self];
loadingStatus = LOADING_STRING;
loadingStatus = NSLocalizedString(@"TabLoading", @"");
[status setStringValue:loadingStatus];
mIsBusy = YES;
[mTab setLabel: LOADING_STRING];
[mTab setLabel: NSLocalizedString(@"TabLoading", @"")];
if (mWindowController) {
[mWindowController updateToolbarItems];
@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
else {
if (!title || [title isEqualToString:@""])
title = [NSString stringWithString:@"Untitled"];
title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")];
mTitle = [title retain];
}
if ( mIsPrimary )
@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
if (title && ![title isEqualToString:@""])
[mTab setLabel:title];
else
[mTab setLabel:@"Untitled"];
[mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")];
}
//
@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
[controller setChromeMask: aMask];
[controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings.
[controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window
[controller enterModalSession];
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
return [[controller getBrowserWrapper] getBrowserView];

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

@ -207,7 +207,7 @@
// We need to make a new tab.
tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [self window]] autorelease];
[tabViewItem setLabel: @"Untitled"];
[tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")];
[tabViewItem setView: newView];
[self addTabViewItem: tabViewItem];

Двоичные данные
chimera/English.lproj/Localizable.strings

Двоичный файл не отображается.

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

@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction)newTab:(id)aSender
{
[[[mApplication mainWindow] windowController] newTab];
[[[mApplication mainWindow] windowController] newTab:YES];
}
-(IBAction)closeTab:(id)aSender

Двоичный файл не отображается.

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

@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction)newTab:(id)aSender
{
[[[mApplication mainWindow] windowController] newTab];
[[[mApplication mainWindow] windowController] newTab:YES];
}
-(IBAction)closeTab:(id)aSender

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

@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
// We need to make a new tab.
tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease];
[tabViewItem setLabel: @"Untitled"];
[tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")];
[tabViewItem setView: newView];
[aTabView addTabViewItem: tabViewItem];
}

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

@ -128,6 +128,7 @@ class nsIDOMNode;
NSModalSession mModalSession;
BOOL mShouldAutosave;
BOOL mShouldLoadHomePage;
BOOL mDrawerCachedFrame;
NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should
@ -196,7 +197,7 @@ class nsIDOMNode;
- (void)importBookmarks: (NSString*)aURLSpec;
- (IBAction)toggleSidebar:(id)aSender;
- (void)newTab;
- (void)newTab:(BOOL)allowHomepage;
- (void)closeTab;
- (void)previousTab;
- (void)nextTab;
@ -215,6 +216,7 @@ class nsIDOMNode;
-(void)autosaveWindowFrame;
-(void)disableAutosave;
-(void)disableLoadPage;
-(void)setChromeMask:(unsigned int)aMask;
-(unsigned int)chromeMask;

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

@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil;
mInitialized = NO;
mMoveReentrant = NO;
mShouldAutosave = YES;
mShouldLoadHomePage = YES;
mChromeMask = 0;
mContextMenuFlags = 0;
mContextMenuEvent = nsnull;
@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil;
mShouldAutosave = NO;
}
-(void)disableLoadPage
{
mShouldLoadHomePage = NO;
}
- (void)windowWillClose:(NSNotification *)notification
{
printf("Window will close notification.\n");
@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil;
// We now remove the IB tab, then add one of our own.
[mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]];
[self newTab];
[self newTab:mShouldLoadHomePage];
if (mURL) {
[self loadURL: mURL];
if (mShouldLoadHomePage)
[self loadURL: mURL];
[mURL release];
}
@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil;
[[self window] display];
}
-(void)newTab
-(void)newTab:(BOOL)allowHomepage
{
PRInt32 newTabPage = 0;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")];
PRInt32 newTabPage = 0;
if (allowHomepage) {
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
pref->GetIntPref("browser.tabs.startPage", &newTabPage);
}
[newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))];
[newTab setView: newView];
[mTabBrowser addTabViewItem: newTab];
[[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
if (allowHomepage)
[[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone];
[mTabBrowser selectLastTabViewItem: self];
@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil;
CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease];
[newView setTab: newTab];
[newTab setLabel: @"Loading..."];
[newTab setLabel: NSLocalizedString(@"TabLoading", @"")];
[newTab setView: newView];
[[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone];

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

@ -56,7 +56,6 @@
#include "nsIWebProgressListener.h"
#define DOCUMENT_DONE_STRING @"Document: Done"
#define LOADING_STRING @"Loading..."
static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
[progress setIndeterminate:YES];
[progress startAnimation:self];
loadingStatus = LOADING_STRING;
loadingStatus = NSLocalizedString(@"TabLoading", @"");
[status setStringValue:loadingStatus];
mIsBusy = YES;
[mTab setLabel: LOADING_STRING];
[mTab setLabel: NSLocalizedString(@"TabLoading", @"")];
if (mWindowController) {
[mWindowController updateToolbarItems];
@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
else {
if (!title || [title isEqualToString:@""])
title = [NSString stringWithString:@"Untitled"];
title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")];
mTitle = [title retain];
}
if ( mIsPrimary )
@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
if (title && ![title isEqualToString:@""])
[mTab setLabel:title];
else
[mTab setLabel:@"Untitled"];
[mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")];
}
//
@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
[controller setChromeMask: aMask];
[controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings.
[controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window
[controller enterModalSession];
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
return [[controller getBrowserWrapper] getBrowserView];