зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d2505c0f1c45 (bug 860941)
This commit is contained in:
Родитель
952cea0245
Коммит
68d837546f
|
@ -8,8 +8,8 @@ if (location.toString().match(/^http:\/\/mochi.test:8888/)) {
|
|||
opener.is(window.dialogArguments, "my args",
|
||||
"dialog did not get the right arguments.");
|
||||
|
||||
// Load a different url, and test that it sees the arguments (since it's same origin).
|
||||
window.location="data:text/html,<html><body onload=\"opener.is(window.dialogArguments, 'my args', 'subsequent dialog document did not get the right arguments.'); close();\">';";
|
||||
// Load a different url, and test that it doesn't see the arguments.
|
||||
window.location="data:text/html,<html><body onload=\"opener.is(window.dialogArguments, null, 'subsequent dialog document did not get the right arguments.'); close();\">';";
|
||||
} else {
|
||||
// Post a message containing our arguments to the opener to test
|
||||
// that this cross origing dialog does *not* see the passed in
|
||||
|
|
|
@ -2,34 +2,18 @@
|
|||
<html>
|
||||
<head>
|
||||
<script>
|
||||
ok = window.opener.ok;
|
||||
is = window.opener.is;
|
||||
SpecialPowers = window.opener.SpecialPowers;
|
||||
function go() {
|
||||
is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity");
|
||||
is(SpecialPowers.Cu.getClassName(window, /* aUnwrap = */ true), "ModalContentWindow", "We are modal");
|
||||
var iwin = document.getElementById('ifr').contentWindow;
|
||||
is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal");
|
||||
|
||||
if (location.origin != "http://mochi.test:8888") {
|
||||
is(window.dialogArguments, undefined,
|
||||
"dialogArguments should be undefined cross-origin: " + location.origin);
|
||||
}
|
||||
|
||||
window.returnValue = "rv: " + window.dialogArguments;
|
||||
|
||||
// Allow for testing navigations in series.
|
||||
if (location.search == "") {
|
||||
window.close();
|
||||
} else {
|
||||
var origins = location.search.split('?')[1].split(',');
|
||||
var newsearch = '?' + origins.splice(1).join(',');
|
||||
var newurl = location.toString().replace(location.origin, origins[0])
|
||||
.replace(location.search, newsearch);
|
||||
location = newurl;
|
||||
}
|
||||
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="opener.postMessage('dosetup', '*');">
|
||||
<body onload="go();">
|
||||
<iframe id="ifr"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,39 +10,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=862918
|
|||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
// This will be fixed in bug 860941.
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
|
||||
/** Test for window.showModalDialog. **/
|
||||
window.showModalDialog('file_showModalDialog.html');
|
||||
|
||||
// The modal window needs to touch Cu, which means that it needs
|
||||
// SpecialPowers. But given the semantics of modal windows, we have to
|
||||
// do some funny stuff with postMessage to set this up.
|
||||
window.onmessage = function(evt) {
|
||||
is(evt.data, 'dosetup', "message from modal window is correct");
|
||||
var win = SpecialPowers.wrap(evt.source);
|
||||
win.wrappedJSObject.SpecialPowers = SpecialPowers;
|
||||
win.wrappedJSObject.is = is;
|
||||
win.wrappedJSObject.ok = ok;
|
||||
win.wrappedJSObject.go();
|
||||
};
|
||||
|
||||
var someObj = { foo: 42, bar: "hi"};
|
||||
var xurl = location.toString()
|
||||
.replace('mochi.test:8888', 'example.org')
|
||||
.replace('test_showModal', 'file_showModal');
|
||||
xurl = xurl.substring(0, xurl.indexOf('?'));
|
||||
is(showModalDialog('file_showModalDialog.html'), "rv: undefined");
|
||||
is(showModalDialog(xurl), undefined);
|
||||
is(showModalDialog('file_showModalDialog.html', 3), "rv: 3");
|
||||
is(showModalDialog(xurl, 3), undefined);
|
||||
is(showModalDialog('file_showModalDialog.html', someObj), "rv: " + someObj);
|
||||
is(showModalDialog(xurl, someObj), undefined);
|
||||
|
||||
// Test sequential navigations.
|
||||
is(showModalDialog('file_showModalDialog.html?http://mochi.test:8888', 4),
|
||||
'rv: 4');
|
||||
is(showModalDialog('file_showModalDialog.html?http://example.com', 4), undefined);
|
||||
is(showModalDialog('file_showModalDialog.html?http://example.com,http://mochi.test:8888', 4), 'rv: 4');
|
||||
|
||||
// This test used to assert after gc. Make sure it doesn't.
|
||||
// Blame mArguments assertion on this test.
|
||||
SpecialPowers.gc();
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче