Minor problem when parsing locally served web pages, (quick and dirty development) will throw an error with file:// protocol in function 'belongsToHost'
Error: NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMLocation.replace]
Source File: chrome://ghostery/content/ghostery-common.js
Line: 1158
Not sure why but the host value is not a string under such circumstances, but using the String function fixes the error, my tweak:
// returns true if url belongs to host's top or sub-domain
belongsToHost: function(url, host) {
host = String(host).replace(/^www\./, '');
url = ghostery.prefs.parseUri.parse(url).host;
return (url.indexOf(host) !== -1);
},
-
The why is here: [Ghostery 2.9.5]
chrome://ghostery/content/ghostery.js:404try { host = (doc.location.host ? doc.location.host : doc.location); } catch (e) {}
On an http site, doc.location.host is going to be a domain name. With the file protocol, it's an empty string. doc.location is an object, not a string.
You're trying to fix the problem in the wrong place (but thank you for catching it!).
-
-
Okay. I did not delve into the code too deeply I just noticed the error when creating some example pages. So I would assume that better solution is just remove the try in chrome://ghostery/content/ghostery.js:404 and just set it to doc.location.host so it will always be a string and not throw an exception with file:// protocol.
-
-
Thanks guys. Ticket created.. Felix is going to take a look.
-
Loading Profile...



Twitter,
Facebook, or email.

CHAMP
EMPLOYEE
