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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 17 matching lines...) Expand all Loading... |
28 PageMap.prototype = { | 28 PageMap.prototype = { |
29 _delete: function(id) | 29 _delete: function(id) |
30 { | 30 { |
31 delete this._map[id]; | 31 delete this._map[id]; |
32 | 32 |
33 if (Object.keys(this._map).length == 0) | 33 if (Object.keys(this._map).length == 0) |
34 delete nonEmptyPageMaps[this._id]; | 34 delete nonEmptyPageMaps[this._id]; |
35 }, | 35 }, |
36 keys: function() | 36 keys: function() |
37 { | 37 { |
38 return Object.keys(this._map).map(ext._getPage); | 38 return Object.keys(this._map).map(ext.getPage); |
39 }, | 39 }, |
40 get: function(page) | 40 get: function(page) |
41 { | 41 { |
42 return this._map[page._id]; | 42 return this._map[page.id]; |
43 }, | 43 }, |
44 set: function(page, value) | 44 set: function(page, value) |
45 { | 45 { |
46 this._map[page._id] = value; | 46 this._map[page.id] = value; |
47 nonEmptyPageMaps[this._id] = this; | 47 nonEmptyPageMaps[this._id] = this; |
48 }, | 48 }, |
49 has: function(page) | 49 has: function(page) |
50 { | 50 { |
51 return page._id in this._map; | 51 return page.id in this._map; |
52 }, | 52 }, |
53 clear: function() | 53 clear: function() |
54 { | 54 { |
55 for (var id in this._map) | 55 for (var id in this._map) |
56 this._delete(id); | 56 this._delete(id); |
57 }, | 57 }, |
58 delete: function(page) | 58 delete: function(page) |
59 { | 59 { |
60 this._delete(page._id); | 60 this._delete(page.id); |
61 } | 61 } |
62 }; | 62 }; |
63 | 63 |
64 ext._removeFromAllPageMaps = function(pageId) | 64 ext._removeFromAllPageMaps = function(pageId) |
65 { | 65 { |
66 for (var pageMapId in nonEmptyPageMaps) | 66 for (var pageMapId in nonEmptyPageMaps) |
67 nonEmptyPageMaps[pageMapId]._delete(pageId); | 67 nonEmptyPageMaps[pageMapId]._delete(pageId); |
68 }; | 68 }; |
69 })(); | 69 })(); |
OLD | NEW |