author | Blink WPT Bot <blink-w3c-test-autoroller@chromium.org> |
Wed, 27 May 2020 21:36:43 +0000 | |
changeset 533057 | 9d767e432fd5738efba8e735ec2a6b423c0aafe0 |
parent 533056 | a5e2ffab8261722c789e678ece54f36e844c05c1 |
child 533058 | 66dc5283c5b374b61bd32a772d0168a6371dc876 |
push id | 37462 |
push user | malexandru@mozilla.com |
push date | Sat, 30 May 2020 09:46:43 +0000 |
treeherder | mozilla-central@8aaca63ec5c6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | testonly |
bugs | 1639938, 23731, 2212486, 771658 |
milestone | 78.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
|
--- a/testing/web-platform/tests/feature-policy/resources/feature-policy-nested-subframe-policy.https.sub.html +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-nested-subframe-policy.https.sub.html @@ -1,18 +1,22 @@ <!DOCTYPE html> <body> <script> 'use strict'; -var same_origin_src = '/feature-policy/resources/feature-policy-allowedfeatures.html'; -var cross_origin_src = 'https://{{domains[www1]}}:{{ports[https][0]}}' + same_origin_src; -var subframe_header_policy = '?pipe=header(Feature-Policy, fullscreen '; -var policy_all = '*'; -var policy_self = '\'self\''; -var policy_none = '\'none\''; +const same_origin_src = '/feature-policy/resources/feature-policy-allowedfeatures.html'; +const cross_origin_src = 'https://{{domains[www1]}}:{{ports[https][0]}}' + same_origin_src; +const subframe_header_policy = '?pipe=header(Feature-Policy, fullscreen '; +const policy_all = '*'; +const policy_self = '\'self\''; +const policy_none = '\'none\''; + +// Messages gathered from subframes. When all subframe messages are gathered, +// it will be send back to top level frame. +const subframe_messages = []; let local_frame_all = document.createElement('iframe'); let local_frame_self = document.createElement('iframe'); let local_frame_none = document.createElement('iframe'); local_frame_all.src = same_origin_src + subframe_header_policy + policy_all + ';)'; local_frame_self.src = same_origin_src + subframe_header_policy + policy_self + ';)'; local_frame_none.src = same_origin_src + subframe_header_policy + policy_none + ';)'; @@ -20,28 +24,31 @@ let remote_frame_all = document.createEl let remote_frame_self = document.createElement('iframe'); let remote_frame_none = document.createElement('iframe'); remote_frame_all.src = cross_origin_src + subframe_header_policy + policy_all + ';)'; remote_frame_self.src = cross_origin_src + subframe_header_policy + policy_self + ';)'; remote_frame_none.src = cross_origin_src + subframe_header_policy + policy_none + ';)'; window.addEventListener('message', function(evt) { if (evt.source === local_frame_all.contentWindow) { - parent.postMessage({frame: 'local', policy: policy_all, allowedfeatures: evt.data}, '*'); + subframe_messages.push({frame: 'local', policy: policy_all, allowedfeatures: evt.data}); } else if (evt.source === local_frame_self.contentWindow) { - parent.postMessage({frame: 'local', policy: policy_self, allowedfeatures: evt.data}, '*'); + subframe_messages.push({frame: 'local', policy: policy_self, allowedfeatures: evt.data}); } else if (evt.source === local_frame_none.contentWindow) { - parent.postMessage({frame: 'local', policy: policy_none, allowedfeatures: evt.data}, '*'); + subframe_messages.push({frame: 'local', policy: policy_none, allowedfeatures: evt.data}); } else if (evt.source === remote_frame_all.contentWindow) { - parent.postMessage({frame: 'remote', policy: policy_all, allowedfeatures: evt.data}, '*'); + subframe_messages.push({frame: 'remote', policy: policy_all, allowedfeatures: evt.data}); } else if (evt.source === remote_frame_self.contentWindow) { - parent.postMessage({frame: 'remote', policy: policy_self, allowedfeatures: evt.data}, '*'); + subframe_messages.push({frame: 'remote', policy: policy_self, allowedfeatures: evt.data}); } else if (evt.source === remote_frame_none.contentWindow) { - parent.postMessage({frame: 'remote', policy: policy_none, allowedfeatures: evt.data}, '*'); + subframe_messages.push({frame: 'remote', policy: policy_none, allowedfeatures: evt.data}); } + + if (subframe_messages.length == 6) + parent.postMessage(subframe_messages, '*'); }); document.body.appendChild(local_frame_all); document.body.appendChild(local_frame_self); document.body.appendChild(local_frame_none); document.body.appendChild(remote_frame_all); document.body.appendChild(remote_frame_self); document.body.appendChild(remote_frame_none);
--- a/testing/web-platform/tests/feature-policy/resources/featurepolicy.js +++ b/testing/web-platform/tests/feature-policy/resources/featurepolicy.js @@ -349,23 +349,19 @@ function test_disallowed_feature_for_sub // test_name: name of the test. function test_subframe_header_policy( feature, frame_header_policy, src, test_expects, test_name) { let frame = document.createElement('iframe'); promise_test(function() { assert_feature_policy_supported() frame.src = src + '?pipe=sub|header(Feature-Policy,' + feature + ' ' + frame_header_policy + ';)'; - return new Promise(function(resolve, reject) { - let results = []; + return new Promise(function(resolve) { window.addEventListener('message', function handler(evt) { - results.push(evt.data); - if (results.length >= 6) { - resolve(results); - } + resolve(evt.data); }); document.body.appendChild(frame); }).then(function(results) { for (var j = 0; j < results.length; j++) { var data = results[j]; function test_result(message, test_expect) { if (test_expect) {