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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 exports.setupRandomResult = function() | 422 exports.setupRandomResult = function() |
423 { | 423 { |
424 let randomResult = 0.5; | 424 let randomResult = 0.5; |
425 Object.defineProperty(this, "randomResult", { | 425 Object.defineProperty(this, "randomResult", { |
426 get: () => randomResult, | 426 get: () => randomResult, |
427 set: value => randomResult = value | 427 set: value => randomResult = value |
428 }); | 428 }); |
429 | 429 |
430 return { | 430 return { |
431 Math: { | 431 Math: Object.create(Math, { |
432 random: () => randomResult, | 432 random: { |
433 min: Math.min, | 433 value: () => randomResult |
434 max: Math.max, | 434 } |
435 round: Math.round | 435 }) |
436 } | |
437 }; | 436 }; |
438 }; | 437 }; |
439 | 438 |
440 exports.unexpectedError = function(error) | 439 exports.unexpectedError = function(error) |
441 { | 440 { |
442 console.error(error); | 441 console.error(error); |
443 this.ok(false, "Unexpected error: " + error); | 442 this.ok(false, "Unexpected error: " + error); |
444 }; | 443 }; |
OLD | NEW |