| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. Any additional parameters to this function are passed |
| 217 * as parameters to the callback. | 217 * as parameters to the callback. |
| 218 * @param {function} callback |
| 219 * @param {object} thisPtr |
| 218 */ | 220 */ |
| 219 runAsync: function(/**Function*/ callback, /**Object*/ thisPtr) | 221 runAsync: function(callback, thisPtr) |
| 220 { | 222 { |
| 221 let params = Array.prototype.slice.call(arguments, 2); | 223 let params = Array.prototype.slice.call(arguments, 2); |
| 222 let runnable = { | 224 let runnable = { |
| 223 run: function() | 225 run: function() |
| 224 { | 226 { |
| 225 callback.apply(thisPtr, params); | 227 callback.apply(thisPtr, params); |
| 226 } | 228 } |
| 227 }; | 229 }; |
| 228 Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORM
AL); | 230 Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORM
AL); |
| 229 }, | 231 }, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 */ | 395 */ |
| 394 getParams: function() | 396 getParams: function() |
| 395 { | 397 { |
| 396 let ret = sidebarParams; | 398 let ret = sidebarParams; |
| 397 sidebarParams = null; | 399 sidebarParams = null; |
| 398 return ret; | 400 return ret; |
| 399 }, | 401 }, |
| 400 | 402 |
| 401 /** | 403 /** |
| 402 * Verifies RSA signature. The public key and signature should be base64-encod
ed. | 404 * Verifies RSA signature. The public key and signature should be base64-encod
ed. |
| 405 * @param {string} key |
| 406 * @param {string} signature |
| 407 * @param {string} data |
| 408 * @return {boolean} |
| 403 */ | 409 */ |
| 404 verifySignature: function(/**String*/ key, /**String*/ signature, /**String*/
data) /**Boolean*/ | 410 verifySignature: function(key, signature, data) |
| 405 { | 411 { |
| 406 if (!Utils.crypto) | 412 if (!Utils.crypto) |
| 407 return false; | 413 return false; |
| 408 | 414 |
| 409 // Maybe we did the same check recently, look it up in the cache | 415 // Maybe we did the same check recently, look it up in the cache |
| 410 if (!("_cache" in Utils.verifySignature)) | 416 if (!("_cache" in Utils.verifySignature)) |
| 411 Utils.verifySignature._cache = new Cache(5); | 417 Utils.verifySignature._cache = new Cache(5); |
| 412 let cache = Utils.verifySignature._cache; | 418 let cache = Utils.verifySignature._cache; |
| 413 let cacheKey = key + " " + signature + " " + data; | 419 let cacheKey = key + " " + signature + " " + data; |
| 414 if (cacheKey in cache.data) | 420 if (cacheKey in cache.data) |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 Cu.reportError(e); | 789 Cu.reportError(e); |
| 784 // Expected, ctypes isn't supported in Gecko 1.9.2 | 790 // Expected, ctypes isn't supported in Gecko 1.9.2 |
| 785 return null; | 791 return null; |
| 786 } | 792 } |
| 787 }); | 793 }); |
| 788 | 794 |
| 789 if ("@mozilla.org/messenger/headerparser;1" in Cc) | 795 if ("@mozilla.org/messenger/headerparser;1" in Cc) |
| 790 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
ger/headerparser;1", "nsIMsgHeaderParser"); | 796 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
ger/headerparser;1", "nsIMsgHeaderParser"); |
| 791 else | 797 else |
| 792 Utils.headerParser = null; | 798 Utils.headerParser = null; |
| OLD | NEW |