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

Side by Side Diff: lib/utils.js

Issue 29356087: Issue 4497 - Move Utils.getRequestWindow() into child/utils.js (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Created Oct. 6, 2016, 12:18 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 | « lib/child/utils.js ('k') | no next file » | 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 * Posts an action to the event queue of the current thread to run it 203 * Posts an action to the event queue of the current thread to run it
204 * asynchronously. 204 * asynchronously.
205 * @param {function} callback 205 * @param {function} callback
206 */ 206 */
207 runAsync: function(callback) 207 runAsync: function(callback)
208 { 208 {
209 Services.tm.currentThread.dispatch(callback, Ci.nsIEventTarget.DISPATCH_NORM AL); 209 Services.tm.currentThread.dispatch(callback, Ci.nsIEventTarget.DISPATCH_NORM AL);
210 }, 210 },
211 211
212 /** 212 /**
213 * Gets the DOM window associated with a particular request (if any).
214 */
215 getRequestWindow: function(/**nsIChannel*/ channel) /**nsIDOMWindow*/
216 {
217 try
218 {
219 if (channel.notificationCallbacks)
220 return channel.notificationCallbacks.getInterface(Ci.nsILoadContext).ass ociatedWindow;
221 } catch(e) {}
222
223 try
224 {
225 if (channel.loadGroup && channel.loadGroup.notificationCallbacks)
226 return channel.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadCo ntext).associatedWindow;
227 } catch(e) {}
228
229 return null;
230 },
231
232 /**
233 * Generates filter subscription checksum. 213 * Generates filter subscription checksum.
234 * 214 *
235 * @param {string[]} lines filter subscription lines (with checksum line remov ed) 215 * @param {string[]} lines filter subscription lines (with checksum line remov ed)
236 * @return {String} checksum or null 216 * @return {String} checksum or null
237 */ 217 */
238 generateChecksum: function(lines) 218 generateChecksum: function(lines)
239 { 219 {
240 let stream = null; 220 let stream = null;
241 try 221 try
242 { 222 {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 Cu.reportError(e); 745 Cu.reportError(e);
766 // Expected, ctypes isn't supported in Gecko 1.9.2 746 // Expected, ctypes isn't supported in Gecko 1.9.2
767 return null; 747 return null;
768 } 748 }
769 }); 749 });
770 750
771 if ("@mozilla.org/messenger/headerparser;1" in Cc) 751 if ("@mozilla.org/messenger/headerparser;1" in Cc)
772 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen ger/headerparser;1", "nsIMsgHeaderParser"); 752 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen ger/headerparser;1", "nsIMsgHeaderParser");
773 else 753 else
774 Utils.headerParser = null; 754 Utils.headerParser = null;
OLDNEW
« no previous file with comments | « lib/child/utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld