aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNik Nyby <nikolas@gnu.org>2015-06-16 18:54:20 -0400
committerNik Nyby <nikolas@gnu.org>2015-06-16 18:54:20 -0400
commit7cf6a6d2f2eb614d36f69cfce7fd771ac99643fb (patch)
tree0e69a84a5385fa91c36df2e3ee9c32738e68a4fc /lib
parentce90f57c6abbef577900078041388ea5a85bb2ef (diff)
downloadlibrejsxul-7cf6a6d2f2eb614d36f69cfce7fd771ac99643fb.tar.lz
librejsxul-7cf6a6d2f2eb614d36f69cfce7fd771ac99643fb.tar.xz
librejsxul-7cf6a6d2f2eb614d36f69cfce7fd771ac99643fb.zip
Add more charset checks to fix errors
Diffstat (limited to 'lib')
-rw-r--r--lib/http_observer/stream_loader.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/http_observer/stream_loader.js b/lib/http_observer/stream_loader.js
index a90e341..09b4a63 100644
--- a/lib/http_observer/stream_loader.js
+++ b/lib/http_observer/stream_loader.js
@@ -140,7 +140,9 @@ StreamListener.prototype.onDetermineCharset = function onDetermineCharset(
return loader.channel.contentCharset;
} else {
match = getRegexForContentType(loader.channel.contentType).exec(data);
- if (match.length > 0 &&
+ if (typeof match !== 'undefined' &&
+ match !== null &&
+ match.length > 0 &&
CHARSETS.indexOf(match[1].toLowerCase()) >= 0
) {
loader.channel.contentCharset = match[1];