summaryrefslogtreecommitdiff
path: root/src/lib/LastListener.js
diff options
context:
space:
mode:
authorhackademix2018-08-18 22:52:34 +0200
committerhackademix2018-08-18 22:52:34 +0200
commitbb232e0895ba2090c5b4555e882453c5f60f2dfb (patch)
tree4d512d1fe9f40c8a77f561f8e9aa6dc4bdf3c8c3 /src/lib/LastListener.js
parent3819592dfcb6618dce067ed9086d914d20e643d5 (diff)
downloadnoscript-bb232e0895ba2090c5b4555e882453c5f60f2dfb.tar.gz
noscript-bb232e0895ba2090c5b4555e882453c5f60f2dfb.tar.xz
noscript-bb232e0895ba2090c5b4555e882453c5f60f2dfb.zip
More reliable attempt to run onResponseHeader listener the last of installed extension.
Diffstat (limited to 'src/lib/LastListener.js')
-rw-r--r--src/lib/LastListener.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/LastListener.js b/src/lib/LastListener.js
index 51600eb..6506e32 100644
--- a/src/lib/LastListener.js
+++ b/src/lib/LastListener.js
@@ -19,12 +19,13 @@ class LastListener {
let ww = this._wrapped = [listener, listener].map(l => {
let w = (...args) => {
if (this.observed.hasListener(w._other)) {
- this.observed.removeListener(w._other);
- if (this.last === w) return this.defaultResult;
+ this.observed.removeListener(w);
+ if (this.last !== w) return this.defaultResult;
} else if (this.installed) {
this.observed.addListener(w._other, ...this.extras);
this.last = w._other;
}
+ debug("Running listener", w === ww[0] ? 0 : 1, ...args);
return this.installed ? this.listener(...args)
: this.defaultResult;
}