aboutsummaryrefslogtreecommitdiffstats
path: root/js/vapi-net.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vapi-net.js')
-rw-r--r--js/vapi-net.js46
1 files changed, 23 insertions, 23 deletions
diff --git a/js/vapi-net.js b/js/vapi-net.js
index ec12d2a..f8d1052 100644
--- a/js/vapi-net.js
+++ b/js/vapi-net.js
@@ -29,41 +29,41 @@
vAPI.net = {};
vAPI.net.registerListeners = function () {
- this.onBeforeRequest.types = this.onBeforeRequest.types
- ? new Set(this.onBeforeRequest.types)
- : null;
-
- this.onBeforeSendHeaders.types = this.onBeforeSendHeaders.types
- ? new Set(this.onBeforeSendHeaders.types)
- : null;
+ this.onBeforeRequest.types = this.onBeforeRequest.types
+ ? new Set(this.onBeforeRequest.types)
+ : null;
- let shouldLoadListenerMessageName = location.host + ':shouldLoad';
- let shouldLoadListener = function (e) {
+ this.onBeforeSendHeaders.types = this.onBeforeSendHeaders.types
+ ? new Set(this.onBeforeSendHeaders.types)
+ : null;
+
+ let shouldLoadListenerMessageName = location.host + ':shouldLoad';
+ let shouldLoadListener = function (e) {
let details = e.data;
let pendingReq = vAPI.httpObserver.createPendingRequest(details.url);
pendingReq.rawType = details.rawType;
pendingReq.tabId = vAPI.tabs.manager.tabIdFromTarget(e.target);
- };
+ };
- // https://github.com/gorhill/uMatrix/issues/200
- // We need this only for Firefox 34 and less: the tab id is derived from
- // the origin of the message.
- if (!vAPI.modernFirefox) {
+ // https://github.com/gorhill/uMatrix/issues/200
+ // We need this only for Firefox 34 and less: the tab id is derived from
+ // the origin of the message.
+ if (!vAPI.modernFirefox) {
vAPI.messaging.globalMessageManager
- .addMessageListener(shouldLoadListenerMessageName,
- shouldLoadListener);
- }
+ .addMessageListener(shouldLoadListenerMessageName,
+ shouldLoadListener);
+ }
- vAPI.httpObserver.register();
+ vAPI.httpObserver.register();
- vAPI.addCleanUpTask(function () {
+ vAPI.addCleanUpTask(function () {
if (!vAPI.modernFirefox) {
- vAPI.messaging.globalMessageManager
- .removeMessageListener(shouldLoadListenerMessageName,
- shouldLoadListener);
+ vAPI.messaging.globalMessageManager
+ .removeMessageListener(shouldLoadListenerMessageName,
+ shouldLoadListener);
}
vAPI.httpObserver.unregister();
- });
+ });
};
})();