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

Delta Between Two Patch Sets: ext/background.js

Issue 5056848617013248: Issue 1706 - Move first-run page to adblockplusui repository (Closed)
Left Patch Set: Created Jan. 6, 2015, 10:39 p.m.
Right Patch Set: Export variables differently in common.js Created Jan. 7, 2015, 6:58 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/skin/social/weibo.png ('k') | ext/common.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", null); 18 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", null);
19 let {Services} = Cu.import("resource://gre/modules/Services.jsm", null); 19 let {Services} = Cu.import("resource://gre/modules/Services.jsm", null);
20 let {MessageProxy, EventTarget, getSender} = require("ext_common"); 20 let {
21 _MessageProxy: MessageProxy,
22 _EventTarget: EventTarget,
23 _getSender: getSender
24 } = require("ext_common");
21 exports.onMessage = new EventTarget(); 25 exports.onMessage = new EventTarget();
22 26
23 let messageProxy = new MessageProxy( 27 let messageProxy = new MessageProxy(
24 Cc["@mozilla.org/globalmessagemanager;1"] 28 Cc["@mozilla.org/globalmessagemanager;1"]
25 .getService(Ci.nsIMessageListenerManager), 29 .getService(Ci.nsIMessageListenerManager),
26 exports.onMessage); 30 exports.onMessage);
27 onShutdown.add(function() 31 onShutdown.add(function()
28 { 32 {
29 messageProxy._disconnect(); 33 messageProxy._disconnect();
30 }); 34 });
(...skipping 11 matching lines...) Expand all
42 }; 46 };
43 exports.Page = Page; 47 exports.Page = Page;
44 48
45 function PageMap() 49 function PageMap()
46 { 50 {
47 this._map = new Map(); 51 this._map = new Map();
48 52
49 Services.obs.addObserver(this, "message-manager-disconnect", true); 53 Services.obs.addObserver(this, "message-manager-disconnect", true);
50 onShutdown.add(function() 54 onShutdown.add(function()
51 { 55 {
52 Services.obs.removeObserver(this, "message-manager-disconnect", true); 56 Services.obs.removeObserver(this, "message-manager-disconnect");
53 }); 57 }.bind(this));
54 } 58 }
55 PageMap.prototype = { 59 PageMap.prototype = {
56 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakRefer ence]), 60 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakRefer ence]),
57 61
58 observe: function(subject, topic, data) 62 observe: function(subject, topic, data)
59 { 63 {
60 if (topic == "message-manager-disconnect") 64 if (topic == "message-manager-disconnect")
61 this._map.delete(subject); 65 this._map.delete(subject);
62 }, 66 },
63 67
(...skipping 20 matching lines...) Expand all
84 { 88 {
85 return this._map.has(page._sender); 89 return this._map.has(page._sender);
86 }, 90 },
87 91
88 delete: function(page) 92 delete: function(page)
89 { 93 {
90 this._map.delete(page._sender); 94 this._map.delete(page._sender);
91 } 95 }
92 }; 96 };
93 exports.PageMap = PageMap; 97 exports.PageMap = PageMap;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld