Skip to content

Commit 1d73228

Browse files
committed
Wrap Content Type Retriever in Error Handler
1 parent e10fc4a commit 1d73228

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

chrome/content/grabber.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,22 @@ hterr_grabber.TracingListener.prototype = {
357357
return;
358358
if (code >= 600)
359359
return;
360-
let mime = channel.contentType;
361-
let cType = mime.substring(0, mime.indexOf('/'));
362-
let cEnc = mime.substring(mime.indexOf('/') + 1);
363-
if (!(cType === 'text' || (cType === 'application' && (cEnc.includes('html') || cEnc.includes('xml'))) || mime === 'image/svg+xml'))
364-
return;
360+
let mime = false;
361+
try
362+
{
363+
mime = channel.contentType;
364+
}
365+
catch (ex)
366+
{
367+
mime = false;
368+
}
369+
if (!!mime)
370+
{
371+
let cType = mime.substring(0, mime.indexOf('/'));
372+
let cEnc = mime.substring(mime.indexOf('/') + 1);
373+
if (!(cType === 'text' || (cType === 'application' && (cEnc.includes('html') || cEnc.includes('xml'))) || mime === 'image/svg+xml'))
374+
return;
375+
}
365376
let extraParam = null;
366377
try
367378
{

0 commit comments

Comments
 (0)