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

Delta Between Two Patch Sets: test/_common.js

Issue 29760704: Issue 6592 - Implement $rewrite filter option (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created April 24, 2018, 8:31 p.m.
Right Patch Set: Just inject URL into the sandbox globals. Created May 17, 2018, 12:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
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 13 matching lines...) Expand all
24 const Cr = exports.Cr = { 24 const Cr = exports.Cr = {
25 NS_OK: 0, 25 NS_OK: 0,
26 NS_BINDING_ABORTED: 0x804B0002, 26 NS_BINDING_ABORTED: 0x804B0002,
27 NS_ERROR_FAILURE: 0x80004005 27 NS_ERROR_FAILURE: 0x80004005
28 }; 28 };
29 29
30 const MILLIS_IN_SECOND = exports.MILLIS_IN_SECOND = 1000; 30 const MILLIS_IN_SECOND = exports.MILLIS_IN_SECOND = 1000;
31 const MILLIS_IN_MINUTE = exports.MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND; 31 const MILLIS_IN_MINUTE = exports.MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND;
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)
35 {
36 return require("url").parse(urlString);
37 }
38
39 let Services = { 34 let Services = {
40 obs: { 35 obs: {
41 addObserver() {} 36 addObserver() {}
42 } 37 }
43 }; 38 };
44 let XPCOMUtils = { 39 let XPCOMUtils = {
45 generateQI() {} 40 generateQI() {}
46 }; 41 };
47 let FileUtils = {}; 42 let FileUtils = {};
48 let resources = {Services, XPCOMUtils, FileUtils}; 43 let resources = {Services, XPCOMUtils, FileUtils};
(...skipping 19 matching lines...) Expand all
68 }, 63 },
69 console: { 64 console: {
70 log() {}, 65 log() {},
71 error() {} 66 error() {}
72 }, 67 },
73 navigator: { 68 navigator: {
74 }, 69 },
75 onShutdown: { 70 onShutdown: {
76 add() {} 71 add() {}
77 }, 72 },
78 URL 73 // URL is global in Node 10. In Node 7+ it must be imported.
74 URL: typeof URL == "undefined" ? require("url").URL : URL
79 }; 75 };
80 76
81 let knownModules = new Map(); 77 let knownModules = new Map();
82 for (let dir of [path.join(__dirname, "stub-modules"), 78 for (let dir of [path.join(__dirname, "stub-modules"),
83 path.join(__dirname, "..", "lib")]) 79 path.join(__dirname, "..", "lib")])
84 { 80 {
85 for (let file of fs.readdirSync(path.resolve(dir))) 81 for (let file of fs.readdirSync(path.resolve(dir)))
86 { 82 {
87 if (path.extname(file) == ".js") 83 if (path.extname(file) == ".js")
88 knownModules[path.basename(file, ".js")] = path.resolve(dir, file); 84 knownModules[path.basename(file, ".js")] = path.resolve(dir, file);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 405 }
410 }) 406 })
411 }; 407 };
412 }; 408 };
413 409
414 exports.unexpectedError = function(error) 410 exports.unexpectedError = function(error)
415 { 411 {
416 console.error(error); 412 console.error(error);
417 this.ok(false, "Unexpected error: " + error); 413 this.ok(false, "Unexpected error: " + error);
418 }; 414 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld