Implement Window.postMessage for same-origin windows.

This commit is contained in:
Josh Matthews 2016-05-12 14:04:08 -04:00 committed by Ms2ger
parent 1837fcbedd
commit f152bc3b06
83 changed files with 192 additions and 383 deletions

View file

@ -1,6 +0,0 @@
[xmlhttprequest-sync-block-defer-scripts.html]
type: testharness
expected: TIMEOUT
[Check that a sync XHR in a defer script blocks later defer scripts from running]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[xmlhttprequest-sync-not-hang-scriptloader.html]
type: testharness
expected: TIMEOUT
[Ensure that an async script added during a defer script that then does a\n sync XHR still runs]
expected: NOTRUN

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-aborted.html]
type: testharness
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-abortedonmain.html]
type: testharness
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-overrides.html]
type: testharness
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-overridesexpires.html]
type: testharness
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-simple.html]
type: testharness
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-synconmain.html]
type: testharness
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[xmlhttprequest-timeout-twice.html]
type: testharness
expected: TIMEOUT

View file

@ -1,6 +1,5 @@
[headers-structure.html]
type: testharness
expected: OK
[Headers has entries method]
expected: FAIL

View file

@ -1,6 +0,0 @@
[001.html]
type: testharness
expected: TIMEOUT
[Cross-origin navigation started from unload handler]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[002.html]
type: testharness
expected: TIMEOUT
[Multiple simultaneous navigations]
expected: TIMEOUT

View file

@ -2,5 +2,5 @@
type: testharness
expected: TIMEOUT
[Navigation from unload whilst traversing history]
expected: NOTRUN
expected: TIMEOUT

View file

@ -2,5 +2,5 @@
type: testharness
expected: TIMEOUT
[Navigation from unload whilst traversing cross-origin history]
expected: NOTRUN
expected: TIMEOUT

View file

@ -2,5 +2,5 @@
type: testharness
expected: TIMEOUT
[Child document navigating parent via location ]
expected: NOTRUN
expected: TIMEOUT

View file

@ -2,5 +2,5 @@
type: testharness
expected: TIMEOUT
[Child document navigating parent via submit ]
expected: NOTRUN
expected: TIMEOUT

View file

@ -1,6 +1,5 @@
[navigation_unload_same_origin.html]
type: testharness
expected: TIMEOUT
[Same-origin navigation started from unload handler]
expected: TIMEOUT
expected: FAIL

View file

@ -2,5 +2,5 @@
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: NOTRUN
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[insecure-protocol.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[insecure-protocol.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[insecure-protocol.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[insecure-protocol.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[insecure-protocol.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[insecure-protocol.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +1,5 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is origin when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +1,5 @@
[same-origin-insecure.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[same-origin-insecure.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +0,0 @@
[same-origin-insecure.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-csp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cross-origin.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[same-origin-insecure.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via script-tag using the meta-referrer\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.keep-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.no-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with no-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[generic.swap-origin-redirect.http.html]
type: testharness
expected: TIMEOUT
[The referrer URL is stripped-referrer when a\n document served over http requires an http\n sub-resource via script-tag using the http-rp\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
expected: NOTRUN

View file

@ -9102,6 +9102,12 @@
"url": "/_mozilla/mozilla/websocket_connection_fail.html"
}
],
"mozilla/window-postmessage-sameorigin.html": [
{
"path": "mozilla/window-postmessage-sameorigin.html",
"url": "/_mozilla/mozilla/window-postmessage-sameorigin.html"
}
],
"mozilla/window.html": [
{
"path": "mozilla/window.html",

View file

@ -0,0 +1,80 @@
<!doctype html>
<meta charset="utf-8">
<title>Same-origin postMessage on the Window object</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/origin_helpers.js?pipe=sub"></script>
<script>
setup({
explicit_done: true
});
function expect_error(error, message, origin, description) {
return function(setlistener, removelistener, type) {
test(function(t) {
assert_throws(error, function() { postMessage(message, origin) });
}, description + ' (' + type + ')');
}
}
function expect_message(message, origin, test) {
return function(setlistener, removelistener, type) {
async_test(function(t) {
setlistener(t.step_func_done(function(e) {
removelistener(arguments.callee);
assert_true(e.isTrusted);
assert_equals(e.data, message);
}));
postMessage(message, origin);
}, test + ' (' + type + ')');
}
}
function expect_no_message(message, origin, test) {
return function(setlistener, removelistener, type) {
async_test(function(t) {
setlistener(t.step_func_done(function(e) {
removelistener(arguments.callee);
assert_equals(e.data, 'expected-sequencing-message');
}));
postMessage(message, origin);
postMessage('expected-sequencing-message', '*');
}, test + ' (' + type + ')');
}
}
var base_tests = [
function() { return expect_message('basic', '*', 'any origin, cloneable string message') },
function() { return expect_message('basic', '/', 'same origin, cloneable string message') },
function() { return expect_message('basic', HTTP_ORIGIN, 'explicit same origin, cloneable string message') },
function() { return expect_no_message('basic', HTTPS_ORIGIN, 'explicit cross origin, cloneable string message') },
function() { return expect_error(new SyntaxError(), 'basic', 'not-a-url', 'explicit invalid url, cloneable string message') },
function() { return expect_error('DATA_CLONE_ERR', window, '*', 'any origin, non-cloneable message') },
];
var tests = [];
var add_handler = function(listener) { window.onmessage = listener; };
var remove_handler = function(listener) { window.onmessage = null; };
var remove_listener = function(listener) { window.removeEventListener('message', listener); }
var add_listener = function(listener) { window.addEventListener('message', listener); };
for (var i = 0; i < base_tests.length; i++) {
var f = base_tests[i]();
tests.push(f.bind(window, add_listener, remove_listener, "listener"));
tests.push(f.bind(window, add_handler, remove_handler, "handler"));
}
var current_test = 0;
function next_test() {
if (current_test < tests.length) {
tests[current_test++]();
} else {
done();
}
}
add_result_callback(function() {
next_test();
});
next_test();
</script>