Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed a sneaky bug where some pages load 'about:blank' into an iframe…
…, and then load ads into that iframe, so ClickToFlash was thinking that it was a local page and autoloading the ad. booooo
  • Loading branch information
Simone Manganelli authored and Simone Manganelli committed Jul 25, 2009
1 parent 056f38b commit ec2265a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 6 additions & 3 deletions Plugin/CTFWhitelist.m
Expand Up @@ -152,9 +152,12 @@ - (void) _addToWhitelistAlertDidEnd: (NSAlert *)alert returnCode: (int)returnCod

- (BOOL) _isHostWhitelisted
{
// Nil hosts whitelisted by default (e.g. Dashboard)
if (![self host])
{
if ( [[self baseURL] hasPrefix:@"about:"] ) {
// encountered an ad on addictinggames.com where it loaded an
// about:blank page and then inserted ads there
return NO;
} else if ( ![self host] ) {
// Nil hosts whitelisted by default (e.g. Dashboard)
return YES;
}

Expand Down
16 changes: 12 additions & 4 deletions Plugin/Plugin.m
Expand Up @@ -704,10 +704,18 @@ - (BOOL) validateMenuItem: (NSMenuItem *)menuItem
SEL action = [menuItem action];
if (action == @selector(addToWhitelist:))
{
NSString* title = [NSString stringWithFormat:
NSLocalizedString(@"Add %@ to Whitelist", @"Add <sitename> to Whitelist menu title"),
[self host]];
[menuItem setTitle: title];
if ([self host]) {
NSString* title = [NSString stringWithFormat:
NSLocalizedString(@"Add %@ to Whitelist", @"Add <sitename> to Whitelist menu title"),
[self host]];
[menuItem setTitle: title];
} else {
// this case happens sometimes if the base URL is "about:blank",
// so there's no base URL to use for the whitelist, so just disable
// the menu item
enabled = NO;
}

if ([self _isHostWhitelisted])
enabled = NO;
}
Expand Down

0 comments on commit ec2265a

Please sign in to comment.