Skip to content

Commit ec2265a

Browse files
Simone ManganelliSimone Manganelli
Simone Manganelli
authored and
Simone Manganelli
committed
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
1 parent 056f38b commit ec2265a

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

Plugin/CTFWhitelist.m

+6-3
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ - (void) _addToWhitelistAlertDidEnd: (NSAlert *)alert returnCode: (int)returnCod
152152

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

Plugin/Plugin.m

+12-4
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,18 @@ - (BOOL) validateMenuItem: (NSMenuItem *)menuItem
704704
SEL action = [menuItem action];
705705
if (action == @selector(addToWhitelist:))
706706
{
707-
NSString* title = [NSString stringWithFormat:
708-
NSLocalizedString(@"Add %@ to Whitelist", @"Add <sitename> to Whitelist menu title"),
709-
[self host]];
710-
[menuItem setTitle: title];
707+
if ([self host]) {
708+
NSString* title = [NSString stringWithFormat:
709+
NSLocalizedString(@"Add %@ to Whitelist", @"Add <sitename> to Whitelist menu title"),
710+
[self host]];
711+
[menuItem setTitle: title];
712+
} else {
713+
// this case happens sometimes if the base URL is "about:blank",
714+
// so there's no base URL to use for the whitelist, so just disable
715+
// the menu item
716+
enabled = NO;
717+
}
718+
711719
if ([self _isHostWhitelisted])
712720
enabled = NO;
713721
}

0 commit comments

Comments
 (0)