Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: ext/background.js

Issue 29336084: Issue 2426 - Open block.html as a popup window (Closed)
Patch Set: Reduce callback checking boilerplate Created Feb. 15, 2016, 3:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/ext/background.js ('k') | include.postload.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 })();
OLDNEW
« no previous file with comments | « chrome/ext/background.js ('k') | include.postload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld