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 13 matching lines...) Expand all Loading... | |
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 if (false) |
33 { | 33 { |
34 // Bug 673468 and bug 819131 are fixed, we can use weak maps | 34 // This branch can be enabled again once both bug 673468 and bug 819131 are |
Felix Dahlke
2013/01/23 14:15:28
Shouldn't this be: "Bug 673468 is fixed, but 81913
| |
35 // fixed and we can use weak maps | |
35 setEntry = function(map, key, value) map.set(key, value); | 36 setEntry = function(map, key, value) map.set(key, value); |
36 hasEntry = function(map, key) map.has(key); | 37 hasEntry = function(map, key) map.has(key); |
37 getEntry = function(map, key) map.get(key); | 38 getEntry = function(map, key) map.get(key); |
38 } | 39 } |
39 else | 40 else |
40 { | 41 { |
41 // Fall back to user data | 42 // Fall back to user data |
42 let dataSeed = Math.random(); | 43 let dataSeed = Math.random(); |
43 let nodeDataProp = "abpNodeData" + dataSeed; | 44 let nodeDataProp = "abpNodeData" + dataSeed; |
44 let windowStatsProp = "abpWindowStats" + dataSeed; | 45 let windowStatsProp = "abpWindowStats" + dataSeed; |
45 let windowSelectionProp = "abpWindowSelection" + dataSeed; | 46 let windowSelectionProp = "abpWindowSelection" + dataSeed; |
46 function getProp(map) | 47 let getProp = function(map) |
Wladimir Palant
2013/01/23 14:48:33
Please ignore this change, it's from a different c
| |
47 { | 48 { |
48 switch (map) | 49 switch (map) |
49 { | 50 { |
50 case nodeData: | 51 case nodeData: |
51 return nodeDataProp; | 52 return nodeDataProp; |
52 case windowStats: | 53 case windowStats: |
53 return windowStatsProp; | 54 return windowStatsProp; |
54 case windowSelection: | 55 case windowSelection: |
55 return windowSelectionProp; | 56 return windowSelectionProp; |
56 default: | 57 default: |
57 return null; | 58 return null; |
58 } | 59 } |
59 } | 60 }; |
60 | 61 |
61 setEntry = function(map, key, value) key.setUserData(getProp(map), value, null ); | 62 setEntry = function(map, key, value) key.setUserData(getProp(map), value, null ); |
62 hasEntry = function(map, key) key.getUserData(getProp(map)); | 63 hasEntry = function(map, key) key.getUserData(getProp(map)); |
63 getEntry = function(map, key) key.getUserData(getProp(map)) || undefined; | 64 getEntry = function(map, key) key.getUserData(getProp(map)) || undefined; |
64 } | 65 } |
65 | 66 |
66 /** | 67 /** |
67 * List of notifiers in use - these notifiers need to receive notifications on | 68 * List of notifiers in use - these notifiers need to receive notifications on |
68 * new requests. | 69 * new requests. |
69 * @type RequestNotifier[] | 70 * @type RequestNotifier[] |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 if (typeof existingData == "undefined") | 375 if (typeof existingData == "undefined") |
375 { | 376 { |
376 existingData = {}; | 377 existingData = {}; |
377 setEntry(nodeData, node, existingData); | 378 setEntry(nodeData, node, existingData); |
378 } | 379 } |
379 | 380 |
380 // Add this request to the node data | 381 // Add this request to the node data |
381 existingData[this.type + " " + this.location] = this; | 382 existingData[this.type + " " + this.location] = this; |
382 } | 383 } |
383 }; | 384 }; |
LEFT | RIGHT |