summaryrefslogtreecommitdiffstats
path: root/addon-sdk/source/test/fixtures/loader
diff options
context:
space:
mode:
Diffstat (limited to 'addon-sdk/source/test/fixtures/loader')
-rw-r--r--addon-sdk/source/test/fixtures/loader/cycles/a.js7
-rw-r--r--addon-sdk/source/test/fixtures/loader/cycles/b.js7
-rw-r--r--addon-sdk/source/test/fixtures/loader/cycles/c.js7
-rw-r--r--addon-sdk/source/test/fixtures/loader/cycles/main.js14
-rw-r--r--addon-sdk/source/test/fixtures/loader/errors/boomer.js7
-rw-r--r--addon-sdk/source/test/fixtures/loader/errors/main.js9
-rw-r--r--addon-sdk/source/test/fixtures/loader/exceptions/boomer.js9
-rw-r--r--addon-sdk/source/test/fixtures/loader/exceptions/main.js11
-rw-r--r--addon-sdk/source/test/fixtures/loader/globals/main.js7
-rw-r--r--addon-sdk/source/test/fixtures/loader/json/invalid.json3
-rw-r--r--addon-sdk/source/test/fixtures/loader/json/manifest.json14
-rw-r--r--addon-sdk/source/test/fixtures/loader/json/mutation.json1
-rw-r--r--addon-sdk/source/test/fixtures/loader/json/nodotjson.json.js8
-rw-r--r--addon-sdk/source/test/fixtures/loader/json/test.json3
-rw-r--r--addon-sdk/source/test/fixtures/loader/json/test.json.js7
-rw-r--r--addon-sdk/source/test/fixtures/loader/lazy/main.js9
-rw-r--r--addon-sdk/source/test/fixtures/loader/missing-twice/file.json1
-rw-r--r--addon-sdk/source/test/fixtures/loader/missing-twice/main.js32
-rw-r--r--addon-sdk/source/test/fixtures/loader/missing/main.js10
-rw-r--r--addon-sdk/source/test/fixtures/loader/self/main.js8
-rw-r--r--addon-sdk/source/test/fixtures/loader/syntax-error/error.js11
-rw-r--r--addon-sdk/source/test/fixtures/loader/syntax-error/main.js10
-rw-r--r--addon-sdk/source/test/fixtures/loader/unsupported/fennec.js10
-rw-r--r--addon-sdk/source/test/fixtures/loader/unsupported/firefox.js10
24 files changed, 215 insertions, 0 deletions
diff --git a/addon-sdk/source/test/fixtures/loader/cycles/a.js b/addon-sdk/source/test/fixtures/loader/cycles/a.js
new file mode 100644
index 000000000..f6e13ccb7
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/cycles/a.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+exports.b = require('b');
diff --git a/addon-sdk/source/test/fixtures/loader/cycles/b.js b/addon-sdk/source/test/fixtures/loader/cycles/b.js
new file mode 100644
index 000000000..69e23f11a
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/cycles/b.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+exports.a = require('a');
diff --git a/addon-sdk/source/test/fixtures/loader/cycles/c.js b/addon-sdk/source/test/fixtures/loader/cycles/c.js
new file mode 100644
index 000000000..ce34b3cf4
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/cycles/c.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+exports.main = require('main');
diff --git a/addon-sdk/source/test/fixtures/loader/cycles/main.js b/addon-sdk/source/test/fixtures/loader/cycles/main.js
new file mode 100644
index 000000000..6d13200c8
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/cycles/main.js
@@ -0,0 +1,14 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+var a = require('a');
+var b = require('b');
+var c = require('c');
+
+exports.a = a;
+exports.b = b;
+exports.c = c;
+exports.main = exports;
diff --git a/addon-sdk/source/test/fixtures/loader/errors/boomer.js b/addon-sdk/source/test/fixtures/loader/errors/boomer.js
new file mode 100644
index 000000000..c794cda33
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/errors/boomer.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+throw Error("opening input stream (invalid filename?)");
diff --git a/addon-sdk/source/test/fixtures/loader/errors/main.js b/addon-sdk/source/test/fixtures/loader/errors/main.js
new file mode 100644
index 000000000..1fdb56790
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/errors/main.js
@@ -0,0 +1,9 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+var error = require('./boomer');
+
+exports.main = exports;
diff --git a/addon-sdk/source/test/fixtures/loader/exceptions/boomer.js b/addon-sdk/source/test/fixtures/loader/exceptions/boomer.js
new file mode 100644
index 000000000..e26817984
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/exceptions/boomer.js
@@ -0,0 +1,9 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+exports.boom = function() {
+ throw Error("Boom!");
+};
diff --git a/addon-sdk/source/test/fixtures/loader/exceptions/main.js b/addon-sdk/source/test/fixtures/loader/exceptions/main.js
new file mode 100644
index 000000000..4b6279d7d
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/exceptions/main.js
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+var boomer = require('./boomer');
+
+boomer.boom();
+
+exports.main = exports;
diff --git a/addon-sdk/source/test/fixtures/loader/globals/main.js b/addon-sdk/source/test/fixtures/loader/globals/main.js
new file mode 100644
index 000000000..6d34ddbd3
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/globals/main.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+exports.console = console;
+exports.globalFoo = (typeof globalFoo !== "undefined") ? globalFoo : null;
diff --git a/addon-sdk/source/test/fixtures/loader/json/invalid.json b/addon-sdk/source/test/fixtures/loader/json/invalid.json
new file mode 100644
index 000000000..02ea4b0b4
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/json/invalid.json
@@ -0,0 +1,3 @@
+{
+ invalidjson
+}
diff --git a/addon-sdk/source/test/fixtures/loader/json/manifest.json b/addon-sdk/source/test/fixtures/loader/json/manifest.json
new file mode 100644
index 000000000..5ae25bb9d
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/json/manifest.json
@@ -0,0 +1,14 @@
+{
+ "name": "Jetpack Loader Test",
+ "version": "1.0.1",
+ "dependencies": {
+ "async": "*",
+ "underscore": "*"
+ },
+ "contributors": [
+ "ash nazg durbatulûk",
+ "ash nazg gimbatul",
+ "ash nazg thrakatulûk",
+ "agh burzum-ishi krimpatul"
+ ]
+}
diff --git a/addon-sdk/source/test/fixtures/loader/json/mutation.json b/addon-sdk/source/test/fixtures/loader/json/mutation.json
new file mode 100644
index 000000000..e1cbe3c15
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/json/mutation.json
@@ -0,0 +1 @@
+{ "value": 1 }
diff --git a/addon-sdk/source/test/fixtures/loader/json/nodotjson.json.js b/addon-sdk/source/test/fixtures/loader/json/nodotjson.json.js
new file mode 100644
index 000000000..af046caa6
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/json/nodotjson.json.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+module.exports = {
+ "filename": "nodotjson.json.js",
+ "data": {}
+};
diff --git a/addon-sdk/source/test/fixtures/loader/json/test.json b/addon-sdk/source/test/fixtures/loader/json/test.json
new file mode 100644
index 000000000..d19dc7117
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/json/test.json
@@ -0,0 +1,3 @@
+{
+ "filename": "test.json"
+}
diff --git a/addon-sdk/source/test/fixtures/loader/json/test.json.js b/addon-sdk/source/test/fixtures/loader/json/test.json.js
new file mode 100644
index 000000000..b14364bff
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/json/test.json.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+module.exports = {
+ "filename": "test.json.js"
+};
diff --git a/addon-sdk/source/test/fixtures/loader/lazy/main.js b/addon-sdk/source/test/fixtures/loader/lazy/main.js
new file mode 100644
index 000000000..04525f972
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/lazy/main.js
@@ -0,0 +1,9 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+exports.useFoo= function () {
+ return require('foo');
+}
diff --git a/addon-sdk/source/test/fixtures/loader/missing-twice/file.json b/addon-sdk/source/test/fixtures/loader/missing-twice/file.json
new file mode 100644
index 000000000..ebd6f791b
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/missing-twice/file.json
@@ -0,0 +1 @@
+an invalid json file
diff --git a/addon-sdk/source/test/fixtures/loader/missing-twice/main.js b/addon-sdk/source/test/fixtures/loader/missing-twice/main.js
new file mode 100644
index 000000000..20e453736
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/missing-twice/main.js
@@ -0,0 +1,32 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+try {
+ require('./not-found');
+}
+catch (e1) {
+ exports.firstError = e1;
+ // It should throw again and not be cached
+ try {
+ require('./not-found');
+ }
+ catch (e2) {
+ exports.secondError = e2;
+ }
+}
+
+try {
+ require('./file.json');
+}
+catch (e) {
+ exports.invalidJSON1 = e;
+ try {
+ require('./file.json');
+ }
+ catch (e) {
+ exports.invalidJSON2 = e;
+ }
+}
diff --git a/addon-sdk/source/test/fixtures/loader/missing/main.js b/addon-sdk/source/test/fixtures/loader/missing/main.js
new file mode 100644
index 000000000..dde9ee77c
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/missing/main.js
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+var a = require('./not-found');
+
+exports.a = a;
+exports.main = exports;
diff --git a/addon-sdk/source/test/fixtures/loader/self/main.js b/addon-sdk/source/test/fixtures/loader/self/main.js
new file mode 100644
index 000000000..ab2b159da
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/self/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+var self = require("sdk/self");
+exports.self = self;
diff --git a/addon-sdk/source/test/fixtures/loader/syntax-error/error.js b/addon-sdk/source/test/fixtures/loader/syntax-error/error.js
new file mode 100644
index 000000000..56c7c524f
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/syntax-error/error.js
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+module.metadata = {
+ "status": "experimental"
+};
+
+exports.b = @ require('b');
diff --git a/addon-sdk/source/test/fixtures/loader/syntax-error/main.js b/addon-sdk/source/test/fixtures/loader/syntax-error/main.js
new file mode 100644
index 000000000..4eadef870
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/syntax-error/main.js
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+var a = require('./error');
+
+exports.a = a;
+exports.main = exports;
diff --git a/addon-sdk/source/test/fixtures/loader/unsupported/fennec.js b/addon-sdk/source/test/fixtures/loader/unsupported/fennec.js
new file mode 100644
index 000000000..9edc63c14
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/unsupported/fennec.js
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+module.metadata = {
+ "engines": {
+ "Fennec": "*"
+ }
+};
+module.exports = {};
diff --git a/addon-sdk/source/test/fixtures/loader/unsupported/firefox.js b/addon-sdk/source/test/fixtures/loader/unsupported/firefox.js
new file mode 100644
index 000000000..5a08280a4
--- /dev/null
+++ b/addon-sdk/source/test/fixtures/loader/unsupported/firefox.js
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+module.metadata = {
+ "engines": {
+ "Firefox": "*"
+ }
+};
+module.exports = {};