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

Side by Side Diff: lib/child/cssProperties.js

Issue 29338928: Issue 3853 - Use new messaging API for the first-run page (Closed)
Patch Set: Addressed comments Created April 19, 2016, 11:56 a.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 | « ext/content.js ('k') | lib/cssProperties.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 11 matching lines...) Expand all
22 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 22 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
23 23
24 let {port} = require("messaging"); 24 let {port} = require("messaging");
25 let {getFrames} = require("child/utils"); 25 let {getFrames} = require("child/utils");
26 26
27 let senderWindow = null; 27 let senderWindow = null;
28 28
29 let scope = { 29 let scope = {
30 ext: { 30 ext: {
31 backgroundPage: { 31 backgroundPage: {
32 sendMessage: function(data, callback) 32 sendMessage: function(payload, callback)
33 { 33 {
34 data = {payload: data, frames: getFrames(senderWindow)}; 34 let message = {payload, frames: getFrames(senderWindow)};
35 if (typeof callback == "function") 35 if (typeof callback == "function")
36 port.emitWithResponse("cssPropertiesRequest", data).then(callback); 36 port.emitWithResponse("ext_message", message).then(callback);
37 else 37 else
38 port.emit("cssPropertiesRequest", data); 38 port.emit("ext_message", message);
39 } 39 }
40 } 40 }
41 } 41 }
42 }; 42 };
43 43
44 function addUserCSS(window, cssCode) 44 function addUserCSS(window, cssCode)
45 { 45 {
46 let uri = Services.io.newURI("data:text/css," + encodeURIComponent(cssCode), 46 let uri = Services.io.newURI("data:text/css," + encodeURIComponent(cssCode),
47 null, null); 47 null, null);
48 let utils = window.QueryInterface(Ci.nsIInterfaceRequestor) 48 let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 false); 88 false);
89 onShutdown.add(() => 89 onShutdown.add(() =>
90 { 90 {
91 Services.obs.removeObserver(onContentWindow, 91 Services.obs.removeObserver(onContentWindow,
92 "content-document-global-created"); 92 "content-document-global-created");
93 }); 93 });
94 } 94 }
95 95
96 initCSSPropertyFilters(); 96 initCSSPropertyFilters();
97 })(); 97 })();
OLDNEW
« no previous file with comments | « ext/content.js ('k') | lib/cssProperties.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld