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 /devtools/shared/webconsole/test/test_commands_other.html | |
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 'devtools/shared/webconsole/test/test_commands_other.html')
-rw-r--r-- | devtools/shared/webconsole/test/test_commands_other.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/devtools/shared/webconsole/test/test_commands_other.html b/devtools/shared/webconsole/test/test_commands_other.html new file mode 100644 index 000000000..47d1142c9 --- /dev/null +++ b/devtools/shared/webconsole/test/test_commands_other.html @@ -0,0 +1,83 @@ +<!DOCTYPE HTML> +<html lang="en"> +<head> + <meta charset="utf8"> + <title>Test for the other command helpers</title> + <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript;version=1.8" src="common.js"></script> + <!-- Any copyright is dedicated to the Public Domain. + - http://creativecommons.org/publicdomain/zero/1.0/ --> +</head> +<body> +<p>Test for the querySelector / querySelectorAll helpers</p> + +<script class="testbody" type="text/javascript;version=1.8"> +SimpleTest.waitForExplicitFinish(); +let gState; +let gWin; +let tests; + +function evaluateJS(input) { + return new Promise((resolve) => gState.client.evaluateJS(input, resolve)); +} + +function startTest() { + info ("Content window opened, attaching console to it"); + + let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); + ok (!gWin.document.nodePrincipal.equals(systemPrincipal), + "The test document is not using the system principal"); + + attachConsoleToTab([], state => { + gState = state; + runTests(tests, testEnd); + }); +} + +tests = [ + Task.async(function* keys() { + let response = yield evaluateJS("keys({foo: 'bar'})"); + checkObject(response, { + from: gState.actor, + result: { + class: "Array", + preview: { + items: ["foo"] + } + } + }); + nextTest(); + }), + Task.async(function* values() { + let response = yield evaluateJS("values({foo: 'bar'})"); + checkObject(response, { + from: gState.actor, + result: { + class: "Array", + preview: { + items: ["bar"] + } + } + }); + nextTest(); + }), +]; + +function testEnd() { + gWin.close(); + gWin = null; + closeDebugger(gState, function() { + gState = null; + SimpleTest.finish(); + }); +} + +window.onload = function() { + // Open a content window to test XRay functionality on built in functions. + gWin = window.open("data:text/html,"); + info ("Waiting for content window to load"); + gWin.onload = startTest; +} +</script> +</body> +</html> |