From c650654062536a06438341a4ae5a32844a61584b Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 28 Oct 2014 02:02:51 -0400 Subject: [PATCH] fix dynamic filters in popup exception for built-in web pages --- js/popup.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/popup.js b/js/popup.js index 158f57937..8b70c07da 100644 --- a/js/popup.js +++ b/js/popup.js @@ -58,10 +58,14 @@ var syncDynamicFilter = function(scope, i, result) { // Use dark shade visual cue if the filter is specific to the page hostname // or one of the ancestor hostname. var ownFilter = false; - var filterHostname = matches[3] || '*'; - if ( stats.pageHostname.slice(0 - filterHostname.length) === filterHostname ) { - ownFilter = (stats.pageHostname.length === filterHostname.length) || - (stats.pageHostname.substr(0 - filterHostname.length - 1, 1) === '.'); + // There might be no page hostname on pages where uBlock can't be active, + // like on browser's built-in pages, etc. + if ( stats.pageHostname ) { + var filterHostname = matches[3] || '*'; + if ( stats.pageHostname.slice(0 - filterHostname.length) === filterHostname ) { + ownFilter = (stats.pageHostname.length === filterHostname.length) || + (stats.pageHostname.substr(0 - filterHostname.length - 1, 1) === '.'); + } } el.toggleClass('ownFilter', ownFilter); };