From 714c02232a6b131ad30ced6f3cceb670a5bf3ffb Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 14 May 2015 10:53:49 -0400 Subject: [PATCH] script injection can throw when not a real HTML document --- platform/firefox/frameModule.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 885812c..2c0bf5f 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -204,8 +204,14 @@ const contentObserver = { let lss = Services.scriptloader.loadSubScript; let sandbox = this.initContentScripts(win, true); - lss(this.contentBaseURI + 'vapi-client.js', sandbox); - lss(this.contentBaseURI + 'contentscript-start.js', sandbox); + // Can throw with attempts at injecting into non-HTML document. + // Example: https://a.pomf.se/avonjf.webm + try { + lss(this.contentBaseURI + 'vapi-client.js', sandbox); + lss(this.contentBaseURI + 'contentscript-start.js', sandbox); + } catch (ex) { + return; // don't further try to inject anything + } let docReady = (e) => { let doc = e.target;