Make one test that relies on popup blocking being disabled fail quickly if popup blocking is enabled, and make another test non-Mozilla-specific because HTML5 got updated and now matches our behavior with respect to the origin of data: URIs (they have the origin of the window/script that opened them). rs=sicking

This commit is contained in:
jwalden@mit.edu 2008-03-06 18:32:21 -08:00
parent f3635c2f44
commit 347503284f
2 changed files with 11 additions and 19 deletions

View File

@ -64,6 +64,11 @@ var openedWindow;
function run()
{
openedWindow = window.open("postMessage_closed_helper.html?opener", "foobar");
if (!openedWindow)
{
ok(false, "this test must be run with popup blocking disabled");
SimpleTest.finish();
}
}
window.addEventListener("load", run, false);

View File

@ -143,25 +143,12 @@ function messageReceiver(evt)
}
else if (evt.data === "data-response")
{
// Again, HTML5 hasn't yet defined this, but we're going to do the same
// thing as with about:blank -- for a data: URL opened from page A, the
// uri and domain properties correspond to those of page A. This happens
// to fall out naturally from using the window's security principal to
// determine these two properties.
//
// Mozilla currently gives data: URLs the principal of the opener/parent
// window, and at least for now we'll test for that behavior. If we ever
// change how data: URLs are given principals, we can update this test
// then.
if (isMozilla)
{
is(evt.origin, "http://localhost:8888",
"wrong origin for event from data URL (but note that this URI is " +
"the result of Mozilla's current policy that data: URLs inherit " +
"the principal of their opener/parent, a policy not currently " +
"specified by any standards)");
}
// HTML5 defines the origin of a data: URI as the origin of the window or
// script that opened the data: URI.
is(evt.origin, "http://localhost:8888",
"wrong origin for event from data URL (should be the origin of the " +
"window/script that opened the URL, in this case the origin of this " +
"file)");
is(evt.source, dataWindow, "wrong source");
dataResponseReceived = true;
}