From 347503284f6c273bae1e0052da780f8465ecd9ba Mon Sep 17 00:00:00 2001 From: "jwalden@mit.edu" Date: Thu, 6 Mar 2008 18:32:21 -0800 Subject: [PATCH] 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 --- .../whatwg/test_postMessage_closed.html | 5 ++++ .../whatwg/test_postMessage_special.xhtml | 25 +++++-------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/dom/tests/mochitest/whatwg/test_postMessage_closed.html b/dom/tests/mochitest/whatwg/test_postMessage_closed.html index 239fa74b2ec..5820bc3650b 100644 --- a/dom/tests/mochitest/whatwg/test_postMessage_closed.html +++ b/dom/tests/mochitest/whatwg/test_postMessage_closed.html @@ -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); diff --git a/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml b/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml index f25ef63848c..ad91edf93e3 100644 --- a/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml +++ b/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml @@ -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; }