зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1022229 - Tests. r=bz
This commit is contained in:
Родитель
0f8a49569d
Коммит
44b916f85a
|
@ -0,0 +1,40 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
// Uncomment this definition of SimpleTest (and comment out the one below) to
|
||||||
|
// debug in mozBrowser mode.
|
||||||
|
/*
|
||||||
|
var SimpleTest = { ok: function(c, m) { dump(m + ": " + c + "\n"); },
|
||||||
|
info: function(m) { dump(m + "\n"); },
|
||||||
|
finish: function() { dump("Test done\n");} };
|
||||||
|
*/
|
||||||
|
var SimpleTest = parent.SimpleTest;
|
||||||
|
|
||||||
|
var ok = SimpleTest.ok;
|
||||||
|
var info = SimpleTest.info;
|
||||||
|
var finish = SimpleTest.finish.bind(SimpleTest);
|
||||||
|
|
||||||
|
var gotTargetedMessage = false;
|
||||||
|
window.onmessage = function(evt) {
|
||||||
|
var message = evt.data;
|
||||||
|
info("Received message: " + message);
|
||||||
|
switch (message) {
|
||||||
|
case 'targeted':
|
||||||
|
gotTargetedMessage = true;
|
||||||
|
break;
|
||||||
|
case 'broadcast':
|
||||||
|
ok(gotTargetedMessage, "Should have received targeted message");
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ok(false, "Unexpected message: " + message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<iframe src="iframe_sandbox_bug1022229.html" sandbox="allow-scripts"></iframe>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
// First send an origin-restricted message, and then send a non-restricted
|
||||||
|
// message to end the test promptly even in a failure mode.
|
||||||
|
parent.postMessage('targeted', 'http://mochi.test:8888');
|
||||||
|
setTimeout(function() { parent.postMessage('broadcast', '*'); }, 0);
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -2,6 +2,8 @@
|
||||||
support-files =
|
support-files =
|
||||||
audio.ogg
|
audio.ogg
|
||||||
iframe_bug976673.html
|
iframe_bug976673.html
|
||||||
|
iframe_main_bug1022229.html
|
||||||
|
iframe_sandbox_bug1022229.html
|
||||||
iframe_messageChannel_cloning.html
|
iframe_messageChannel_cloning.html
|
||||||
iframe_messageChannel_chrome.html
|
iframe_messageChannel_chrome.html
|
||||||
iframe_messageChannel_pingpong.html
|
iframe_messageChannel_pingpong.html
|
||||||
|
@ -21,6 +23,7 @@ skip-if = buildapp == 'mulet'
|
||||||
[test_bug979109.html]
|
[test_bug979109.html]
|
||||||
[test_bug989665.html]
|
[test_bug989665.html]
|
||||||
[test_bug999456.html]
|
[test_bug999456.html]
|
||||||
|
[test_bug1022229.html]
|
||||||
[test_clearTimeoutIntervalNoArg.html]
|
[test_clearTimeoutIntervalNoArg.html]
|
||||||
[test_consoleEmptyStack.html]
|
[test_consoleEmptyStack.html]
|
||||||
[test_constructor-assignment.html]
|
[test_constructor-assignment.html]
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1022229
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for Bug 1022229</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
/** Test for postMessage between sandboxed iframe and non-sandboxed window.
|
||||||
|
This test is particularly interesting on b2g where we're in a mozBrowser.
|
||||||
|
|
||||||
|
We set the test up with an extra iframe so that we can easily run it in
|
||||||
|
an artificial mozbrowser for desktop builds.
|
||||||
|
**/
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
function go() {
|
||||||
|
var ifr = document.createElement('iframe');
|
||||||
|
|
||||||
|
/* Uncomment this chunk to run in a mozBrowser. Make sure to uncomment the
|
||||||
|
chunk in iframe_main as well. */
|
||||||
|
/*
|
||||||
|
SpecialPowers.Services.prefs.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
||||||
|
SpecialPowers.Services.prefs.setBoolPref("dom.ipc.browser_frames.oop_by_default", false);
|
||||||
|
SpecialPowers.addPermission("browser", true, document);
|
||||||
|
SpecialPowers.wrap(ifr).mozbrowser = true;
|
||||||
|
*/
|
||||||
|
|
||||||
|
ifr.setAttribute('src', 'iframe_main_bug1022229.html');
|
||||||
|
document.body.appendChild(ifr);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="go()">
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1022229">Mozilla Bug 1022229</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
Загрузка…
Ссылка в новой задаче