OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 }; | 532 }; |
533 | 533 |
534 /** | 534 /** |
535 * A cache with a fixed capacity, newer entries replace entries that have been | 535 * A cache with a fixed capacity, newer entries replace entries that have been |
536 * stored first. | 536 * stored first. |
537 * @constructor | 537 * @constructor |
538 */ | 538 */ |
539 function Cache(/**Integer*/ size) | 539 function Cache(/**Integer*/ size) |
540 { | 540 { |
541 this._ringBuffer = new Array(size); | 541 this._ringBuffer = new Array(size); |
542 this.data = {__proto__: null}; | 542 this.data = Object.create(null); |
543 } | 543 } |
544 exports.Cache = Cache; | 544 exports.Cache = Cache; |
545 | 545 |
546 Cache.prototype = | 546 Cache.prototype = |
547 { | 547 { |
548 /** | 548 /** |
549 * Ring buffer storing hash keys, allows determining which keys need to be | 549 * Ring buffer storing hash keys, allows determining which keys need to be |
550 * evicted. | 550 * evicted. |
551 * @type Array | 551 * @type Array |
552 */ | 552 */ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 this.data[key] = value; | 587 this.data[key] = value; |
588 }, | 588 }, |
589 | 589 |
590 /** | 590 /** |
591 * Clears cache contents. | 591 * Clears cache contents. |
592 */ | 592 */ |
593 clear: function() | 593 clear: function() |
594 { | 594 { |
595 this._ringBuffer = new Array(this._ringBuffer.length); | 595 this._ringBuffer = new Array(this._ringBuffer.length); |
596 this.data = {__proto__: null}; | 596 this.data = Object.create(null); |
597 } | 597 } |
598 } | 598 } |
599 | 599 |
600 // Getters for common services, this should be replaced by Services.jsm in futur
e | 600 // Getters for common services, this should be replaced by Services.jsm in futur
e |
601 | 601 |
602 XPCOMUtils.defineLazyServiceGetter(Utils, "categoryManager", "@mozilla.org/categ
orymanager;1", "nsICategoryManager"); | 602 XPCOMUtils.defineLazyServiceGetter(Utils, "categoryManager", "@mozilla.org/categ
orymanager;1", "nsICategoryManager"); |
603 XPCOMUtils.defineLazyServiceGetter(Utils, "ioService", "@mozilla.org/network/io-
service;1", "nsIIOService"); | 603 XPCOMUtils.defineLazyServiceGetter(Utils, "ioService", "@mozilla.org/network/io-
service;1", "nsIIOService"); |
604 XPCOMUtils.defineLazyServiceGetter(Utils, "promptService", "@mozilla.org/embedco
mp/prompt-service;1", "nsIPromptService"); | 604 XPCOMUtils.defineLazyServiceGetter(Utils, "promptService", "@mozilla.org/embedco
mp/prompt-service;1", "nsIPromptService"); |
605 XPCOMUtils.defineLazyServiceGetter(Utils, "effectiveTLD", "@mozilla.org/network/
effective-tld-service;1", "nsIEffectiveTLDService"); | 605 XPCOMUtils.defineLazyServiceGetter(Utils, "effectiveTLD", "@mozilla.org/network/
effective-tld-service;1", "nsIEffectiveTLDService"); |
606 XPCOMUtils.defineLazyServiceGetter(Utils, "netUtils", "@mozilla.org/network/util
;1", "nsINetUtil"); | 606 XPCOMUtils.defineLazyServiceGetter(Utils, "netUtils", "@mozilla.org/network/util
;1", "nsINetUtil"); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 Cu.reportError(e); | 778 Cu.reportError(e); |
779 // Expected, ctypes isn't supported in Gecko 1.9.2 | 779 // Expected, ctypes isn't supported in Gecko 1.9.2 |
780 return null; | 780 return null; |
781 } | 781 } |
782 }); | 782 }); |
783 | 783 |
784 if ("@mozilla.org/messenger/headerparser;1" in Cc) | 784 if ("@mozilla.org/messenger/headerparser;1" in Cc) |
785 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
ger/headerparser;1", "nsIMsgHeaderParser"); | 785 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
ger/headerparser;1", "nsIMsgHeaderParser"); |
786 else | 786 else |
787 Utils.headerParser = null; | 787 Utils.headerParser = null; |
OLD | NEW |