Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 | 305 |
306 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode , mimeType, extra) | 306 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode , mimeType, extra) |
307 { | 307 { |
308 return Ci.nsIContentPolicy.ACCEPT; | 308 return Ci.nsIContentPolicy.ACCEPT; |
309 }, | 309 }, |
310 | 310 |
311 // | 311 // |
312 // nsIObserver interface implementation | 312 // nsIObserver interface implementation |
313 // | 313 // |
314 _openers: new WeakMap(), | 314 _openers: new WeakMap(), |
315 _alreadyLoaded: {}, | 315 _alreadyLoaded: Symbol(), |
Thomas Greiner
2016/08/16 09:50:25
Detail: I'd rather use `Symbol` for that to avoid
Wladimir Palant
2016/08/16 10:36:05
Done.
| |
316 | 316 |
317 observe: function(subject, topic, data, uri) | 317 observe: function(subject, topic, data, uri) |
318 { | 318 { |
319 switch (topic) | 319 switch (topic) |
320 { | 320 { |
321 case "document-element-inserted": | 321 case "document-element-inserted": |
322 { | 322 { |
323 let window = subject.defaultView; | 323 let window = subject.defaultView; |
324 if (!window) | 324 if (!window) |
325 return; | 325 return; |
(...skipping 22 matching lines...) Expand all Loading... | |
348 opener = window.opener; | 348 opener = window.opener; |
349 if (!opener) | 349 if (!opener) |
350 return; | 350 return; |
351 | 351 |
352 // The opener might be an intermediate window, get the real one | 352 // The opener might be an intermediate window, get the real one |
353 while (opener.location == "about:blank" && opener.opener) | 353 while (opener.location == "about:blank" && opener.opener) |
354 opener = opener.opener; | 354 opener = opener.opener; |
355 | 355 |
356 this._openers.set(window, opener); | 356 this._openers.set(window, opener); |
357 | 357 |
358 let forgetPopup = event => | 358 let forgetPopup = event => |
Thomas Greiner
2016/08/16 09:50:25
The issue I'm seeing with this approach is that a
Wladimir Palant
2016/08/16 10:36:05
Yes, we discussed that yesterday briefly. A websit
Thomas Greiner
2016/08/16 11:31:54
I agree, that approach makes more sense.
| |
359 { | 359 { |
360 subject.removeEventListener("DOMContentLoaded", forgetPopup); | 360 subject.removeEventListener("DOMContentLoaded", forgetPopup); |
361 this._openers.set(window, this._alreadyLoaded); | 361 this._openers.set(window, this._alreadyLoaded); |
362 }; | 362 }; |
363 subject.addEventListener("DOMContentLoaded", forgetPopup); | 363 subject.addEventListener("DOMContentLoaded", forgetPopup); |
364 } | 364 } |
365 | 365 |
366 if (!uri) | 366 if (!uri) |
367 uri = window.location.href; | 367 uri = window.location.href; |
368 if (!shouldAllow(opener, opener.document, "POPUP", uri)) | 368 if (!shouldAllow(opener, opener.document, "POPUP", uri)) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 let weights = parentNode[property].split(","); | 509 let weights = parentNode[property].split(","); |
510 weights[index] = "0"; | 510 weights[index] = "0"; |
511 parentNode[property] = weights.join(","); | 511 parentNode[property] = weights.join(","); |
512 } | 512 } |
513 } | 513 } |
514 else | 514 else |
515 node.classList.add(cls); | 515 node.classList.add(cls); |
516 } | 516 } |
517 }); | 517 }); |
518 } | 518 } |
LEFT | RIGHT |