mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1485053 [wpt PR 12597] - Add ability to send user activation context to message port and workers., a=testonly
Automatic update from web-platform-testsAdd ability to send user activation context to message port and workers. As per the latest update to https://github.com/dtapuska/useractivation exposing the UserActivation on the MessagePort was needed. So this adds the code and a few tests. BUG=861735 Change-Id: I3439b67c75e53666243a2ec36d8d93e6c23de5b4 Reviewed-on: https://chromium-review.googlesource.com/1183683 Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Reviewed-by: Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#585195} -- wpt-commits: a8cc1649096f1ecf9adf9ab3a92c7c229435637e wpt-pr: 12597
This commit is contained in:
parent
c0f80cdf29
commit
ce921608b7
@ -311002,6 +311002,11 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/worker_postMessage_user_activation.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmidi/META.yml": [
|
||||
[
|
||||
{}
|
||||
@ -396739,6 +396744,12 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/message-channels/user-activation.tentative.html": [
|
||||
[
|
||||
"/webmessaging/message-channels/user-activation.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/message-channels/worker.html": [
|
||||
[
|
||||
"/webmessaging/message-channels/worker.html",
|
||||
@ -397207,6 +397218,12 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmessaging/worker_postMessage_user_activation.tentative.html": [
|
||||
[
|
||||
"/webmessaging/worker_postMessage_user_activation.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webmidi/idlharness.window.js": [
|
||||
[
|
||||
"/webmidi/idlharness.window.html",
|
||||
@ -649696,6 +649713,10 @@
|
||||
"f7ab1086f7e7978f00a4901d7aa47d8675ee1373",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/message-channels/user-activation.tentative.html": [
|
||||
"2c79be8a298aa73ae20bb7898d8dd34d0d56b000",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/message-channels/worker.html": [
|
||||
"0502021fff138a29b5bd815c589d0f556922db9b",
|
||||
"testharness"
|
||||
@ -650028,6 +650049,14 @@
|
||||
"4b1b38f741c940bf0396b28912dcb4fb4902e393",
|
||||
"testharness"
|
||||
],
|
||||
"webmessaging/worker_postMessage_user_activation.js": [
|
||||
"e4c7eec2b783abd16a898bf2bf89a329a0aadb81",
|
||||
"support"
|
||||
],
|
||||
"webmessaging/worker_postMessage_user_activation.tentative.html": [
|
||||
"203bb149857be5ad8185516a89b1e98d7f2373a0",
|
||||
"testharness"
|
||||
],
|
||||
"webmidi/META.yml": [
|
||||
"f39d4122887ba252516b12f98caaa08e84b3eb34",
|
||||
"support"
|
||||
|
@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<title>user activation messagechannel test</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();
|
||||
channel.port1.postMessage(1, {includeUserActivation: true});
|
||||
channel.port1.postMessage(2);
|
||||
var expected_data = 1;
|
||||
channel.port2.onmessage = t.step_func(
|
||||
function(e) {
|
||||
assert_equals(e.data, expected_data);
|
||||
expected_data++;
|
||||
if (e.data == 1) {
|
||||
assert_false(e.userActivation.isActive);
|
||||
assert_false(e.userActivation.hasBeenActive);
|
||||
} else {
|
||||
assert_equals(e.userActivation, null);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
channel.port2.start();
|
||||
});
|
||||
</script>
|
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
onmessage = e => postMessage(e.userActivation !== null);
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<title>postMessage with user activtion to a worker</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
promise_test(async t => {
|
||||
var worker = new Worker("worker_postMessage_user_activation.js");
|
||||
let workerReply = () => new Promise((resolve, reject) => {
|
||||
worker.addEventListener('message', e => resolve(e.data), {once: true});
|
||||
});
|
||||
worker.postMessage(null, {includeUserActivation: true});
|
||||
assert_equals(await workerReply(), true);
|
||||
worker.postMessage(null, {includeUserActivation: false});
|
||||
assert_equals(await workerReply(), false);
|
||||
}, "Post Message from a worker");
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user