From e9b3b5bcd2408676c767e0da05b93fcc7c4f174f Mon Sep 17 00:00:00 2001 From: Deathamns Date: Wed, 24 Dec 2014 23:11:36 +0100 Subject: [PATCH] Firefox: new method for request handling Now both nsIContentPolicy and on-http-* observers are used for net request monitoring. Reasons: - In many cases, nsIContentPolicy.shouldLoad is invoked twice for the same resource, because of the speculative parsing. - nsIContentPolicy.shouldLoad don't have information about the channel, so it can't redirect the request, nor change its headers, however on-http-opening-request can. Also, local mirroring and inline-script blocking has been implemented. --- platform/firefox/frameScript.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/platform/firefox/frameScript.js b/platform/firefox/frameScript.js index c93c7e0..2757873 100644 --- a/platform/firefox/frameScript.js +++ b/platform/firefox/frameScript.js @@ -23,20 +23,18 @@ /******************************************************************************/ +// https://bugzil.la/673569 + (function(frameScriptContext) { 'use strict'; /******************************************************************************/ -let appName; +let appName = Components.stack.filename.match(/:\/\/([^\/]+)/)[1]; let listeners = {}; -try { throw new Error; } catch (ex) { - appName = ex.fileName.match(/:\/\/([^\/]+)/)[1]; -} - -Components.utils['import']('chrome://' + appName + '/content/frameModule.js', {}); +Components.utils['import'](Components.stack.filename.replace('Script', 'Module'), {}); /******************************************************************************/