summaryrefslogtreecommitdiffstats
path: root/toolkit/components/osfile/tests/xpcshell/test_loader.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/components/osfile/tests/xpcshell/test_loader.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/osfile/tests/xpcshell/test_loader.js')
-rw-r--r--toolkit/components/osfile/tests/xpcshell/test_loader.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/toolkit/components/osfile/tests/xpcshell/test_loader.js b/toolkit/components/osfile/tests/xpcshell/test_loader.js
new file mode 100644
index 000000000..dcfa819be
--- /dev/null
+++ b/toolkit/components/osfile/tests/xpcshell/test_loader.js
@@ -0,0 +1,37 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Test that OS.File can be loaded using the CommonJS loader.
+ */
+
+var { Loader } = Components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js', {});
+
+function run_test() {
+ run_next_test();
+}
+
+
+add_task(function*() {
+ let dataDir = Services.io.newFileURI(do_get_file("test_loader/", true)).spec + "/";
+ let loader = Loader.Loader({
+ paths: {'': dataDir }
+ });
+
+ let require = Loader.Require(loader, Loader.Module('module_test_loader', 'foo'));
+ do_print("Require is ready");
+ try {
+ require('module_test_loader');
+ } catch (error) {
+ dump('Bootstrap error: ' +
+ (error.message ? error.message : String(error)) + '\n' +
+ (error.stack || error.fileName + ': ' + error.lineNumber) + '\n');
+
+ throw error;
+ }
+
+ do_print("Require has worked");
+});
+