diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /addon-sdk/source/test/fixtures | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'addon-sdk/source/test/fixtures')
97 files changed, 1213 insertions, 0 deletions
diff --git a/addon-sdk/source/test/fixtures/addon-install-unit-test@mozilla.com.xpi b/addon-sdk/source/test/fixtures/addon-install-unit-test@mozilla.com.xpi Binary files differnew file mode 100644 index 000000000..516c1fc3c --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon-install-unit-test@mozilla.com.xpi diff --git a/addon-sdk/source/test/fixtures/addon-sdk/data/border-style.css b/addon-sdk/source/test/fixtures/addon-sdk/data/border-style.css new file mode 100644 index 000000000..6941ccb20 --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon-sdk/data/border-style.css @@ -0,0 +1,4 @@ +/* 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/. */ +div { border-style: dashed; } diff --git a/addon-sdk/source/test/fixtures/addon-sdk/data/test-contentScriptFile.js b/addon-sdk/source/test/fixtures/addon-sdk/data/test-contentScriptFile.js new file mode 100644 index 000000000..7dc0e3f24 --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon-sdk/data/test-contentScriptFile.js @@ -0,0 +1,5 @@ +/* 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/. */ + +self.postMessage("msg from contentScriptFile"); diff --git a/addon-sdk/source/test/fixtures/addon-sdk/data/test-page-worker.html b/addon-sdk/source/test/fixtures/addon-sdk/data/test-page-worker.html new file mode 100644 index 000000000..85264034a --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon-sdk/data/test-page-worker.html @@ -0,0 +1,13 @@ +<!-- 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/. --> + +<html> +<head> + <meta charset="UTF-8"> + <title>Page Worker test</title> +</head> +<body> + <p id="paragraph">Lorem ipsum dolor sit amet.</p> +</body> +</html> diff --git a/addon-sdk/source/test/fixtures/addon-sdk/data/test-page-worker.js b/addon-sdk/source/test/fixtures/addon-sdk/data/test-page-worker.js new file mode 100644 index 000000000..5114fe4e0 --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon-sdk/data/test-page-worker.js @@ -0,0 +1,29 @@ +/* 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/. */ + + +// get title directly +self.postMessage(["equal", document.title, "Page Worker test", + "Correct page title accessed directly"]); + +// get <p> directly +var p = document.getElementById("paragraph"); +self.postMessage(["ok", !!p, "<p> can be accessed directly"]); +self.postMessage(["equal", p.firstChild.nodeValue, + "Lorem ipsum dolor sit amet.", + "Correct text node expected"]); + +// Modify page +var div = document.createElement("div"); +div.setAttribute("id", "block"); +div.appendChild(document.createTextNode("Test text created")); +document.body.appendChild(div); + +// Check back the modification +div = document.getElementById("block"); +self.postMessage(["ok", !!div, "<div> can be accessed directly"]); +self.postMessage(["equal", div.firstChild.nodeValue, + "Test text created", "Correct text node expected"]); +self.postMessage(["done"]); + diff --git a/addon-sdk/source/test/fixtures/addon-sdk/data/test.html b/addon-sdk/source/test/fixtures/addon-sdk/data/test.html new file mode 100644 index 000000000..181e85f9b --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon-sdk/data/test.html @@ -0,0 +1,13 @@ +<!-- 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/. --> + +<html> + <head> + <meta charset="UTF-8"> + <title>foo</title> + </head> + <body> + <p>bar</p> + </body> +</html> diff --git a/addon-sdk/source/test/fixtures/addon/bootstrap.js b/addon-sdk/source/test/fixtures/addon/bootstrap.js new file mode 100644 index 000000000..9134b4d92 --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon/bootstrap.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"; + +const { utils: Cu } = Components; +const {require} = Cu.import(`${ROOT}/toolkit/require.js`, {}); +const {Bootstrap} = require(`${ROOT}/sdk/addon/bootstrap.js`); +var {startup, shutdown, install, uninstall} = new Bootstrap(); diff --git a/addon-sdk/source/test/fixtures/addon/index.js b/addon-sdk/source/test/fixtures/addon/index.js new file mode 100644 index 000000000..c507c9624 --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon/index.js @@ -0,0 +1,4 @@ +/* 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"; diff --git a/addon-sdk/source/test/fixtures/addon/package.json b/addon-sdk/source/test/fixtures/addon/package.json new file mode 100644 index 000000000..488ec5b3b --- /dev/null +++ b/addon-sdk/source/test/fixtures/addon/package.json @@ -0,0 +1,5 @@ +{ + "id": "addon@jetpack", + "name": "addon", + "version": "0.0.1" +} diff --git a/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/manifest.mf b/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/manifest.mf new file mode 100644 index 000000000..5105792a7 --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/manifest.mf @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 + +Name: install.rdf +Digest-Algorithms: MD5 SHA1 +MD5-Digest: N643P4YjKKlwZUqrfLi4ow== +SHA1-Digest: XK/2qoOrnuYo8xNYeLvB8DlUIik= + +Name: bootstrap.js +Digest-Algorithms: MD5 SHA1 +MD5-Digest: XH+mMa/H9aj3hm/ZtVKviw== +SHA1-Digest: LMmd1aTash/onjS1eAYIshgrdnM= + +Name: options.xul +Digest-Algorithms: MD5 SHA1 +MD5-Digest: XeELNGdttv8Lq66lT8ykbQ== +SHA1-Digest: 4KO6/RBoe10rYOGS+gFSHuuWi4Y= + diff --git a/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/mozilla.rsa b/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/mozilla.rsa Binary files differnew file mode 100644 index 000000000..6b1c3a9ce --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/mozilla.rsa diff --git a/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/mozilla.sf b/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/mozilla.sf new file mode 100644 index 000000000..99f343296 --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap-addon/META-INF/mozilla.sf @@ -0,0 +1,4 @@ +Signature-Version: 1.0 +MD5-Digest-Manifest: cnqbpqBEVoHgJi/ocCsKKA== +SHA1-Digest-Manifest: eDmvBAkodeNbk/0ujttYgF8KDgI= + diff --git a/addon-sdk/source/test/fixtures/bootstrap-addon/bootstrap.js b/addon-sdk/source/test/fixtures/bootstrap-addon/bootstrap.js new file mode 100644 index 000000000..dea1d7b90 --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap-addon/bootstrap.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'; + +function install(data, reason) {} +function uninstall(data, reason) {} + +function startup(data, reasonCode) {}; +function shutdown(data, reasonCode) {}; diff --git a/addon-sdk/source/test/fixtures/bootstrap-addon/install.rdf b/addon-sdk/source/test/fixtures/bootstrap-addon/install.rdf new file mode 100644 index 000000000..221dc9c3d --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap-addon/install.rdf @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<!-- 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/. --> + +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + <Description about="urn:mozilla:install-manifest"> + <em:id>test-bootstrap-addon@mozilla.com</em:id> + <em:name>Test Bootstrap Add-on</em:name> + <em:creator>Erik Vold</em:creator> + <em:optionsType>2</em:optionsType> + <em:version>1.0</em:version> + <em:type>2</em:type> + <em:bootstrap>true</em:bootstrap> + <em:unpack>false</em:unpack> + + <!-- Firefox --> + <em:targetApplication> + <Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>26.0</em:minVersion> + <em:maxVersion>*</em:maxVersion> + </Description> + </em:targetApplication> + </Description> +</RDF> diff --git a/addon-sdk/source/test/fixtures/bootstrap-addon/options.xul b/addon-sdk/source/test/fixtures/bootstrap-addon/options.xul new file mode 100644 index 000000000..aafa46d88 --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap-addon/options.xul @@ -0,0 +1,3 @@ +<?xml version="1.0"?> +<!DOCTYPE mydialog SYSTEM "chrome://myaddon/locale/mydialog.dtd"> +<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"></vbox> diff --git a/addon-sdk/source/test/fixtures/bootstrap/utils.js b/addon-sdk/source/test/fixtures/bootstrap/utils.js new file mode 100644 index 000000000..aa7ea2d18 --- /dev/null +++ b/addon-sdk/source/test/fixtures/bootstrap/utils.js @@ -0,0 +1,52 @@ +/* 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"; + +const { Cu, Cc, Ci } = require("chrome"); +const { evaluate } = require("sdk/loader/sandbox"); + +const ROOT = require.resolve("sdk/base64").replace("/sdk/base64.js", ""); + +// Note: much of this test code is from +// http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm +const BOOTSTRAP_REASONS = { + APP_STARTUP : 1, + APP_SHUTDOWN : 2, + ADDON_ENABLE : 3, + ADDON_DISABLE : 4, + ADDON_INSTALL : 5, + ADDON_UNINSTALL : 6, + ADDON_UPGRADE : 7, + ADDON_DOWNGRADE : 8 +}; + +function createBootstrapScope(options) { + let { uri, id: aId } = options; + let principal = Cc["@mozilla.org/systemprincipal;1"]. + createInstance(Ci.nsIPrincipal); + + let bootstrapScope = new Cu.Sandbox(principal, { + sandboxName: uri, + wantGlobalProperties: ["indexedDB"], + addonId: aId, + metadata: { addonID: aId, URI: uri } + }); + + // Copy the reason values from the global object into the bootstrap scope. + for (let name in BOOTSTRAP_REASONS) + bootstrapScope[name] = BOOTSTRAP_REASONS[name]; + + return bootstrapScope; +} +exports.create = createBootstrapScope; + +function evaluateBootstrap(options) { + let { uri, scope } = options; + + evaluate(scope, + `${"Components"}.classes['@mozilla.org/moz/jssubscript-loader;1'] + .createInstance(${"Components"}.interfaces.mozIJSSubScriptLoader) + .loadSubScript("${uri}");`, "ECMAv5"); +} +exports.evaluate = evaluateBootstrap; diff --git a/addon-sdk/source/test/fixtures/border-style.css b/addon-sdk/source/test/fixtures/border-style.css new file mode 100644 index 000000000..6941ccb20 --- /dev/null +++ b/addon-sdk/source/test/fixtures/border-style.css @@ -0,0 +1,4 @@ +/* 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/. */ +div { border-style: dashed; } diff --git a/addon-sdk/source/test/fixtures/child-process-scripts.js b/addon-sdk/source/test/fixtures/child-process-scripts.js new file mode 100644 index 000000000..d808e56cb --- /dev/null +++ b/addon-sdk/source/test/fixtures/child-process-scripts.js @@ -0,0 +1,81 @@ +/* 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'; + +const { platform, pathFor } = require('sdk/system'); +const { defer } = require('sdk/core/promise'); +const { emit } = require('sdk/event/core'); +const { join } = require('sdk/fs/path'); +const { writeFile, unlinkSync, existsSync } = require('sdk/io/fs'); +const PROFILE_DIR= pathFor('ProfD'); +const isWindows = platform.toLowerCase().indexOf('win') === 0; +const isOSX = platform.toLowerCase().indexOf('darwin') === 0; + +var scripts = { + 'args.sh': 'echo $1 $2 $3 $4', + 'args.bat': 'echo %1 %2 %3 %4', + 'check-env.sh': 'echo $CHILD_PROCESS_ENV_TEST', + 'check-env.bat': 'echo %CHILD_PROCESS_ENV_TEST%', + 'check-pwd.sh': 'echo $PWD', + 'check-pwd.bat': 'cd', + 'large-err.sh': 'for n in `seq 0 $1` ; do echo "E" 1>&2; done', + 'large-err-mac.sh': 'for ((i=0; i<$1; i=i+1)); do echo "E" 1>&2; done', + 'large-err.bat': 'FOR /l %%i in (0,1,%1) DO echo "E" 1>&2', + 'large-out.sh': 'for n in `seq 0 $1` ; do echo "O"; done', + 'large-out-mac.sh': 'for ((i=0; i<$1; i=i+1)); do echo "O"; done', + 'large-out.bat': 'FOR /l %%i in (0,1,%1) DO echo "O"', + 'wait.sh': 'sleep 2', + // Use `ping` to an invalid IP address because `timeout` isn't + // on all environments? http://stackoverflow.com/a/1672349/1785755 + 'wait.bat': 'ping 1.1.1.1 -n 1 -w 2000 > nul' +}; + +Object.keys(scripts).forEach(filename => { + if (/\.sh$/.test(filename)) + scripts[filename] = '#!/bin/sh\n' + scripts[filename]; + else if (/\.bat$/.test(filename)) + scripts[filename] = '@echo off\n' + scripts[filename]; +}); + +function getScript (name) { + // Use specific OSX script if exists + if (isOSX && scripts[name + '-mac.sh']) + name = name + '-mac'; + let fileName = name + (isWindows ? '.bat' : '.sh'); + return createFile(fileName, scripts[fileName]); +} +exports.getScript = getScript; + +function createFile (name, data) { + let { promise, resolve, reject } = defer(); + let fileName = join(PROFILE_DIR, name); + writeFile(fileName, data, function (err) { + if (err) reject(); + else { + makeExecutable(fileName); + resolve(fileName); + } + }); + return promise; +} + +// TODO Use fs.chmod once implemented, bug 914606 +function makeExecutable (name) { + let { CC } = require('chrome'); + let nsILocalFile = CC('@mozilla.org/file/local;1', 'nsILocalFile', 'initWithPath'); + let file = nsILocalFile(name); + file.permissions = 0o777; +} + +function deleteFile (name) { + let file = join(PROFILE_DIR, name); + if (existsSync(file)) + unlinkSync(file); +} + +function cleanUp () { + Object.keys(scripts).forEach(deleteFile); +} +exports.cleanUp = cleanUp; diff --git a/addon-sdk/source/test/fixtures/chrome-worker/addEventListener.js b/addon-sdk/source/test/fixtures/chrome-worker/addEventListener.js new file mode 100644 index 000000000..baf28b452 --- /dev/null +++ b/addon-sdk/source/test/fixtures/chrome-worker/addEventListener.js @@ -0,0 +1,6 @@ +/* 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'; + +postMessage('Hello'); diff --git a/addon-sdk/source/test/fixtures/chrome-worker/jsctypes.js b/addon-sdk/source/test/fixtures/chrome-worker/jsctypes.js new file mode 100644 index 000000000..6345305ce --- /dev/null +++ b/addon-sdk/source/test/fixtures/chrome-worker/jsctypes.js @@ -0,0 +1,6 @@ +/* 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'; + +postMessage(typeof ctypes.open); diff --git a/addon-sdk/source/test/fixtures/chrome-worker/onerror.js b/addon-sdk/source/test/fixtures/chrome-worker/onerror.js new file mode 100644 index 000000000..b3e820b28 --- /dev/null +++ b/addon-sdk/source/test/fixtures/chrome-worker/onerror.js @@ -0,0 +1,6 @@ +/* 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 new Error('ok'); diff --git a/addon-sdk/source/test/fixtures/chrome-worker/onmessage.js b/addon-sdk/source/test/fixtures/chrome-worker/onmessage.js new file mode 100644 index 000000000..8fd95fb6d --- /dev/null +++ b/addon-sdk/source/test/fixtures/chrome-worker/onmessage.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'; + +onmessage = function (event) { + postMessage(event.data); +}; diff --git a/addon-sdk/source/test/fixtures/chrome-worker/setTimeout.js b/addon-sdk/source/test/fixtures/chrome-worker/setTimeout.js new file mode 100644 index 000000000..d3885243b --- /dev/null +++ b/addon-sdk/source/test/fixtures/chrome-worker/setTimeout.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'; + +setTimeout(function () { + postMessage('ok'); +}, 0); diff --git a/addon-sdk/source/test/fixtures/chrome-worker/xhr.js b/addon-sdk/source/test/fixtures/chrome-worker/xhr.js new file mode 100644 index 000000000..b19906897 --- /dev/null +++ b/addon-sdk/source/test/fixtures/chrome-worker/xhr.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 xhr = new XMLHttpRequest(); +xhr.open("GET", "data:text/plain,ok", true); +xhr.onload = function () { + postMessage(xhr.responseText); +}; +xhr.send(null); diff --git a/addon-sdk/source/test/fixtures/create_xpi.py b/addon-sdk/source/test/fixtures/create_xpi.py new file mode 100644 index 000000000..ed0f983d9 --- /dev/null +++ b/addon-sdk/source/test/fixtures/create_xpi.py @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +from os.path import abspath + +# TODO replace this script with a direct Python action invocation +from mozbuild.action.zip import main as create_zip + +def main(output, input_dir): + output.close() + + return create_zip(['-C', input_dir, abspath(output.name), '**']) diff --git a/addon-sdk/source/test/fixtures/es5.js b/addon-sdk/source/test/fixtures/es5.js new file mode 100644 index 000000000..746cae3c8 --- /dev/null +++ b/addon-sdk/source/test/fixtures/es5.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"; +exports.frozen = Object.freeze({}); +exports.sealed = Object.seal({}); +exports.inextensible = Object.preventExtensions({}); diff --git a/addon-sdk/source/test/fixtures/include-file.css b/addon-sdk/source/test/fixtures/include-file.css new file mode 100644 index 000000000..20d3e8294 --- /dev/null +++ b/addon-sdk/source/test/fixtures/include-file.css @@ -0,0 +1,4 @@ +/* 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/. */ +div { border: 10px solid black; } diff --git a/addon-sdk/source/test/fixtures/index.html b/addon-sdk/source/test/fixtures/index.html new file mode 100644 index 000000000..ba77c6a26 --- /dev/null +++ b/addon-sdk/source/test/fixtures/index.html @@ -0,0 +1,18 @@ +<!-- 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/. --> + +<html> + <head> + <meta charset="UTF-8"> + <title>Add-on Page</title> + </head> + <body> + <p>This is an add-on page test!</p> + <script> + function getTestURL() { + return window.document.documentURI + ""; + } + </script> + </body> +</html> diff --git a/addon-sdk/source/test/fixtures/jsm-package/Test.jsm b/addon-sdk/source/test/fixtures/jsm-package/Test.jsm new file mode 100644 index 000000000..3e71b456a --- /dev/null +++ b/addon-sdk/source/test/fixtures/jsm-package/Test.jsm @@ -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"; + +this.EXPORTED_SYMBOLS = ["Test"]; + +this.Test = { + square: function (x) { return x * x; } +}; diff --git a/addon-sdk/source/test/fixtures/jsm-package/index.js b/addon-sdk/source/test/fixtures/jsm-package/index.js new file mode 100644 index 000000000..e20721c76 --- /dev/null +++ b/addon-sdk/source/test/fixtures/jsm-package/index.js @@ -0,0 +1,46 @@ +/* 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 { Test } = require('./Test.jsm'); +var { Test: Test2 } = require('./Test.jsm'); +exports.localJSM = Test.square(16) === 256; +exports.localJSMCached = Test === Test2; + +(function () { +var { Promise } = require('resource://gre/modules/Promise.jsm'); +var { defer } = require('resource://gre/modules/Promise.jsm').Promise; + +exports.isCachedAbsolute = Promise.defer === defer; + +exports.isLoadedAbsolute = function (val) { + let { promise, resolve } = Promise.defer(); + resolve(val); + return promise; +}; +})(); + +(function () { +var { Promise } = require('modules/Promise.jsm'); +var { defer } = require('modules/Promise.jsm').Promise; +exports.isCachedPath = Promise.defer === defer; + +exports.isLoadedPath = function (val) { + let { promise, resolve } = Promise.defer(); + resolve(val); + return promise; +}; +})(); + +(function () { +var { defer } = require('resource://gre/modules/commonjs/sdk/core/promise.js'); +var { defer: defer2 } = require('resource://gre/modules/commonjs/sdk/core/promise.js'); +exports.isCachedJSAbsolute = defer === defer2; +exports.isLoadedJSAbsolute = function (val) { + let { promise, resolve } = defer(); + resolve(val); + return promise; +}; +})(); diff --git a/addon-sdk/source/test/fixtures/jsm-package/package.json b/addon-sdk/source/test/fixtures/jsm-package/package.json new file mode 100644 index 000000000..2e8caf211 --- /dev/null +++ b/addon-sdk/source/test/fixtures/jsm-package/package.json @@ -0,0 +1,3 @@ +{ + "name": "jsm-package" +} 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 = {}; diff --git a/addon-sdk/source/test/fixtures/mofo_logo.SVG b/addon-sdk/source/test/fixtures/mofo_logo.SVG new file mode 100644 index 000000000..2edeb9e6f --- /dev/null +++ b/addon-sdk/source/test/fixtures/mofo_logo.SVG @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --> +<svg version="1.1" id="svg2997" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="-0.5 -0.5 200 200" overflow="visible" enable-background="new -0.5 -0.5 200 200" xml:space="preserve"> +<path id="path85" fill="#FFFFFF" d="M-2559.936,6359.65c19.127,26.489,46.371,47.744,80.988,44.707 C-2479.339,6371.648-2523.898,6352.641-2559.936,6359.65z"/> +<path id="path93" fill="#FFFFFF" d="M-2634.014,6073.506c4.082-7.232,2.571-17.81,3.831-26.684 c-9.019,4.635-15.506,14.72-24.551,18.641C-2652.134,6070.818-2640.447,6070.829-2634.014,6073.506z"/> +<path id="path95" fill="#FFFFFF" d="M-2687.179,6018.109l-18.654,18.212c4.158,3.301,9.676,8.132,17.11,6.36L-2687.179,6018.109z"/> +<path id="path97" fill="#FFFFFF" d="M-2731.117,5998.391c-4.356-0.363-14.41,20.156-18.785,19.857l14.762,8.728 C-2730.055,6027.281-2732.816,6001.961-2731.117,5998.391L-2731.117,5998.391z"/> +<path id="path99" fill="#FFFFFF" d="M-2776.505,5989.09l4.736-11.668c-10.245,0.813-15.511,20.68-21.719,26.244 C-2776.37,6007.109-2775.727,6011.81-2776.505,5989.09z"/> +<path id="path101" fill="#FFFFFF" d="M-2825.16,5962.186l-18.405,31.539l17.091,3.962L-2825.16,5962.186L-2825.16,5962.186z"/> +<path id="path103" fill="#FFFFFF" d="M-2872.173,5967.636l-21.059,16.139C-2872.035,5992.07-2870.821,5995.181-2872.173,5967.636z"/> +<path id="path105" fill="#FFFFFF" d="M-2922.987,5980.398c-3.084-9.172-0.18-20.226,0.396-29.914 c-4.952,9.422-16.338,16.166-17.745,27.299C-2935.489,5981.802-2928.796,5980.021-2922.987,5980.398L-2922.987,5980.398z"/> +<g> + <path id="path9" d="M70.165,21.946C62.09,27.292,49.432,38.35,43.382,44.795c1.491,0.208,3.068-0.957,4.751-1.179l11.635-3.192 c-4.833,4.151-15.001,11.47-17.946,17.234c3.632-1.309,11.254-5.699,15.043-6.059c-3.309,3.038-10.214,8.801-12.378,12.469 c0.261,0.124,0.08,0.445,0.12,0.669c2.846-1.635,9.763-5.91,12.9-6.199c-3.229,3.484-9.169,10.193-10.47,14.688 c2.804-1.913,9.856-5.792,12.944-6.969c-0.703,1.773-2.262,3.09-3.276,4.864c-1.399,2.453-4.711,5.246-4.834,8.161 c2.46-2.375,5.51-4.474,8.571-6.148c-1.365,2.947-3.876,5.384-4.561,8.892c2.007-2.02,5.813-3.071,8.399-4.005l-0.312,0.311 c-0.224,0.191-3.136,2.335-5.121,4.727c1.765-0.114,0.449-0.334,2.707,0.18l-0.043,0.114 c-0.154,13.494,25.501,18.427,41.224,17.743c3.314-6.419,1.525-16.789,10.088-21.247c5.764-3.067,6.416-4.742,13.068-3.491 c3.596,0.674,11.461,3.392,15.227,2.534c3.514-2.033,5.221-2.928,8.332-5.37c3.01-4.574-23.988-19.398-2.164-0.171 c5.236,1.121,6.588,0.954,8.139-1.376c0.693-1.88,2.348-6.877,3.859-10.133l0.107-1.76c-1.467-4.414-1.111-11.965-1.852-13.053 c-4.842-6.713-22.34-7.764-30.256-16.596c1.35-4.384-1.482-7.997-4.367-10.738c-4.332-3.187-10.313-1.722-14.925-0.399 c-5.255-1.099-10.117-2.986-15.233-4.48C81.381,13.626,70.165,21.946,70.165,21.946L70.165,21.946z"/> + <path id="path11" fill="#FF1A00" d="M103.517,25.68l-3.771,1.438c-0.453-0.901,0.676-1.757,1.126-2.599 c0.322-0.616,1.247-0.961,1.465-1.705c-4.877-0.786-9.486-3.178-14.688-2.354c-5.563,0.878-8.802,3.003-12.005,5.54 c-1.617,0.885-2.396,2.142-3.968,3.201c-1.92,1.729-2.755,5.176-3.233,5.833c2.785-1.206,5.587-1.026,7.479-1.663 c-7.115,4.447-8.358,13.134-6.39,20.38l-0.116,0.159c-2.391-1.429-3.083-4.065-3.745-6.371c-0.471,1.515-0.538,3.44-0.859,5.132 c-0.764-0.713-1.184-1.734-1.61-2.644c-0.799,7.668,2.938,13.913,7.521,19.966c3.068,4.058-2.923,6.744-1.512,11.838l7.206-0.404 c0.929-0.348,0.64-0.223,0.64-0.223c-1.806,3.613-11.365,6.352-13.201,8.417c0.513,0.425,8.917-2.164,11.991-2.687l-9.045,5.112 c0.899,0.277-0.028,3.311,1.946,3.023c12.508,3.713,26.597,8.866,28.792,3.488c1.831-3.419,4.541-9.21,4.122-12.49l1.941-2.949 c-2.59,0.643-5.199,1.691-7.202,3.823c-0.599-1.256,0.342-2.763,0.81-3.951c1.343-2.41,4.026-3.686,6.151-5.056l-4.464-1.976 c-2.25-3.864-6.523-7.047-6.639-11.586l1.057,0.36c4.069,4.621,9.854,8.371,15.647,8.639c-3.943-0.338,16.471-2.743,15.271-4.472 c2.17,3.121,8.729,4.432,13.52,6.071c2.201-0.792,3.162-0.566,4.816-2.057c-0.705-0.765-1.795-1.39-2.844-1.787 c-6.295-1.738-21.162-4.796-24.365-10.986c-0.604,2.637,1.838,4.812,4.566,7.061l-5.873-0.826 c-10.331-4.782-9.083-12.984-6.813-20.78l0.785,6.508l2.025,3.548c3.851-6.966,1.835-6.1-5.898-15.494l5.832,2.228 c2.663,2.142,7.04,5.845,10.921,8.417c10.453,6.845,15.625,11.381,28.891,12.311l4.092,0.908c2.896-7.59-2.719-14.597-1.021-3.989 c-2.166-2.631-4.283-5.066-3.842-6.439c-0.76-1.147,3.143-4.014,2.811-5.319c-3.83-3.894-20.389-5.984-29.381-14.907 c-0.264,1.492,4.158,5.354,4.924,6.683c-8.918,0.088-14.174-2.651-15.127-5.542c-0.195-0.481,0.047-2.623,0.998-3.313 c1.287-0.672,2.541-1.693,4.02-1.83c-2.316-1.891-5.25,0.643-7.302,1.788c-1.594,2.737,0.889,5.788,1.202,8.014 c-2.175-0.549-5.111-4.378-5.471-6.782c-3.306,0.362-6.34-0.065-8.881-1.974c2.243-0.492,4.56-1.331,6.906-1.755 c6.143-1.34,12.598-7.655,18.803-2.72l-2.889-3.672C113.848,21.654,108.812,24.342,103.517,25.68L103.517,25.68z"/> + <path id="path13" d="M83.254,28.459c-1.649,1.924-3.302,3.85-3.687,6.437l0.369,0.434c1.102-1.326,2.753-2.437,4.274-3.207 c0.002,2.726,1.76,5.399,4.11,6.713l0.395,0.028c-0.498-2.879-0.166-6.399,0.96-8.998c1.793-1.508,4.151-2.106,5.668-3.692 c-3.797-0.888-7.411-0.136-10.658,1.1L83.254,28.459L83.254,28.459z"/> + <path id="path15" fill="#FFFFFF" d="M121.379,36.471c-1.561-2.157-3.777-3.888-6.594-3.642 C114.814,35.491,118.443,37.043,121.379,36.471z"/> + <path id="path17" d="M98.854,36.815c-2.445,0.187-4.736,0.622-7.041,1.224c1.017,0.937,2.302,1.252,3.266,2.129 c-3.017,1.137-6.176,1.861-8.813,4.186l0.546,0.325c4.878-1.015,10.645-0.929,15.732,0.16l0.294-0.212l-2.948-5.361l4.533-0.981 c-2.405-2.249-5.156-4.46-8.322-5.422C96.585,34.171,97.917,35.479,98.854,36.815L98.854,36.815L98.854,36.815z"/> + <path id="path19" d="M116.564,42.189c2.406,0.445,5.064,0.503,7.357,0.074c-3.787-1.932-8.625-1.552-11.639-4.944 C112.852,39.099,114.086,41.968,116.564,42.189z"/> + <path id="path21" d="M80.567,55.828c0.943,3.023-2.23,6.707,0.312,9.485c2.165,2.522,4.81,4.614,7.354,6.464l-0.225-0.943 c-2.266-2.647-4.349-5.569-5.396-8.716c2.656,0.928,5.463,2.216,8.496,2.646c-3.416-5.104-9.678-9.984-7.319-16.97 c0.129-1.154,1.655-2.041,1.271-3.113C81.49,47.408,79.996,51.435,80.567,55.828L80.567,55.828z"/> + <path id="path23" fill="#FFFFFF" d="M127.412,59.77c-0.334,0.589-0.213,1.45-0.316,2.174c0.738-0.379,1.264-1.199,2-1.518 C128.883,59.988,127.934,59.986,127.412,59.77z"/> + <path id="path25" fill="#FFFFFF" d="M131.738,64.284l1.518-1.487c-0.336-0.267-0.785-0.661-1.395-0.518L131.738,64.284z"/> + <path id="path27" fill="#FFFFFF" d="M135.316,65.887c0.355,0.026,1.174-1.643,1.531-1.618l-1.203-0.711 C135.229,63.532,135.455,65.593,135.316,65.887z"/> + <path id="path29" fill="#FFFFFF" d="M139.012,66.644l-0.385,0.95c0.836-0.067,1.264-1.684,1.766-2.138 C139.002,65.177,138.949,64.793,139.012,66.644z"/> + <path id="path31" fill="#FFFFFF" d="M142.977,68.834l1.498-2.569l-1.395-0.32L142.977,68.834z"/> + <path id="path33" fill="#FFFFFF" d="M146.801,68.39l1.715-1.312C146.789,66.4,146.691,66.147,146.801,68.39z"/> + <path id="path35" fill="#FFFFFF" d="M150.938,67.35c0.254,0.748,0.02,1.647-0.031,2.436c0.404-0.766,1.332-1.313,1.445-2.221 C151.957,67.233,151.412,67.382,150.938,67.35L150.938,67.35z"/> + <path id="path37" d="M99.399,96.021c0.547,1.031,0.572,2.285,1.119,3.315c1.295-2.793,1.147-6.148-0.533-8.659 c-2.923-1.288-5.745-2.625-8.264-4.671C92.768,89.577,96.192,93.513,99.399,96.021L99.399,96.021z"/> + <path id="path71" d="M117.387,36.775c-0.953-0.248-1.51-1.317-1.25-2.393c0.268-1.079,1.252-1.75,2.207-1.502 c0.955,0.245,1.512,1.318,1.25,2.393C119.328,36.348,118.34,37.021,117.387,36.775z"/> + <path id="path75" d="M98.356,103.161l2.835-2.31c-2.758-1.791-7.426-5.004-9.95-7.387C93.224,97.589,93.284,102.152,98.356,103.161 z"/> + <path id="path2225" d="M57.859,84.722c11.552,15.175,27.262,21.19,46.412,19.542l-1.629-3.542 c-17.031,0.631-31.21-3.592-40.875-17.588L57.859,84.722z"/> + <path id="path2343" d="M10.063,170.061c2.903,0.027,5.809-0.039,8.712,0.014l-0.375,2.293l-5.096,0.02l-0.021,3.24h4.088v2.342 h-4.088v6.334h-3.22V170.061z"/> + <path id="path3315" d="M30.648,184.227c-2.242-0.338-3.854-1.586-4.75-3.68c-0.511-1.191-0.656-2.105-0.596-3.748 c0.061-1.664,0.254-2.451,0.886-3.605c0.814-1.488,1.881-2.344,3.555-2.846c0.877-0.266,1.065-0.291,2.274-0.293 c1.095-0.004,1.446,0.029,2.078,0.201c2.303,0.627,3.802,2.172,4.426,4.559c0.288,1.105,0.265,3.764-0.042,4.846 c-0.697,2.463-2.385,4.098-4.674,4.527C33.093,184.322,31.412,184.342,30.648,184.227z M32.991,181.963 c0.926-0.281,1.579-1.137,1.876-2.463c0.205-0.91,0.238-3.596,0.058-4.547c-0.335-1.762-1.328-2.654-2.957-2.656 c-1.589-0.002-2.456,0.793-2.912,2.67c-0.214,0.883-0.238,3.438-0.041,4.396c0.279,1.357,0.877,2.211,1.761,2.512 C31.381,182.082,32.455,182.123,32.991,181.963z"/> + <path id="flowRoot5258" d="M47.563,170.053h3.446v8.381c0,1.154,0.179,1.98,0.537,2.48c0.364,0.492,0.955,0.883,1.772,0.883 c0.823,0,1.414-0.391,1.772-0.883c0.364-0.5,0.546-1.326,0.546-2.48v-8.381h3.445v8.381c0,1.979-0.474,3.451-1.423,4.418 c-0.948,0.967-2.396,1.451-4.34,1.451c-1.939,0-3.383-0.484-4.331-1.451c-0.949-0.967-1.423-2.439-1.423-4.418V170.053"/> + <path id="path6262" d="M68.606,170.053l3.509,0.051c1.381,2.793,2.899,5.531,4.078,8.41l0.197,0.504l-0.049-1.01l-0.18-7.951h2.948 v14.246h-3.182l-0.363-0.758c-1.15-2.398-3.13-6.629-3.602-7.697c-0.302-0.684-0.524-1.137-0.495-1.012 c0.029,0.127,0.083,2.309,0.119,4.848l0.065,4.619h-3.047V170.053z"/> + <path id="text8203" d="M92.398,182.191l0.931,0.002c0.986,0,1.843-1.076,2.366-1.844c0.522-0.766,0.977-1.873,0.977-3.322 c0-1.424-0.431-2.496-0.905-3.213c-0.469-0.725-1.17-1.424-2.104-1.424l-1.265-0.002v9.805 M88.878,184.303v-14.25h4.209 c1.173,0,2.12,0.104,2.84,0.311c0.72,0.201,1.357,0.529,1.912,0.986c0.8,0.65,1.393,1.455,1.776,2.41 c0.39,0.949,0.584,2.084,0.584,3.404c0,1.223-0.2,2.328-0.6,3.314c-0.4,0.986-0.981,1.813-1.744,2.482 c-0.544,0.475-1.155,0.818-1.832,1.031c-0.678,0.207-1.558,0.311-2.641,0.311H88.878"/> + <path id="path9182" d="M106.307,184.277l5.092-14.225h3.457c1.617,4.746,3.281,9.477,4.885,14.225l-3.457,0.023l-1.084-3.391 l-4.433,0.002l-1.083,3.389C108.559,184.289,107.431,184.324,106.307,184.277z M113.051,173.643l-1.51,4.887h2.873 C113.82,176.934,113.57,175.254,113.051,173.643z"/> + <path id="path10154" d="M127.924,172.535h-3.867v-2.48c3.799,0,7.6-0.004,11.4,0c-0.002,0-0.529,2.479-0.529,2.479l-3.748,0.002 v11.768h-3.256V172.535z"/> + <path id="path11126" d="M142.326,170.053h3.471v14.242h-3.471V170.053z"/> + <path id="path14040" d="M159.949,184.227c-2.24-0.338-3.854-1.586-4.748-3.68c-0.512-1.191-0.656-2.105-0.598-3.748 c0.061-1.664,0.254-2.451,0.885-3.605c0.816-1.488,1.883-2.344,3.557-2.846c0.877-0.266,1.064-0.291,2.275-0.293 c1.094-0.004,1.445,0.029,2.076,0.201c2.305,0.627,3.803,2.172,4.426,4.559c0.289,1.105,0.266,3.764-0.041,4.846 c-0.697,2.463-2.387,4.098-4.676,4.527C162.395,184.322,160.713,184.342,159.949,184.227z M162.293,181.963 c0.926-0.281,1.578-1.137,1.875-2.463c0.205-0.91,0.24-3.596,0.059-4.547c-0.336-1.762-1.328-2.654-2.957-2.656 c-1.59-0.002-2.457,0.793-2.912,2.67c-0.215,0.883-0.238,3.438-0.041,4.396c0.279,1.357,0.877,2.211,1.762,2.512 C160.682,182.082,161.756,182.123,162.293,181.963z"/> + <path id="path2224" d="M176.656,170.053l3.563,0.051c1.402,2.793,2.945,5.531,4.143,8.41l0.199,0.504l-0.049-1.01l-0.182-7.951 h2.992v14.246h-3.23l-0.369-0.758c-1.168-2.398-3.178-6.629-3.658-7.697c-0.305-0.684-0.531-1.137-0.502-1.012 c0.031,0.127,0.086,2.309,0.121,4.848l0.066,4.619h-3.094V170.053z"/> + <g id="g3173" transform="translate(-0.4495808,1251.722)"> + <path id="path2320" d="M185.373-1089.163c-1.527-0.85-2.496-1.666-3.189-2.689l-0.402-0.596l-0.586,0.516 c-0.816,0.725-1.141,0.965-1.887,1.406c-1.727,1.02-4.043,1.439-6.92,1.252c-5.955-0.385-9.082-3.238-9.49-8.66 c-0.182-2.412,0.223-4.607,1.158-6.289c1.281-2.305,3.789-3.914,7.313-4.695c1.803-0.398,3.266-0.545,5.977-0.594l2.516-0.049 l-0.049-1.311c-0.027-0.723-0.09-1.543-0.137-1.824c-0.25-1.477-0.871-2.223-2.035-2.445c-0.902-0.17-1.32-0.18-2.357-0.053 c-2.006,0.246-4.098,1.066-6.678,2.623c-0.691,0.416-1.297,0.744-1.346,0.725c-0.096-0.037-3.463-5.682-3.461-5.799 c0.008-0.166,2.094-1.316,3.582-1.973c4.023-1.775,6.543-2.377,9.953-2.377c3.17,0,5.359,0.533,7.127,1.736 c0.693,0.473,1.736,1.551,2.115,2.186c0.35,0.586,0.777,1.646,1.012,2.51l0.189,0.691l-0.041,4.766 c-0.021,2.619-0.041,6.43-0.041,8.467c0,4.178,0,4.18,0.633,5.414c0.273,0.537,0.498,0.814,1.266,1.57 c0.855,0.842,0.922,0.93,0.809,1.059c-0.068,0.076-1.029,1.184-2.137,2.461c-1.109,1.275-2.057,2.328-2.107,2.338 C186.108-1088.786,185.756-1088.953,185.373-1089.163z M175.903-1095.453c1.229-0.154,2.246-0.641,3.182-1.518l0.508-0.477 l0.055-3.168l0.053-3.168l-1.316,0.057c-4.154,0.178-5.707,0.842-6.377,2.729c-0.213,0.596-0.295,2.16-0.146,2.787 c0.334,1.418,1.457,2.533,2.768,2.748c0.246,0.039,0.486,0.078,0.531,0.082C175.203-1095.374,175.539-1095.408,175.903-1095.453z M137.623-1089.718c-1.318-0.205-2.459-0.68-3.502-1.459c-1.109-0.826-1.762-1.803-2.238-3.348 c-0.445-1.441-0.436-1.025-0.49-18.475c-0.051-15.838-0.057-16.158-0.236-18.186c-0.102-1.135-0.162-2.086-0.137-2.111 c0.074-0.074,8.055-1.891,8.154-1.857c0.098,0.037,0.248,1.135,0.361,2.654c0.162,10.801,0.012,21.605,0.156,32.406 c0.063,2.619,0.086,2.936,0.24,3.373c0.379,1.078,0.902,1.469,1.963,1.465c0.336,0,0.662-0.018,0.727-0.039 c0.105-0.033,0.479,1.133,1.371,4.289l0.162,0.578l-1.271,0.334C141.034-1089.607,139.186-1089.476,137.623-1089.718z M154.555-1089.644c-1.066-0.125-1.982-0.391-2.85-0.822c-2.164-1.08-3.219-2.633-3.713-5.475 c-0.066-0.375-0.109-5.193-0.146-16.57c-0.053-15.98-0.055-16.049-0.25-18.383c-0.117-1.43-0.164-2.367-0.119-2.408 c0.102-0.088,8.1-1.91,8.152-1.857c0.088,0.088,0.268,1.711,0.348,3.148c0.213,11.125-0.035,22.258,0.162,33.383 c0.055,1.18,0.107,1.611,0.238,1.984c0.221,0.625,0.525,1.014,0.945,1.199c0.457,0.203,1.182,0.281,1.516,0.166 c0.174-0.063,0.283-0.066,0.316-0.014c0.078,0.129,1.402,4.816,1.369,4.85c-0.016,0.018-0.504,0.164-1.084,0.328 C158.041-1089.722,155.75-1089.501,154.555-1089.644z M67.676-1089.716c-0.134-0.018-0.61-0.076-1.059-0.127 c-0.447-0.053-1.237-0.215-1.756-0.363c-5.568-1.582-9.046-6.182-9.853-13.021c-0.124-1.047-0.123-3.988,0.001-5.09 c0.362-3.213,1.4-6.119,2.997-8.387c1.083-1.537,2.861-3.086,4.462-3.889c2.021-1.016,3.78-1.402,6.368-1.402 c2.15,0,3.536,0.219,5.156,0.816c3.931,1.449,7.106,5.004,8.254,9.238c0.922,3.398,0.905,8.645-0.037,12.051 c-0.744,2.691-2.024,4.861-3.966,6.725s-4.086,2.918-6.7,3.297C70.775-1089.757,68.143-1089.654,67.676-1089.716z M70.77-1096.027 c1.815-0.824,2.693-2.672,3.095-6.512c0.153-1.465,0.177-5.111,0.041-6.512c-0.375-3.879-1.335-5.748-3.356-6.531 c-1.055-0.41-2.505-0.303-3.577,0.262c-1.823,0.959-2.647,2.99-2.926,7.207c-0.158,2.404-0.013,5.633,0.343,7.572 c0.475,2.602,1.225,3.77,2.859,4.457c0.768,0.322,1.166,0.387,2.144,0.344C70.09-1095.769,70.293-1095.812,70.77-1096.027z M10.314-1116.745c-0.13-1.063-0.376-2.029-0.667-2.621c-0.147-0.301-0.224-0.547-0.182-0.584c0.09-0.078,7.021-1.965,7.22-1.965 c0.204,0,0.671,0.98,0.915,1.92c0.112,0.432,0.204,0.855,0.204,0.939c0,0.086,0.027,0.152,0.061,0.152 c0.034-0.002,0.391-0.277,0.794-0.615c1.52-1.27,3.532-2.127,5.465-2.324c2.115-0.217,4.02,0.1,5.551,0.92 c0.98,0.527,2.146,1.512,2.768,2.336l0.488,0.646l0.314-0.326c0.76-0.789,2.256-1.92,3.307-2.496 c0.898-0.494,2.17-0.893,3.413-1.074c1.114-0.16,3.312-0.063,4.384,0.197c1.185,0.287,2.204,0.719,2.971,1.26 c1.574,1.109,2.172,2.082,2.584,4.207c0.172,0.885,0.174,1.025,0.203,13.373l0.029,12.479H42.15v-10.934 c0-7.029-0.03-11.18-0.084-11.623c-0.198-1.623-0.574-2.096-1.798-2.268c-1.429-0.199-3.438,0.574-5.267,2.025l-0.667,0.529 l0,22.27h-7.729c-0.473-7.383,0.652-15.438-0.186-22.727c-0.296-1.432-0.807-1.955-2.059-2.107 c-1.462-0.178-3.452,0.498-5.153,1.75l-0.664,0.488l-0.005,22.596h-7.979C10.282-1099.062,11.051-1108.048,10.314-1116.745z M86.536-1095.492l14.459-19.949l-13.248-0.043v-5.779h23.043v5.578c-4.503,6.535-9.129,12.986-13.598,19.545l14.179,0.037 l-0.059,0.182l-1.888,5.559l-22.899,0.041L86.536-1095.492z M116.735-1120.853l0.184-0.041c2.588-0.43,5.186-0.809,7.775-1.227 l0.266-0.045v31.844h-8.225V-1120.853z M120.276-1124.939c-1.963-0.195-3.682-1.678-4.188-3.611 c-0.703-2.688,0.707-5.361,3.273-6.201c0.484-0.158,0.754-0.191,1.592-0.191c1.578,0,2.482,0.357,3.508,1.381 c0.986,0.986,1.412,2.068,1.418,3.586c0.004,1.563-0.406,2.584-1.457,3.637C123.332-1125.245,121.934-1124.773,120.276-1124.939z"/> + </g> +</g> +</svg> diff --git a/addon-sdk/source/test/fixtures/moz.build b/addon-sdk/source/test/fixtures/moz.build new file mode 100644 index 000000000..2c3635186 --- /dev/null +++ b/addon-sdk/source/test/fixtures/moz.build @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +fixtures = [ + 'native-addon-test', + 'native-overrides-test', +] + +output_dir = OBJDIR_FILES._tests.testing.mochitest['jetpack-package']['addon-sdk'].source.test.fixtures + +for fixture in fixtures: + xpi = '%s.xpi' % fixture + + GENERATED_FILES += [xpi] + f = GENERATED_FILES[xpi] + f.script = 'create_xpi.py' + f.inputs = [fixture] + + output_dir += ['!%s' % xpi] diff --git a/addon-sdk/source/test/fixtures/moz_favicon.ico b/addon-sdk/source/test/fixtures/moz_favicon.ico Binary files differnew file mode 100644 index 000000000..d44438903 --- /dev/null +++ b/addon-sdk/source/test/fixtures/moz_favicon.ico diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/a.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/a.js new file mode 100644 index 000000000..2f8cccb68 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/a.js @@ -0,0 +1,5 @@ +/* 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 = 'dir/a'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/a/index.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/a/index.js new file mode 100644 index 000000000..a86eaa184 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/a/index.js @@ -0,0 +1,5 @@ +/* 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 = 'dir/a/index'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/b.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/b.js new file mode 100644 index 000000000..cd3e975b2 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/b.js @@ -0,0 +1,6 @@ +/* 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 = require('test-math'); + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/c.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/c.js new file mode 100644 index 000000000..ed5fd149e --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/c.js @@ -0,0 +1,6 @@ +/* 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 = require('../package.json'); + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/dummy.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/dummy.js new file mode 100644 index 000000000..e1640884c --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/dummy.js @@ -0,0 +1,6 @@ +/* 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 = 'this is a dummy module'; + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/test.jsm b/addon-sdk/source/test/fixtures/native-addon-test/dir/test.jsm new file mode 100644 index 000000000..1e2946f94 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/test.jsm @@ -0,0 +1,6 @@ +/* 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/. */ + +this['EXPORTED_SYMBOLS'] = ['test']; +test = 'this is a jsm'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/expectedmap.json b/addon-sdk/source/test/fixtures/native-addon-test/expectedmap.json new file mode 100644 index 000000000..4fa5886f7 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/expectedmap.json @@ -0,0 +1,25 @@ +{ + "./index.js": { + "./dir/a": "./dir/a.js", + "./dir/b": "./dir/b.js", + "./dir/c": "./dir/c.js", + "./dir/dummy": "./dir/dummy.js", + "./dir/test.jsm": "./dir/test.jsm", + "./utils": "./utils/index.js", + "./newmodule": "./newmodule/lib/file.js", + "test-math": "./node_modules/test-math/index.js", + "test-custom-main": "./node_modules/test-custom-main/lib/custom-entry.js", + "test-custom-main-relative": "./node_modules/test-custom-main-relative/lib/custom-entry.js", + "test-default-main": "./node_modules/test-default-main/index.js" + }, + "./dir/b.js": { + "test-math": "./node_modules/test-math/index.js" + }, + "./dir/c.js": { + "../package.json": "./package.json" + }, + "./node_modules/test-math/index.js": { + "test-add": "./node_modules/test-math/node_modules/test-add/index.js", + "test-subtract": "./node_modules/test-math/node_modules/test-subtract/index.js" + } +} diff --git a/addon-sdk/source/test/fixtures/native-addon-test/index.js b/addon-sdk/source/test/fixtures/native-addon-test/index.js new file mode 100644 index 000000000..68720d401 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/index.js @@ -0,0 +1,37 @@ +/* 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/. */ + +// Added noise to test AST walker +for (var i = 0; i < 5; i++) { + square(i); +} + +exports.directoryDefaults = require('./utils'); +exports.directoryMain = require('./newmodule'); +exports.resolvesJSoverDir= require('./dir/a'); +exports.math = require('test-math'); +exports.mathInRelative = require('./dir/b'); +exports.customMainModule = require('test-custom-main'); +exports.customMainModuleRelative = require('test-custom-main-relative'); +exports.defaultMain = require('test-default-main'); +exports.testJSON = require('./dir/c'); +exports.dummyModule = require('./dir/dummy'); + +exports.eventCore = require('sdk/event/core'); +exports.promise = require('sdk/core/promise'); + +exports.localJSM = require('./dir/test.jsm'); +exports.promisejsm = require('modules/Promise.jsm').Promise; +exports.require = require; + +var math = require('test-math'); +exports.areModulesCached = (math === exports.math); + +// Added noise to test AST walker +function square (x) { + let tmp = x; + tmp *= x; + return tmp; +} + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/newmodule/index.js b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/index.js new file mode 100644 index 000000000..f982e6b98 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/index.js @@ -0,0 +1,5 @@ +/* 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 = 'index.js'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/newmodule/lib/file.js b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/lib/file.js new file mode 100644 index 000000000..fab140983 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/lib/file.js @@ -0,0 +1,5 @@ +/* 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 = 'main from new module'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/newmodule/package.json b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/package.json new file mode 100644 index 000000000..feae8acaa --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/package.json @@ -0,0 +1,3 @@ +{ + "main":"lib/file.js" +} diff --git a/addon-sdk/source/test/fixtures/native-addon-test/package.json b/addon-sdk/source/test/fixtures/native-addon-test/package.json new file mode 100644 index 000000000..f689b83f6 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/package.json @@ -0,0 +1,10 @@ +{ + "main":"index.js", + "dependencies": { + "test-math": "*", + "test-custom-main": "*", + "test-custom-main-relative": "*", + "test-default-main": "*", + "test-assets": "*" + } +} diff --git a/addon-sdk/source/test/fixtures/native-addon-test/utils/index.js b/addon-sdk/source/test/fixtures/native-addon-test/utils/index.js new file mode 100644 index 000000000..d34af25d5 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/utils/index.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"; + +module.exports = 'utils'; + diff --git a/addon-sdk/source/test/fixtures/native-overrides-test/ignore.js b/addon-sdk/source/test/fixtures/native-overrides-test/ignore.js new file mode 100644 index 000000000..02539eb79 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-overrides-test/ignore.js @@ -0,0 +1,6 @@ +/* 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.bar = "do not ignore this export"; diff --git a/addon-sdk/source/test/fixtures/native-overrides-test/index.js b/addon-sdk/source/test/fixtures/native-overrides-test/index.js new file mode 100644 index 000000000..ef0b6bba1 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-overrides-test/index.js @@ -0,0 +1,19 @@ +/* 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 foo = require("foo"); +var coolTabs = require("cool-tabs"); + +exports.foo = foo.fs; +exports.bar = foo.bar; +exports.fs = require("sdk/io/fs"); +exports.extra = require("fs-extra").extra; +exports.overload = require("overload"); +exports.overloadLib = require("overload/lib/foo.js"); +exports.internal = require("internal").internal; +exports.Tabs = require("sdk/tabs").Tabs; +exports.CoolTabs = coolTabs.Tabs; +exports.CoolTabsLib = coolTabs.TabsLib; +exports.ignore = require("./lib/ignore").foo; diff --git a/addon-sdk/source/test/fixtures/native-overrides-test/lib/ignore.js b/addon-sdk/source/test/fixtures/native-overrides-test/lib/ignore.js new file mode 100644 index 000000000..d37a7827a --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-overrides-test/lib/ignore.js @@ -0,0 +1,6 @@ +/* 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.foo = require("../ignore").bar; diff --git a/addon-sdk/source/test/fixtures/native-overrides-test/lib/internal.js b/addon-sdk/source/test/fixtures/native-overrides-test/lib/internal.js new file mode 100644 index 000000000..2d5f419fd --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-overrides-test/lib/internal.js @@ -0,0 +1,6 @@ +/* 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.internal = "test"; diff --git a/addon-sdk/source/test/fixtures/native-overrides-test/lib/tabs.js b/addon-sdk/source/test/fixtures/native-overrides-test/lib/tabs.js new file mode 100644 index 000000000..20f59551e --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-overrides-test/lib/tabs.js @@ -0,0 +1,6 @@ +/* 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.Tabs = "no tabs exist"; diff --git a/addon-sdk/source/test/fixtures/native-overrides-test/package.json b/addon-sdk/source/test/fixtures/native-overrides-test/package.json new file mode 100644 index 000000000..346cf76f5 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-overrides-test/package.json @@ -0,0 +1,18 @@ +{ + "name": "native-overrides-test", + "main": "index.js", + "dependencies": { + "cool-tabs": "*", + "foo": "*", + "fs-extra": "*" + }, + "jetpack": { + "overrides": { + "fs": "sdk/io/fs", + "overload": "foo", + "internal": "./lib/internal", + "sdk/tabs": "./lib/tabs", + "../ignore": "foo" + } + } +} diff --git a/addon-sdk/source/test/fixtures/preferences/curly-id/package.json b/addon-sdk/source/test/fixtures/preferences/curly-id/package.json new file mode 100644 index 000000000..1d47b4d81 --- /dev/null +++ b/addon-sdk/source/test/fixtures/preferences/curly-id/package.json @@ -0,0 +1,14 @@ +{ + "id": "{34a1eae1-c20a-464f-9b0e-000000000000}", + "fullName": "curly ID test", + "author": "Tomislav Jovanovic", + + "preferences": [{ + "name": "test13", + "type": "integer", + "title": "test13", + "value": 26 + }], + + "preferences-branch": "invalid^branch*name" +} diff --git a/addon-sdk/source/test/fixtures/preferences/no-prefs/package.json b/addon-sdk/source/test/fixtures/preferences/no-prefs/package.json new file mode 100644 index 000000000..7b243b41d --- /dev/null +++ b/addon-sdk/source/test/fixtures/preferences/no-prefs/package.json @@ -0,0 +1,6 @@ +{ + "id": "no-prefs@jetpack", + "title": "No Prefs Test", + "author": "Erik Vold", + "loader": "lib/main.js" +} diff --git a/addon-sdk/source/test/fixtures/preferences/preferences-branch/package.json b/addon-sdk/source/test/fixtures/preferences/preferences-branch/package.json new file mode 100644 index 000000000..b738db7d0 --- /dev/null +++ b/addon-sdk/source/test/fixtures/preferences/preferences-branch/package.json @@ -0,0 +1,14 @@ +{ + "id": "test-preferences-branch", + "fullName": "preferences-branch test", + "author": "Tomislav Jovanovic", + + "preferences": [{ + "name": "test42", + "type": "bool", + "title": "test42", + "value": true + }], + + "preferences-branch": "human-readable" +} diff --git a/addon-sdk/source/test/fixtures/preferences/simple-prefs/package.json b/addon-sdk/source/test/fixtures/preferences/simple-prefs/package.json new file mode 100644 index 000000000..d3b077ddf --- /dev/null +++ b/addon-sdk/source/test/fixtures/preferences/simple-prefs/package.json @@ -0,0 +1,75 @@ +{ + "id": "simple-prefs@jetpack", + "title": "Simple Prefs Test", + "author": "Erik Vold", + "preferences": [{ + "name": "test", + "type": "bool", + "title": "tëst", + "value": false, + "description": "descrïptiön" + }, + { + "name": "test2", + "type": "string", + "title": "tëst", + "value": "ünicødé" + }, + { + "name": "test3", + "type": "menulist", + "title": "\"><test", + "value": "1", + "options": [ + { + "value": "0", + "label": "label1" + }, + { + "value": "1", + "label": "label2" + } + ] + }, + { + "name": "test4", + "type": "radio", + "title": "tëst", + "value": "red", + "options": [ + { + "value": "red", + "label": "rouge" + }, + { + "value": "blue", + "label": "bleu" + } + ] + }, + { + "name": "test5", + "type": "boolint", + "title": "part part, particle", + "value": 7 + }, + { + "name": "test6", + "type": "color", + "title": "pop pop, popscicle", + "value": "#ff5e99" + }, + { + "name": "test7", + "type": "file", + "title": "bike bike", + "value": "bicycle" + }, + { + "name": "test8", + "type": "directory", + "title": "test test", + "value": "1-2-3" + }], + "loader": "lib/main.js" +} diff --git a/addon-sdk/source/test/fixtures/sandbox-complex-character.js b/addon-sdk/source/test/fixtures/sandbox-complex-character.js new file mode 100644 index 000000000..6ae6769cf --- /dev/null +++ b/addon-sdk/source/test/fixtures/sandbox-complex-character.js @@ -0,0 +1,5 @@ +/* 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/. */ + +var chars = 'გამარჯობა'; diff --git a/addon-sdk/source/test/fixtures/sandbox-normal.js b/addon-sdk/source/test/fixtures/sandbox-normal.js new file mode 100644 index 000000000..54252985d --- /dev/null +++ b/addon-sdk/source/test/fixtures/sandbox-normal.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/. */ + +var a = 1; +this.b = 2; +function f() { return 4; } diff --git a/addon-sdk/source/test/fixtures/test-addon-extras-window.html b/addon-sdk/source/test/fixtures/test-addon-extras-window.html new file mode 100644 index 000000000..76ce98cd3 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-addon-extras-window.html @@ -0,0 +1,21 @@ +<!-- 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/. --> + +<html> +<head> + <meta charset="UTF-8"> + <title>Worker test</title> +</head> +<body> + <p id="paragraph">Lorem ipsum dolor sit amet.</p> + <script> + if ("addon" in window) { + var count = 1; + addon.port.on("get-result", () => { + addon.port.emit("result" + count++, extras.test().getTestURL()) + }); + } + </script> +</body> +</html> diff --git a/addon-sdk/source/test/fixtures/test-addon-extras.html b/addon-sdk/source/test/fixtures/test-addon-extras.html new file mode 100644 index 000000000..9864495e8 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-addon-extras.html @@ -0,0 +1,31 @@ +<!-- 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/. --> + +<html> +<head> + <meta charset="UTF-8"> + <title>Worker test</title> +</head> +<body> + <p id="paragraph">Lorem ipsum dolor sit amet.</p> + <script> + if ("addon" in window) { + var count = 1; + addon.port.on("get-result", () => { + console.log("get-result recieved"); + addon.port.emit("result" + count++, extras && extras.test()) + }); + } + + window.addEventListener("message", function getMessage({ data }) { + if (data.name == "start") { + window.postMessage({ + name: "extras", + result: window.extras === undefined + }, '*'); + } + }, false); + </script> +</body> +</html> diff --git a/addon-sdk/source/test/fixtures/test-contentScriptFile.js b/addon-sdk/source/test/fixtures/test-contentScriptFile.js new file mode 100644 index 000000000..7dc0e3f24 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-contentScriptFile.js @@ -0,0 +1,5 @@ +/* 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/. */ + +self.postMessage("msg from contentScriptFile"); diff --git a/addon-sdk/source/test/fixtures/test-context-menu.js b/addon-sdk/source/test/fixtures/test-context-menu.js new file mode 100644 index 000000000..1a15609b7 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-context-menu.js @@ -0,0 +1,5 @@ +/* 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/. */ + +self.on("context", () => true); diff --git a/addon-sdk/source/test/fixtures/test-iframe-postmessage.html b/addon-sdk/source/test/fixtures/test-iframe-postmessage.html new file mode 100644 index 000000000..b33d597dd --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-iframe-postmessage.html @@ -0,0 +1,23 @@ +<!-- 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/. --> +<!DOCTYPE HTML> +<html> + <head> + <meta charset="UTF-8"> + <script> + window.addEventListener("message", function(msg) { + parent.postMessage(msg.data, "*"); + }); + + parent.postMessage({ + first: "a string", + second: ["an", "array"], + third: {an: 'object'} + }, '*'); + </script> + </head> + <body> + <h1>Inner iframe</h1> + </body> +</html> diff --git a/addon-sdk/source/test/fixtures/test-iframe.html b/addon-sdk/source/test/fixtures/test-iframe.html new file mode 100644 index 000000000..56cd50c1a --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-iframe.html @@ -0,0 +1,12 @@ +<!-- 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/. --> +<!DOCTYPE HTML> +<html> +<head> + <meta charset="UTF-8"> +</head> +<body> + <iframe id="inner" src="about:blank"></iframe> +</body> +</html> diff --git a/addon-sdk/source/test/fixtures/test-iframe.js b/addon-sdk/source/test/fixtures/test-iframe.js new file mode 100644 index 000000000..bbfadc4ff --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-iframe.js @@ -0,0 +1,16 @@ +/* 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/. */ + +var count = 0; + +setTimeout(function() { + window.addEventListener("message", function(msg) { + if (++count > 1) { + self.postMessage(msg.data); + } + else msg.source.postMessage(msg.data, '*'); + }); + + document.getElementById('inner').src = iframePath; +}, 0); diff --git a/addon-sdk/source/test/fixtures/test-message-manager.js b/addon-sdk/source/test/fixtures/test-message-manager.js new file mode 100644 index 000000000..d647bd8fd --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-message-manager.js @@ -0,0 +1,6 @@ +/* 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/. */ + +const TEST_VALUE = 11; + diff --git a/addon-sdk/source/test/fixtures/test-net-url.txt b/addon-sdk/source/test/fixtures/test-net-url.txt new file mode 100644 index 000000000..9f8166e61 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-net-url.txt @@ -0,0 +1 @@ +Hello, ゼロ!
\ No newline at end of file diff --git a/addon-sdk/source/test/fixtures/test-page-mod.html b/addon-sdk/source/test/fixtures/test-page-mod.html new file mode 100644 index 000000000..901abefc4 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-page-mod.html @@ -0,0 +1,12 @@ +<!-- 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/. --> +<html> +<head> + <meta charset="UTF-8"> + <title>Page Mod test</title> +</head> +<body> + <p id="paragraph">Lorem ipsum dolor sit amet.</p> +</body> +</html> diff --git a/addon-sdk/source/test/fixtures/test-sidebar-addon-global.html b/addon-sdk/source/test/fixtures/test-sidebar-addon-global.html new file mode 100644 index 000000000..4552e3d78 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-sidebar-addon-global.html @@ -0,0 +1,15 @@ +<!-- 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/. --> +<script> +if ("addon" in window) { + addon.port.on('X', function(msg) { + // last message + addon.port.emit('X', msg + '3'); + }); + + // start messaging chain + addon.port.emit('Y', '1'); +} +</script> +SIDEBAR TEST diff --git a/addon-sdk/source/test/fixtures/test-trusted-document.html b/addon-sdk/source/test/fixtures/test-trusted-document.html new file mode 100644 index 000000000..c31e055cb --- /dev/null +++ b/addon-sdk/source/test/fixtures/test-trusted-document.html @@ -0,0 +1,20 @@ +<!-- 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/. --> + +<html> +<head> + <meta charset="UTF-8"> + <title>Worker test</title> +</head> +<body> + <p id="paragraph">Lorem ipsum dolor sit amet.</p> + <script> + if ("addon" in window) { + addon.port.on('addon-to-document', function (arg) { + addon.port.emit('document-to-addon', arg); + }); + } + </script> +</body> +</html> diff --git a/addon-sdk/source/test/fixtures/test.html b/addon-sdk/source/test/fixtures/test.html new file mode 100644 index 000000000..70b5e31e5 --- /dev/null +++ b/addon-sdk/source/test/fixtures/test.html @@ -0,0 +1,25 @@ +<!-- 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/. --> + +<html> + <head> + <meta charset="UTF-8"> + <title>foo</title> + </head> + <body> + <p>bar</p> + <script> + function getTestURL() { + return window.document.documentURI + ""; + } + function changesInWindow() { + window.document.documentElement.setAttribute('test', 'changes in window'); + return null; + } + function getAUQLUE() { + return "AUQLUE" in window; + } + </script> + </body> +</html> diff --git a/addon-sdk/source/test/fixtures/testLocalXhr.json b/addon-sdk/source/test/fixtures/testLocalXhr.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/addon-sdk/source/test/fixtures/testLocalXhr.json @@ -0,0 +1 @@ +{} |