Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/_common.js

Issue 29556638: Issue 5762 - Use relative require paths (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Use a path alias for the common modules. Created Jan. 3, 2018, 8:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/synchronizer.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 };
OLDNEW
« no previous file with comments | « lib/synchronizer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld