OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 hasEntry = function(map, key) map.has(key); | 36 hasEntry = function(map, key) map.has(key); |
37 getEntry = function(map, key) map.get(key); | 37 getEntry = function(map, key) map.get(key); |
38 } | 38 } |
39 else | 39 else |
40 { | 40 { |
41 // Fall back to user data | 41 // Fall back to user data |
42 let dataSeed = Math.random(); | 42 let dataSeed = Math.random(); |
43 let nodeDataProp = "abpNodeData" + dataSeed; | 43 let nodeDataProp = "abpNodeData" + dataSeed; |
44 let windowStatsProp = "abpWindowStats" + dataSeed; | 44 let windowStatsProp = "abpWindowStats" + dataSeed; |
45 let windowSelectionProp = "abpWindowSelection" + dataSeed; | 45 let windowSelectionProp = "abpWindowSelection" + dataSeed; |
46 function getProp(map) | 46 let getProp = function(map) |
47 { | 47 { |
48 switch (map) | 48 switch (map) |
49 { | 49 { |
50 case nodeData: | 50 case nodeData: |
51 return nodeDataProp; | 51 return nodeDataProp; |
52 case windowStats: | 52 case windowStats: |
53 return windowStatsProp; | 53 return windowStatsProp; |
54 case windowSelection: | 54 case windowSelection: |
55 return windowSelectionProp; | 55 return windowSelectionProp; |
56 default: | 56 default: |
57 return null; | 57 return null; |
58 } | 58 } |
59 } | 59 }; |
60 | 60 |
61 setEntry = function(map, key, value) key.setUserData(getProp(map), value, null
); | 61 setEntry = function(map, key, value) key.setUserData(getProp(map), value, null
); |
62 hasEntry = function(map, key) key.getUserData(getProp(map)); | 62 hasEntry = function(map, key) key.getUserData(getProp(map)); |
63 getEntry = function(map, key) key.getUserData(getProp(map)) || undefined; | 63 getEntry = function(map, key) key.getUserData(getProp(map)) || undefined; |
64 } | 64 } |
65 | 65 |
66 /** | 66 /** |
67 * List of notifiers in use - these notifiers need to receive notifications on | 67 * List of notifiers in use - these notifiers need to receive notifications on |
68 * new requests. | 68 * new requests. |
69 * @type RequestNotifier[] | 69 * @type RequestNotifier[] |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 if (typeof existingData == "undefined") | 374 if (typeof existingData == "undefined") |
375 { | 375 { |
376 existingData = {}; | 376 existingData = {}; |
377 setEntry(nodeData, node, existingData); | 377 setEntry(nodeData, node, existingData); |
378 } | 378 } |
379 | 379 |
380 // Add this request to the node data | 380 // Add this request to the node data |
381 existingData[this.type + " " + this.location] = this; | 381 existingData[this.type + " " + this.location] = this; |
382 } | 382 } |
383 }; | 383 }; |
OLD | NEW |