mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 1472042 [wpt PR 11716] - Add WindowPostMessageOptions and a new postMessage overload., a=testonly
Automatic update from web-platform-testsAdd WindowPostMessageOptions and a new postMessage overload. Add bindings code to process the options, add WPT tests to cover the cases that are special. A pull request against the HTTP Spec will be done shortly. Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/xACYBou4f9A/Ft0-QlFMAQAJ https://github.com/dtapuska/useractivation BUG=846858 Change-Id: I24f570850280e6935d43793041252312c2bfc484 Reviewed-on: https://chromium-review.googlesource.com/1118850 Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#574753} -- wpt-commits: 1bbb7050e6f33d2b3a64a763fd6405542a74dd45 wpt-pr: 11716
This commit is contained in:
parent
1c5ec12ec2
commit
18a113e1c2
@ -382408,6 +382408,72 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/broken-origin.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/broken-origin.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/host-specific-origin.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/host-specific-origin.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/invalid-args.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/invalid-args.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/message-channel-transferable.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/message-channel-transferable.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/no-target-origin.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/no-target-origin.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/null-arg-two.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/null-arg-two.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/one-arg.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/one-arg.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/slash-origin.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/slash-origin.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/two-arg.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/two-arg.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/undefined-transferable.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/undefined-transferable.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-options/unknown-parameter.tentative.html": [
|
||||
[
|
||||
"/webmessaging/with-options/unknown-parameter.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/with-ports/001.html": [
|
||||
[
|
||||
"/webmessaging/with-ports/001.html",
|
||||
@ -591480,7 +591546,7 @@
|
||||
"support"
|
||||
],
|
||||
"interfaces/html.idl": [
|
||||
"fe86c7370a537be87884d1b9da1f7b7630c6af41",
|
||||
"c9a15b7403a9517afd624c96a9ce60418afea98f",
|
||||
"support"
|
||||
],
|
||||
"interfaces/image-capture.idl": [
|
||||
@ -624691,6 +624757,50 @@
|
||||
"d2e6a16df949e553b1067f19cb6c57f3358a3a4b",
|
||||
"support"
|
||||
],
|
||||
"webmessaging/with-options/broken-origin.tentative.html": [
|
||||
"4cd25fa136ea0d934893baa94cbb02f9225283b4",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/host-specific-origin.tentative.html": [
|
||||
"3629058f06adc6e087fdb0541290ff3b2f0bd193",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/invalid-args.tentative.html": [
|
||||
"fd58b92f5031a7c853752ada170c0243de3390ce",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/message-channel-transferable.tentative.html": [
|
||||
"bb6befea5b1d6ecaaccf0c91e0667e2162211e61",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/no-target-origin.tentative.html": [
|
||||
"4488ff7e67cbb21a61c4bc10a86ce8db635381a3",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/null-arg-two.tentative.html": [
|
||||
"e267e7d0434187d68183519e771b49fb5f7e8cf0",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/one-arg.tentative.html": [
|
||||
"f6a55a9d0d178021661e52871a147e220db4a2db",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/slash-origin.tentative.html": [
|
||||
"dc13f33233bcff9b45574cd82e58587bed4e8145",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/two-arg.tentative.html": [
|
||||
"466c251aaa926ce739acd758d2b44104d8165501",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/undefined-transferable.tentative.html": [
|
||||
"bd0c1bde34600a11350b50e3030997d908276aef",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-options/unknown-parameter.tentative.html": [
|
||||
"0a80a8467e9bcfdd7f44f3e7f6884e64d785509c",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/with-ports/001.html": [
|
||||
"9ef343247f34d13b8709894fc85849c203428148",
|
||||
"testharness"
|
||||
|
@ -1550,6 +1550,7 @@ interface Window : EventTarget {
|
||||
void cancelAnimationFrame(unsigned long handle);
|
||||
|
||||
void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
|
||||
void postMessage(any message, optional sequence<object> transfer = [], optional WindowPostMessageOptions options);
|
||||
|
||||
// also has obsolete members
|
||||
};
|
||||
@ -1558,6 +1559,10 @@ Window includes WindowEventHandlers;
|
||||
|
||||
callback FrameRequestCallback = void (DOMHighResTimeStamp time);
|
||||
|
||||
dictionary WindowPostMessageOptions {
|
||||
USVString targetOrigin = "/";
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface BarProp {
|
||||
readonly attribute boolean visible;
|
||||
|
@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<title>resolving broken url</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws('SYNTAX_ERR', function() {
|
||||
postMessage('', [], {targetOrigin: 'http://foo bar'});
|
||||
}, 'should have failed to resolve');
|
||||
});
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>resolving url with stuff in host-specific</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
postMessage('', [], {targetOrigin: location.protocol + '//' + location.host + '//'});
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.origin, location.protocol + '//' + location.host);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<title>unknown parameter</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws(new TypeError, () => postMessage('', '/', {targetOrigin: 'http://example.com'}));
|
||||
});
|
||||
</script>
|
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<title>message channel as ports</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var channel = new MessageChannel();
|
||||
postMessage('', [channel.port1, channel.port2], {targetOrigin: '*'});
|
||||
onmessage = t.step_func(function(e) {
|
||||
assert_equals(e.ports.length, 2);
|
||||
t.done();
|
||||
});
|
||||
}, "MessageChannel's ports as MessagePort objects");
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>no targetOrigin</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
postMessage('', [], {});
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<title>null arg two interpreted as null string</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(t) {
|
||||
assert_throws(new SyntaxError, () => postMessage('', null));
|
||||
});
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>just one argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
postMessage('');
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>special value '/'</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
postMessage('', [], {targetOrigin: '/'});
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>two argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
postMessage('', []);
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>undefined as transferable</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
postMessage('', undefined);
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_array_equals(e.ports, []);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<title>unknown parameter</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
postMessage('', [], {someBogusParameterOnThisDictionary: 'food'});
|
||||
onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user