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 11 matching lines...) Expand all Loading... |
22 Cu.import("resource://gre/modules/Services.jsm"); | 22 Cu.import("resource://gre/modules/Services.jsm"); |
23 | 23 |
24 let {Utils} = require("utils"); | 24 let {Utils} = require("utils"); |
25 let {BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter, ElemHideExce
ption} = require("filterClasses"); | 25 let {BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter, ElemHideExce
ption} = require("filterClasses"); |
26 | 26 |
27 let nodeData = new WeakMap(); | 27 let nodeData = new WeakMap(); |
28 let windowStats = new WeakMap(); | 28 let windowStats = new WeakMap(); |
29 let windowSelection = new WeakMap(); | 29 let windowSelection = new WeakMap(); |
30 | 30 |
31 let setEntry, hasEntry, getEntry; | 31 let setEntry, hasEntry, getEntry; |
32 if (false) | 32 // Last issue(Bug 982561) preventing us from using WeakMap fixed for FF version
32 |
| 33 if (Services.vc.compare(Utils.platformVersion, "32.0a1") >= 0) |
33 { | 34 { |
34 // This branch can be enabled again once all of bug 673468, bug 819131 and | |
35 // bug 982561 are fixed and we can use weak maps. | |
36 setEntry = function(map, key, value) map.set(key, value); | 35 setEntry = function(map, key, value) map.set(key, value); |
37 hasEntry = function(map, key) map.has(key); | 36 hasEntry = function(map, key) map.has(key); |
38 getEntry = function(map, key) map.get(key); | 37 getEntry = function(map, key) map.get(key); |
39 } | 38 } |
40 else | 39 else |
41 { | 40 { |
42 // Fall back to user data | 41 // Fall back to user data |
43 let dataSeed = Math.random(); | 42 let dataSeed = Math.random(); |
44 let nodeDataProp = "abpNodeData" + dataSeed; | 43 let nodeDataProp = "abpNodeData" + dataSeed; |
45 let windowStatsProp = "abpWindowStats" + dataSeed; | 44 let windowStatsProp = "abpWindowStats" + dataSeed; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 if (typeof existingData == "undefined") | 363 if (typeof existingData == "undefined") |
365 { | 364 { |
366 existingData = {}; | 365 existingData = {}; |
367 setEntry(nodeData, node, existingData); | 366 setEntry(nodeData, node, existingData); |
368 } | 367 } |
369 | 368 |
370 // Add this request to the node data | 369 // Add this request to the node data |
371 existingData[this.type + " " + this.location] = this; | 370 existingData[this.type + " " + this.location] = this; |
372 } | 371 } |
373 }; | 372 }; |
OLD | NEW |