Index: test/_common.js |
=================================================================== |
--- a/test/_common.js |
+++ b/test/_common.js |
@@ -26,21 +26,16 @@ |
NS_BINDING_ABORTED: 0x804B0002, |
NS_ERROR_FAILURE: 0x80004005 |
}; |
const MILLIS_IN_SECOND = exports.MILLIS_IN_SECOND = 1000; |
const MILLIS_IN_MINUTE = exports.MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND; |
const MILLIS_IN_HOUR = exports.MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; |
-function URL(urlString) |
-{ |
- return require("url").parse(urlString); |
-} |
- |
let Services = { |
obs: { |
addObserver() {} |
} |
}; |
let XPCOMUtils = { |
generateQI() {} |
}; |
@@ -70,17 +65,18 @@ |
log() {}, |
error() {} |
}, |
navigator: { |
}, |
onShutdown: { |
add() {} |
}, |
- URL |
+ // URL is global in Node 10. In Node 7+ it must be imported. |
+ URL: typeof URL == "undefined" ? require("url").URL : URL |
}; |
let knownModules = new Map(); |
for (let dir of [path.join(__dirname, "stub-modules"), |
path.join(__dirname, "..", "lib")]) |
{ |
for (let file of fs.readdirSync(path.resolve(dir))) |
{ |