| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 21 matching lines...) Expand all Loading... |
| 32 const MILLIS_IN_HOUR = exports.MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; | 32 const MILLIS_IN_HOUR = exports.MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; |
| 33 | 33 |
| 34 function URL(urlString) | 34 function URL(urlString) |
| 35 { | 35 { |
| 36 return require("url").parse(urlString); | 36 return require("url").parse(urlString); |
| 37 } | 37 } |
| 38 | 38 |
| 39 let Services = { | 39 let Services = { |
| 40 obs: { | 40 obs: { |
| 41 addObserver() {} | 41 addObserver() {} |
| 42 }, | |
| 43 vc: { | |
| 44 compare(v1, v2) | |
| 45 { | |
| 46 function comparePart(p1, p2) | |
| 47 { | |
| 48 if (p1 != "*" && p2 == "*") | |
| 49 return -1; | |
| 50 else if (p1 == "*" && p2 != "*") | |
| 51 return 1; | |
| 52 else if (p1 == p2) | |
| 53 return 0; | |
| 54 return parseInt(p1, 10) - parseInt(p2, 10); | |
| 55 } | |
| 56 | |
| 57 let parts1 = v1.split("."); | |
| 58 let parts2 = v2.split("."); | |
| 59 for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) | |
| 60 { | |
| 61 let result = comparePart(parts1[i] || "0", parts2[i] || "0"); | |
| 62 if (result != 0) | |
| 63 return result; | |
| 64 } | |
| 65 return 0; | |
| 66 } | |
| 67 } | 42 } |
| 68 }; | 43 }; |
| 69 let XPCOMUtils = { | 44 let XPCOMUtils = { |
| 70 generateQI() {} | 45 generateQI() {} |
| 71 }; | 46 }; |
| 72 let FileUtils = {}; | 47 let FileUtils = {}; |
| 73 let resources = {Services, XPCOMUtils, FileUtils}; | 48 let resources = {Services, XPCOMUtils, FileUtils}; |
| 74 | 49 |
| 75 let globals = { | 50 let globals = { |
| 76 atob: data => new Buffer(data, "base64").toString("binary"), | 51 atob: data => new Buffer(data, "base64").toString("binary"), |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 409 } |
| 435 }) | 410 }) |
| 436 }; | 411 }; |
| 437 }; | 412 }; |
| 438 | 413 |
| 439 exports.unexpectedError = function(error) | 414 exports.unexpectedError = function(error) |
| 440 { | 415 { |
| 441 console.error(error); | 416 console.error(error); |
| 442 this.ok(false, "Unexpected error: " + error); | 417 this.ok(false, "Unexpected error: " + error); |
| 443 }; | 418 }; |
| OLD | NEW |