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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 }; | 106 }; |
107 } | 107 } |
108 | 108 |
109 function rewriteRequires(source) | 109 function rewriteRequires(source) |
110 { | 110 { |
111 function escapeString(str) | 111 function escapeString(str) |
112 { | 112 { |
113 return str.replace(/(["'\\])/g, "\\$1"); | 113 return str.replace(/(["'\\])/g, "\\$1"); |
114 } | 114 } |
115 | 115 |
116 return source.replace(/(\brequire\(["'])([^"']+)/g, (match, prefix, request) =
> | 116 return source.replace(/(\brequire\(["'])(abp-modules\/)?([^"']+)/g, (match, pr
efix, module, request) => |
117 { | 117 { |
118 if (request in knownModules) | 118 if (request in knownModules) |
119 return prefix + escapeString(knownModules[request]); | 119 return prefix + escapeString(knownModules[request]); |
120 return match; | 120 return match; |
121 }); | 121 }); |
122 } | 122 } |
123 | 123 |
124 exports.createSandbox = function(options) | 124 exports.createSandbox = function(options) |
125 { | 125 { |
126 if (!options) | 126 if (!options) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 }) | 410 }) |
411 }; | 411 }; |
412 }; | 412 }; |
413 | 413 |
414 exports.unexpectedError = function(error) | 414 exports.unexpectedError = function(error) |
415 { | 415 { |
416 console.error(error); | 416 console.error(error); |
417 this.ok(false, "Unexpected error: " + error); | 417 this.ok(false, "Unexpected error: " + error); |
418 }; | 418 }; |
OLD | NEW |