Bug 1485053 [wpt PR 12597] - Add ability to send user activation context to message port and workers., a=testonly
authorDave Tapuska <dtapuska@chromium.org>
Fri, 24 Aug 2018 12:59:48 +0000
changeset 491607 8badf67b9d34e9cb458614b48305d5afe8763372
parent 491606 9bca0914a7ffa4d7a91fb4aaaec2c64fcdb7d62e
child 491608 d49ccd1e74368f946bd21f83b071213c38f0f20f
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1485053, 12597, 861735, 1183683, 585195
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webmessaging/message-channels/user-activation.tentative.html
testing/web-platform/tests/webmessaging/worker_postMessage_user_activation.js
testing/web-platform/tests/webmessaging/worker_postMessage_user_activation.tentative.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -310997,16 +310997,21 @@
      {}
     ]
    ],
    "webmessaging/without-ports/025-1.js": [
     [
      {}
     ]
    ],
+   "webmessaging/worker_postMessage_user_activation.js": [
+    [
+     {}
+    ]
+   ],
    "webmidi/META.yml": [
     [
      {}
     ]
    ],
    "webrtc-stats/META.yml": [
     [
      {}
@@ -396734,16 +396739,22 @@
     ]
    ],
    "webmessaging/message-channels/dictionary-transferrable.html": [
     [
      "/webmessaging/message-channels/dictionary-transferrable.html",
      {}
     ]
    ],
+   "webmessaging/message-channels/user-activation.tentative.html": [
+    [
+     "/webmessaging/message-channels/user-activation.tentative.html",
+     {}
+    ]
+   ],
    "webmessaging/message-channels/worker.html": [
     [
      "/webmessaging/message-channels/worker.html",
      {}
     ]
    ],
    "webmessaging/messageerror.html": [
     [
@@ -397202,16 +397213,22 @@
     ]
    ],
    "webmessaging/without-ports/029.html": [
     [
      "/webmessaging/without-ports/029.html",
      {}
     ]
    ],
+   "webmessaging/worker_postMessage_user_activation.tentative.html": [
+    [
+     "/webmessaging/worker_postMessage_user_activation.tentative.html",
+     {}
+    ]
+   ],
    "webmidi/idlharness.window.js": [
     [
      "/webmidi/idlharness.window.html",
      {}
     ]
    ],
    "webrtc-stats/idlharness.window.js": [
     [
@@ -649691,16 +649708,20 @@
   "webmessaging/message-channels/close.html": [
    "d975ea728327d95def65af0e5875a16dfdfa0289",
    "testharness"
   ],
   "webmessaging/message-channels/dictionary-transferrable.html": [
    "f7ab1086f7e7978f00a4901d7aa47d8675ee1373",
    "testharness"
   ],
+  "webmessaging/message-channels/user-activation.tentative.html": [
+   "2c79be8a298aa73ae20bb7898d8dd34d0d56b000",
+   "testharness"
+  ],
   "webmessaging/message-channels/worker.html": [
    "0502021fff138a29b5bd815c589d0f556922db9b",
    "testharness"
   ],
   "webmessaging/messageerror.html": [
    "2cb51ee3c06c366529f66815587cef455e267666",
    "testharness"
   ],
@@ -650023,16 +650044,24 @@
   "webmessaging/without-ports/028.html": [
    "d51ad7d3b690d5bf852ae95365953c5479cc7a7f",
    "testharness"
   ],
   "webmessaging/without-ports/029.html": [
    "4b1b38f741c940bf0396b28912dcb4fb4902e393",
    "testharness"
   ],
+  "webmessaging/worker_postMessage_user_activation.js": [
+   "e4c7eec2b783abd16a898bf2bf89a329a0aadb81",
+   "support"
+  ],
+  "webmessaging/worker_postMessage_user_activation.tentative.html": [
+   "203bb149857be5ad8185516a89b1e98d7f2373a0",
+   "testharness"
+  ],
   "webmidi/META.yml": [
    "f39d4122887ba252516b12f98caaa08e84b3eb34",
    "support"
   ],
   "webmidi/idlharness.window.js": [
    "5fb88073b169cfac1d8353e5e8416bdd46ceab0e",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webmessaging/message-channels/user-activation.tentative.html
@@ -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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webmessaging/worker_postMessage_user_activation.js
@@ -0,0 +1,3 @@
+"use strict";
+
+onmessage = e => postMessage(e.userActivation !== null);
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webmessaging/worker_postMessage_user_activation.tentative.html
@@ -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>