OLD | NEW |
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 catMan.addCategoryEntry(category, this.contractID, this.contractID, false,
true); | 403 catMan.addCategoryEntry(category, this.contractID, this.contractID, false,
true); |
404 | 404 |
405 // http-on-opening-request is new in Gecko 18, http-on-modify-request can | 405 // http-on-opening-request is new in Gecko 18, http-on-modify-request can |
406 // be used in earlier releases. | 406 // be used in earlier releases. |
407 let httpTopic = "http-on-opening-request"; | 407 let httpTopic = "http-on-opening-request"; |
408 if (Services.vc.compare(Utils.platformVersion, "18.0") < 0) | 408 if (Services.vc.compare(Utils.platformVersion, "18.0") < 0) |
409 httpTopic = "http-on-modify-request"; | 409 httpTopic = "http-on-modify-request"; |
410 | 410 |
411 Services.obs.addObserver(this, httpTopic, true); | 411 Services.obs.addObserver(this, httpTopic, true); |
412 Services.obs.addObserver(this, "content-document-global-created", true); | 412 Services.obs.addObserver(this, "content-document-global-created", true); |
413 Services.obs.addObserver(this, "xpcom-category-entry-removed", true); | |
414 Services.obs.addObserver(this, "xpcom-category-cleared", true); | |
415 | 413 |
416 onShutdown.add(function() | 414 onShutdown.add(function() |
417 { | 415 { |
418 // Our category observers should be removed before changing category | 416 // Our category observers should be removed before changing category |
419 // memberships, just in case. | 417 // memberships, just in case. |
420 Services.obs.removeObserver(this, httpTopic); | 418 Services.obs.removeObserver(this, httpTopic); |
421 Services.obs.removeObserver(this, "content-document-global-created"); | 419 Services.obs.removeObserver(this, "content-document-global-created"); |
422 Services.obs.removeObserver(this, "xpcom-category-entry-removed"); | |
423 Services.obs.removeObserver(this, "xpcom-category-cleared"); | |
424 | 420 |
425 for (let category of this.xpcom_categories) | 421 for (let category of this.xpcom_categories) |
426 catMan.deleteCategoryEntry(category, this.contractID, false); | 422 catMan.deleteCategoryEntry(category, this.contractID, false); |
427 | 423 |
428 // This needs to run asynchronously, see bug 753687 | 424 // This needs to run asynchronously, see bug 753687 |
429 Utils.runAsync(function() | 425 Utils.runAsync(function() |
430 { | 426 { |
431 registrar.unregisterFactory(this.classID, this); | 427 registrar.unregisterFactory(this.classID, this); |
432 }.bind(this)); | 428 }.bind(this)); |
433 | 429 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 if (wnd && wnd.opener && wnd.location.href == "about:blank") | 533 if (wnd && wnd.opener && wnd.location.href == "about:blank") |
538 { | 534 { |
539 this.observe(wnd, "content-document-global-created", null, subject.U
RI); | 535 this.observe(wnd, "content-document-global-created", null, subject.U
RI); |
540 if (subject instanceof Ci.nsIWritablePropertyBag) | 536 if (subject instanceof Ci.nsIWritablePropertyBag) |
541 subject.setProperty("abpRequestType", Policy.type.POPUP); | 537 subject.setProperty("abpRequestType", Policy.type.POPUP); |
542 } | 538 } |
543 } | 539 } |
544 | 540 |
545 break; | 541 break; |
546 } | 542 } |
547 case "xpcom-category-entry-removed": | |
548 case "xpcom-category-cleared": | |
549 { | |
550 let category = data; | |
551 if (this.xpcom_categories.indexOf(category) < 0) | |
552 return; | |
553 | |
554 if (topic == "xpcom-category-entry-removed" && | |
555 subject instanceof Ci.nsISupportsCString && | |
556 subject.data != this.contractID) | |
557 { | |
558 return; | |
559 } | |
560 | |
561 // Our category entry was removed, make sure to add it back | |
562 let catMan = Utils.categoryManager; | |
563 catMan.addCategoryEntry(category, this.contractID, this.contractID, fals
e, true); | |
564 break; | |
565 } | |
566 } | 543 } |
567 }, | 544 }, |
568 | 545 |
569 // | 546 // |
570 // nsIChannelEventSink interface implementation | 547 // nsIChannelEventSink interface implementation |
571 // | 548 // |
572 | 549 |
573 asyncOnChannelRedirect: function(oldChannel, newChannel, flags, callback) | 550 asyncOnChannelRedirect: function(oldChannel, newChannel, flags, callback) |
574 { | 551 { |
575 let result = Cr.NS_OK; | 552 let result = Cr.NS_OK; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 if (!wnd || wnd.closed) | 804 if (!wnd || wnd.closed) |
828 return; | 805 return; |
829 | 806 |
830 if (entry.type == Policy.type.OBJECT) | 807 if (entry.type == Policy.type.OBJECT) |
831 { | 808 { |
832 node.removeEventListener("mouseover", objectMouseEventHander, true); | 809 node.removeEventListener("mouseover", objectMouseEventHander, true); |
833 node.removeEventListener("mouseout", objectMouseEventHander, true); | 810 node.removeEventListener("mouseout", objectMouseEventHander, true); |
834 } | 811 } |
835 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; | 812 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; |
836 } | 813 } |
OLD | NEW |