Commit ff3e4ac8 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Make 2 tests immune to legitimate races between cross-origin subframes

Bug: 820589
Change-Id: I16c02746c61f42fafead5f96ae436b331fba4f85
Reviewed-on: https://chromium-review.googlesource.com/957587
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542360}
parent 7a78fab4
...@@ -142,8 +142,6 @@ Bug(none) external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-m ...@@ -142,8 +142,6 @@ Bug(none) external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-m
Bug(none) external/wpt/fullscreen/api/element-ready-check-not-allowed-cross-origin-manual.sub.html [ Failure ] Bug(none) external/wpt/fullscreen/api/element-ready-check-not-allowed-cross-origin-manual.sub.html [ Failure ]
Bug(none) external/wpt/html/browsers/browsing-the-web/navigating-across-documents/004.html [ Timeout ] Bug(none) external/wpt/html/browsers/browsing-the-web/navigating-across-documents/004.html [ Timeout ]
Bug(none) external/wpt/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Failure ] Bug(none) external/wpt/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Failure ]
Bug(none) external/wpt/webmessaging/event.origin.sub.htm [ Failure ]
Bug(none) external/wpt/webmessaging/postMessage_asterisk_xorigin.sub.htm [ Failure ]
Bug(none) storage/indexeddb/blob-valid-before-commit.html [ Failure ] Bug(none) storage/indexeddb/blob-valid-before-commit.html [ Failure ]
Bug(none) virtual/outofblink-cors/external/wpt/fetch/api/basic/keepalive.html [ Timeout ] Bug(none) virtual/outofblink-cors/external/wpt/fetch/api/basic/keepalive.html [ Timeout ]
......
...@@ -42,13 +42,23 @@ ...@@ -42,13 +42,23 @@
window.onmessage = t.step_func(function(e) window.onmessage = t.step_func(function(e)
{ {
// testharness.js uses postMessage so we must check what data we want to receive // Messages from TARGET1 and TARGET2 can come in any order
if (e.data.toString() === "#1" || e.data.toString() === "#2") { // (since one of them is cross-origin and can run in parallel).
ActualResult.push(e.data, e.origin); // To make the tests immune to message reordering, always
if (ActualResult.length === ExpectedResult.length) { // put the response from TARGET1 at the start of the list.
assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); if (e.data.toString() === "#1")
t.done(); {
} ActualResult = [e.data, e.origin].concat(ActualResult);
}
else if (e.data.toString() === "#2")
{
ActualResult = ActualResult.concat([e.data, e.origin]);
}
if (ActualResult.length >= ExpectedResult.length)
{
assert_array_equals(ActualResult, ExpectedResult, "ActualResult");
t.done();
} }
}); });
</script> </script>
......
...@@ -42,7 +42,18 @@ ...@@ -42,7 +42,18 @@
window.onmessage = t.step_func(function(e) window.onmessage = t.step_func(function(e)
{ {
ActualResult.push(e.data, e.origin); // Messages from TARGET1 and TARGET2 can come in any order
// (since one of them is cross-origin and can run in parallel).
// To make the tests immune to message reordering, always
// put the response from TARGET1 at the start of the list.
if (e.data.toString() === "#1")
{
ActualResult = [e.data, e.origin].concat(ActualResult);
}
else if (e.data.toString() === "#2")
{
ActualResult = ActualResult.concat([e.data, e.origin]);
}
if (ActualResult.length >= ExpectedResult.length) if (ActualResult.length >= ExpectedResult.length)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment