зеркало из https://github.com/mozilla/pjs.git
Camino only - Bug 299155: Force-reload should invalidate the page's associated favicon. r=smorgan sr=pink
This commit is contained in:
Родитель
e9ab85dd97
Коммит
413d5c1d05
|
@ -552,6 +552,8 @@ enum BWCOpenDest {
|
|||
- (IBAction)backMenu:(id)inSender;
|
||||
- (IBAction)forwardMenu:(id)inSender;
|
||||
|
||||
- (void)reloadBrowserWrapper:(BrowserWrapper *)inWrapper sender:(id)sender;
|
||||
|
||||
// run a modal according to the users pref on opening a feed
|
||||
- (BOOL)shouldWarnBeforeOpeningFeed;
|
||||
- (void)buildFeedsDetectedListMenu:(NSNotification*)notifer;
|
||||
|
@ -3062,18 +3064,41 @@ enum BWCOpenDest {
|
|||
|
||||
- (IBAction)reload:(id)aSender
|
||||
{
|
||||
unsigned int reloadFlags = NSLoadFlagsNone;
|
||||
[self reloadBrowserWrapper:mBrowserView sender:aSender];
|
||||
}
|
||||
|
||||
if ([aSender respondsToSelector:@selector(keyEquivalent)]) {
|
||||
- (IBAction)reloadSendersTab:(id)sender
|
||||
{
|
||||
if ([sender isMemberOfClass:[NSMenuItem class]]) {
|
||||
BrowserTabViewItem* tabViewItem = [mTabBrowser itemWithTag:[sender tag]];
|
||||
if (tabViewItem)
|
||||
[self reloadBrowserWrapper:[tabViewItem view] sender:sender];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)reloadAllTabs:(id)sender
|
||||
{
|
||||
NSEnumerator* tabsEnum = [[mTabBrowser tabViewItems] objectEnumerator];
|
||||
BrowserTabViewItem* curTabItem;
|
||||
while ((curTabItem = [tabsEnum nextObject])) {
|
||||
if ([curTabItem isKindOfClass:[BrowserTabViewItem class]])
|
||||
[self reloadBrowserWrapper:[curTabItem view] sender:sender];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reloadBrowserWrapper:(BrowserWrapper *)inWrapper sender:(id)sender
|
||||
{
|
||||
unsigned int reloadFlags = NSLoadFlagsNone;
|
||||
if ([sender respondsToSelector:@selector(keyEquivalent)]) {
|
||||
// Capital R tests for shift when there's a keyEquivalent, keyEquivalentModifierMask tests when there isn't
|
||||
if ([[aSender keyEquivalent] isEqualToString:@"R"] || ([aSender keyEquivalentModifierMask] & NSShiftKeyMask))
|
||||
if ([[sender keyEquivalent] isEqualToString:@"R"] || ([sender keyEquivalentModifierMask] & NSShiftKeyMask))
|
||||
reloadFlags = NSLoadFlagsBypassCacheAndProxy;
|
||||
}
|
||||
// It's a toolbar button, so we test for shift using modifierFlags
|
||||
else if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
|
||||
reloadFlags = NSLoadFlagsBypassCacheAndProxy;
|
||||
|
||||
[[mBrowserView getBrowserView] reload:reloadFlags];
|
||||
[inWrapper reload:reloadFlags];
|
||||
}
|
||||
|
||||
- (IBAction)stop:(id)aSender
|
||||
|
@ -3470,42 +3495,6 @@ enum BWCOpenDest {
|
|||
[[NSApp delegate] delayedAdjustBookmarksMenuItemsEnabling];
|
||||
}
|
||||
|
||||
- (IBAction)reloadSendersTab:(id)sender
|
||||
{
|
||||
if ([sender isMemberOfClass:[NSMenuItem class]]) {
|
||||
BrowserTabViewItem* tabViewItem = [mTabBrowser itemWithTag:[sender tag]];
|
||||
if (tabViewItem) {
|
||||
unsigned int reloadFlags = NSLoadFlagsNone;
|
||||
// Capital R tests for shift when there's a keyEquivalent, keyEquivalentModifierMask tests when there isn't
|
||||
if ([[sender keyEquivalent] isEqualToString:@"R"] || ([sender keyEquivalentModifierMask] & NSShiftKeyMask))
|
||||
reloadFlags = NSLoadFlagsBypassCacheAndProxy;
|
||||
|
||||
[[[tabViewItem view] getBrowserView] reload:reloadFlags];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)reloadAllTabs:(id)sender
|
||||
{
|
||||
unsigned int reloadFlags = NSLoadFlagsNone;
|
||||
|
||||
if ([sender respondsToSelector:@selector(keyEquivalent)]) {
|
||||
// Capital R tests for shift when there's a keyEquivalent, keyEquivalentModifierMask tests when there isn't
|
||||
if ([[sender keyEquivalent] isEqualToString:@"R"] || ([sender keyEquivalentModifierMask] & NSShiftKeyMask))
|
||||
reloadFlags = NSLoadFlagsBypassCacheAndProxy;
|
||||
}
|
||||
// It's a toolbar button, so we test for shift using modifierFlags
|
||||
else if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
|
||||
reloadFlags = NSLoadFlagsBypassCacheAndProxy;
|
||||
|
||||
NSEnumerator* tabsEnum = [[mTabBrowser tabViewItems] objectEnumerator];
|
||||
BrowserTabViewItem* curTabItem;
|
||||
while ((curTabItem = [tabsEnum nextObject])) {
|
||||
if ([curTabItem isKindOfClass:[BrowserTabViewItem class]])
|
||||
[[[curTabItem view] getBrowserView] reload:reloadFlags];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)moveTabToNewWindow:(id)sender
|
||||
{
|
||||
if ([sender isMemberOfClass:[NSMenuItem class]]) {
|
||||
|
|
|
@ -214,6 +214,7 @@ class nsIArray;
|
|||
- (void)setTab:(NSTabViewItem*)tab;
|
||||
- (NSTabViewItem*) tab;
|
||||
|
||||
- (void)reload:(unsigned int)reloadFlags;
|
||||
- (IBAction)reloadWithNewCharset:(NSString*)charset;
|
||||
- (NSString*)currentCharset;
|
||||
|
||||
|
|
|
@ -1079,6 +1079,14 @@ enum {
|
|||
[curURI isEqualToString:@"about:config"]));
|
||||
}
|
||||
|
||||
- (void)reload:(unsigned int)reloadFlags
|
||||
{
|
||||
// Toss the favicon when force reloading
|
||||
if (reloadFlags == NSLoadFlagsBypassCacheAndProxy)
|
||||
[[SiteIconProvider sharedFavoriteIconProvider] removeImageForPageURL:[self getCurrentURI]];
|
||||
|
||||
[mBrowserView reload:reloadFlags];
|
||||
}
|
||||
|
||||
- (IBAction)reloadWithNewCharset:(NSString*)charset
|
||||
{
|
||||
|
|
|
@ -62,4 +62,7 @@
|
|||
- (NSImage*)siteIconForURL:(NSString*)inURL;
|
||||
- (void)setSiteIcon:(NSImage*)inImage forURL:(NSString*)inURL withExpiration:(NSDate*)inExpirationDate memoryOnly:(BOOL)inMemoryOnly;
|
||||
|
||||
// Purge our cached image of the favicon located at inURL
|
||||
- (void)removeImageForURL:(NSString*)inURL;
|
||||
|
||||
@end
|
||||
|
|
|
@ -54,7 +54,7 @@ static NSString* const kCacheEntryExpirationDateKey = @"exp_date";
|
|||
- (void)setUUID:(NSString*)inUUID expiration:(NSDate*)inExpirationDate forURL:(NSString*)inURL;
|
||||
- (NSString*)UUIDForURL:(NSString*)inURL expired:(BOOL*)outExpired;
|
||||
|
||||
// uuid arg is optional (for speed)
|
||||
// Note also the public method without the uuid arg (same functionality, but slower)
|
||||
- (void)removeImageForURL:(NSString*)inURL uuid:(NSString*)inUUID;
|
||||
|
||||
- (void)loadCache;
|
||||
|
@ -195,6 +195,12 @@ static NSString* const kCacheEntryExpirationDateKey = @"exp_date";
|
|||
return [entryDict objectForKey:kCacheEntryUUIDStringKey];
|
||||
}
|
||||
|
||||
// Simplified public call of |removeImageForURL| without the uuid arg
|
||||
- (void)removeImageForURL:(NSString*)inURL
|
||||
{
|
||||
[self removeImageForURL:inURL uuid:nil];
|
||||
}
|
||||
|
||||
- (void)removeImageForURL:(NSString*)inURL uuid:(NSString*)inUUID
|
||||
{
|
||||
// remove from memory cache
|
||||
|
|
|
@ -89,4 +89,7 @@ class NeckoCacheHelper;
|
|||
// will attempt to look for any cached <link> image urls.
|
||||
- (NSString*)favoriteIconURLFromPageURL:(NSString*)inPageURL;
|
||||
|
||||
// removes the favicon image associated with the page URL from cache.
|
||||
- (void)removeImageForPageURL:(NSString*)inURI;
|
||||
|
||||
@end
|
||||
|
|
|
@ -328,6 +328,15 @@ NeckoCacheHelper::ClearCache()
|
|||
return faviconURL;
|
||||
}
|
||||
|
||||
// -removeImageForPageURL:
|
||||
//
|
||||
// Public method to remove the favicon image associated with a webpage's URL inURI from cache.
|
||||
//
|
||||
- (void)removeImageForPageURL:(NSString*)inURI
|
||||
{
|
||||
[[SiteIconCache sharedSiteIconCache] removeImageForURL:[self favoriteIconURLFromPageURL:inURI]];
|
||||
}
|
||||
|
||||
- (void)addToMissedIconsCache:(NSString*)inURI withExpirationSeconds:(unsigned int)inExpSeconds
|
||||
{
|
||||
if (mIconsCacheHelper)
|
||||
|
|
Загрузка…
Ссылка в новой задаче