зеркало из https://github.com/mozilla/gecko-dev.git
Bug 781320 - Part 2: Tests for forwarding <iframe mozbrowser>'s name from parent to child. r=smaug
This commit is contained in:
Родитель
a1ad57f852
Коммит
7d969f5310
|
@ -72,6 +72,9 @@ MOCHITEST_FILES = \
|
|||
browserElement_TargetTop.js \
|
||||
test_browserElement_inproc_TargetTop.html \
|
||||
file_browserElement_TargetTop.html \
|
||||
browserElement_ForwardName.js \
|
||||
test_browserElement_inproc_ForwardName.html \
|
||||
file_browserElement_ForwardName.html \
|
||||
browserElement_PromptCheck.js \
|
||||
test_browserElement_inproc_PromptCheck.html \
|
||||
browserElement_PromptConfirm.js \
|
||||
|
@ -143,6 +146,7 @@ MOCHITEST_FILES += \
|
|||
test_browserElement_oop_Alert.html \
|
||||
test_browserElement_oop_AlertInFrame.html \
|
||||
test_browserElement_oop_TargetTop.html \
|
||||
test_browserElement_oop_ForwardName.html \
|
||||
test_browserElement_oop_PromptCheck.html \
|
||||
test_browserElement_oop_PromptConfirm.html \
|
||||
test_browserElement_oop_Close.html \
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 781320 - Test that the name in <iframe mozbrowser name="foo"> is
|
||||
// forwarded down to remote mozbrowsers.
|
||||
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addToWhitelist();
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
iframe.setAttribute('name', 'foo');
|
||||
|
||||
iframe.addEventListener("mozbrowseropenwindow", function(e) {
|
||||
ok(false, 'Got mozbrowseropenwindow, but should not have.');
|
||||
});
|
||||
|
||||
iframe.addEventListener('mozbrowserlocationchange', function(e) {
|
||||
ok(true, "Got locationchange to " + e.detail);
|
||||
if (e.detail.endsWith("ForwardName.html#finish")) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
|
||||
// The file sends us messages via alert() that start with "success:" or
|
||||
// "failure:".
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
ok(e.detail.message.startsWith('success:'), e.detail.message);
|
||||
});
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
// This file does window.open('file_browserElement_ForwardName.html#finish',
|
||||
// 'foo'); That should open in the curent window, because the window should
|
||||
// be named foo.
|
||||
iframe.src = 'file_browserElement_ForwardName.html';
|
||||
}
|
||||
|
||||
runTest();
|
|
@ -0,0 +1,15 @@
|
|||
<html>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
if (window.name == 'foo') {
|
||||
alert("success:window.name == 'foo'");
|
||||
}
|
||||
else {
|
||||
alert("failure:window.name == '" + window.name + "', expected 'foo'");
|
||||
}
|
||||
|
||||
window.open('file_browserElement_ForwardName.html#finish', 'foo');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 781320</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_ForwardName.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 781320</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_ForwardName.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче