| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 { | 206 { |
| 207 return Utils.ioService.newURI(url, null, null); | 207 return Utils.ioService.newURI(url, null, null); |
| 208 } | 208 } |
| 209 catch (e) { | 209 catch (e) { |
| 210 return null; | 210 return null; |
| 211 } | 211 } |
| 212 }, | 212 }, |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * Posts an action to the event queue of the current thread to run it | 215 * Posts an action to the event queue of the current thread to run it |
| 216 * asynchronously. Any additional parameters to this function are passed | 216 * asynchronously. |
| 217 * as parameters to the callback. | |
| 218 * @param {function} callback | 217 * @param {function} callback |
| 219 * @param {object} thisPtr | |
| 220 */ | 218 */ |
| 221 runAsync: function(callback, thisPtr) | 219 runAsync: function(callback) |
| 222 { | 220 { |
| 223 let params = Array.prototype.slice.call(arguments, 2); | 221 Services.tm.currentThread.dispatch(callback, Ci.nsIEventTarget.DISPATCH_NORM
AL); |
| 224 let runnable = { | |
| 225 run: function() | |
| 226 { | |
| 227 callback.apply(thisPtr, params); | |
| 228 } | |
| 229 }; | |
| 230 Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORM
AL); | |
| 231 }, | 222 }, |
| 232 | 223 |
| 233 /** | 224 /** |
| 234 * Gets the DOM window associated with a particular request (if any). | 225 * Gets the DOM window associated with a particular request (if any). |
| 235 */ | 226 */ |
| 236 getRequestWindow: function(/**nsIChannel*/ channel) /**nsIDOMWindow*/ | 227 getRequestWindow: function(/**nsIChannel*/ channel) /**nsIDOMWindow*/ |
| 237 { | 228 { |
| 238 try | 229 try |
| 239 { | 230 { |
| 240 if (channel.notificationCallbacks) | 231 if (channel.notificationCallbacks) |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 Cu.reportError(e); | 780 Cu.reportError(e); |
| 790 // Expected, ctypes isn't supported in Gecko 1.9.2 | 781 // Expected, ctypes isn't supported in Gecko 1.9.2 |
| 791 return null; | 782 return null; |
| 792 } | 783 } |
| 793 }); | 784 }); |
| 794 | 785 |
| 795 if ("@mozilla.org/messenger/headerparser;1" in Cc) | 786 if ("@mozilla.org/messenger/headerparser;1" in Cc) |
| 796 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
ger/headerparser;1", "nsIMsgHeaderParser"); | 787 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
ger/headerparser;1", "nsIMsgHeaderParser"); |
| 797 else | 788 else |
| 798 Utils.headerParser = null; | 789 Utils.headerParser = null; |
| OLD | NEW |