diff --git a/Plugin/CTFWhitelist.m b/Plugin/CTFWhitelist.m index b69b7a7b..d6029e96 100644 --- a/Plugin/CTFWhitelist.m +++ b/Plugin/CTFWhitelist.m @@ -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; } diff --git a/Plugin/Plugin.m b/Plugin/Plugin.m index c3b90c9f..89501030 100755 --- a/Plugin/Plugin.m +++ b/Plugin/Plugin.m @@ -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 to Whitelist menu title"), - [self host]]; - [menuItem setTitle: title]; + if ([self host]) { + NSString* title = [NSString stringWithFormat: + NSLocalizedString(@"Add %@ to Whitelist", @"Add 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; }