Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 Services.obs.addObserver(this, "content-document-global-created", true); | 375 Services.obs.addObserver(this, "content-document-global-created", true); |
376 Services.obs.addObserver(this, "xpcom-category-entry-removed", true); | 376 Services.obs.addObserver(this, "xpcom-category-entry-removed", true); |
377 Services.obs.addObserver(this, "xpcom-category-cleared", true); | 377 Services.obs.addObserver(this, "xpcom-category-cleared", true); |
378 | 378 |
379 onShutdown.add(function() | 379 onShutdown.add(function() |
380 { | 380 { |
381 // Our category observers should be removed before changing category | 381 // Our category observers should be removed before changing category |
382 // memberships, just in case. | 382 // memberships, just in case. |
383 Services.obs.removeObserver(this, "http-on-modify-request"); | 383 Services.obs.removeObserver(this, "http-on-modify-request"); |
384 Services.obs.removeObserver(this, "content-document-global-created"); | 384 Services.obs.removeObserver(this, "content-document-global-created"); |
385 Services.obs.removeObserver(this, "xpcom-category-entry-removed", true); | 385 Services.obs.removeObserver(this, "xpcom-category-entry-removed"); |
Thomas Greiner
2013/02/07 16:16:27
removeObserver doesn't require a third parameter
h
| |
386 Services.obs.removeObserver(this, "xpcom-category-cleared", true); | 386 Services.obs.removeObserver(this, "xpcom-category-cleared"); |
Thomas Greiner
2013/02/07 16:16:27
removeObserver doesn't require a third parameter
h
| |
387 | 387 |
388 for each (let category in this.xpcom_categories) | 388 for each (let category in this.xpcom_categories) |
389 catMan.deleteCategoryEntry(category, this.contractID, false); | 389 catMan.deleteCategoryEntry(category, this.contractID, false); |
390 | 390 |
391 // This needs to run asynchronously, see bug 753687 | 391 // This needs to run asynchronously, see bug 753687 |
392 Utils.runAsync(function() | 392 Utils.runAsync(function() |
393 { | 393 { |
394 registrar.unregisterFactory(this.classID, this); | 394 registrar.unregisterFactory(this.classID, this); |
395 }.bind(this)); | 395 }.bind(this)); |
396 | 396 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 if (wnd && wnd.opener && wnd.location.href == "about:blank") | 499 if (wnd && wnd.opener && wnd.location.href == "about:blank") |
500 this.observe(wnd, "content-document-global-created", null, subject.U RI); | 500 this.observe(wnd, "content-document-global-created", null, subject.U RI); |
501 } | 501 } |
502 | 502 |
503 break; | 503 break; |
504 } | 504 } |
505 case "xpcom-category-entry-removed": | 505 case "xpcom-category-entry-removed": |
506 case "xpcom-category-cleared": | 506 case "xpcom-category-cleared": |
507 { | 507 { |
508 let category = data; | 508 let category = data; |
509 if (!this.xpcom_categories.some(function(c) c == category)) | 509 if (this.xpcom_categories.indexOf(category) < 0) |
Thomas Greiner
2013/02/07 16:16:27
this.xpcom_categories.indexOf(category) == -1
shou
| |
510 return; | 510 return; |
511 | 511 |
512 if (topic == "xpcom-category-entry-removed" && subject instanceof Ci.nsI SupportsCString) | 512 if (topic == "xpcom-category-entry-removed" && |
513 if (subject.data != this.contractID) | 513 subject instanceof Ci.nsISupportsCString && |
Thomas Greiner
2013/02/07 16:16:27
Why did you split this up into two if-statements?
Thomas Greiner
2013/02/07 16:16:27
You are already checking for the topic with the sw
Wladimir Palant
2013/02/08 07:52:31
Yes, this is possible of course. However, fallthro
| |
514 return; | 514 subject.data != this.contractID) |
515 { | |
516 return; | |
517 } | |
515 | 518 |
516 // Our category entry was removed, make sure to add it back | 519 // Our category entry was removed, make sure to add it back |
517 let catMan = Utils.categoryManager; | 520 let catMan = Utils.categoryManager; |
518 catMan.addCategoryEntry(category, this.contractID, this.contractID, fals e, true); | 521 catMan.addCategoryEntry(category, this.contractID, this.contractID, fals e, true); |
519 break; | 522 break; |
520 } | 523 } |
521 } | 524 } |
522 }, | 525 }, |
523 | 526 |
524 // | 527 // |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
735 if (!wnd || wnd.closed) | 738 if (!wnd || wnd.closed) |
736 return; | 739 return; |
737 | 740 |
738 if (entry.type == Policy.type.OBJECT) | 741 if (entry.type == Policy.type.OBJECT) |
739 { | 742 { |
740 node.removeEventListener("mouseover", objectMouseEventHander, true); | 743 node.removeEventListener("mouseover", objectMouseEventHander, true); |
741 node.removeEventListener("mouseout", objectMouseEventHander, true); | 744 node.removeEventListener("mouseout", objectMouseEventHander, true); |
742 } | 745 } |
743 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; | 746 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; |
744 } | 747 } |
LEFT | RIGHT |