From 5bbe2a305de0e9dabff0fed4c4a347de657e35be Mon Sep 17 00:00:00 2001 From: Antonio Sartori Date: Thu, 22 Apr 2021 09:30:36 +0000 Subject: [PATCH] Fix web test for SAB devtools issue The SharedArrayBuffer constructor is not exposed anymore in non cross-origin-isolated contexts. Trying to use it throws, instead of raising a warning. For creating a SharedArrayBuffer and testing the devtools issue, we need to use the trick from https://github.com/whatwg/html/issues/5380. Bug: 1194226 Change-Id: I622e5857af4de89e726aadc3731bc5a0df0e91f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2843329 Commit-Queue: Antonio Sartori Reviewed-by: Sigurd Schneider Cr-Commit-Position: refs/heads/master@{#875074} --- third_party/blink/web_tests/TestExpectations | 2 - .../issues/sab-creation-issue-expected.txt | 2 +- .../issues/sab-creation-issue.js | 4 +- .../issues/sab-postMessage-issue-expected.txt | 4 +- .../issues/sab-postMessage-issue.js | 3 +- .../issues/sab-postMessage-issue-expected.txt | 37 +++++++++++++++++++ .../issues/sab-postMessage-issue-expected.txt | 37 +++++++++++++++++++ 7 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 third_party/blink/web_tests/virtual/shared_array_buffer_on_desktop/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt create mode 100644 third_party/blink/web_tests/virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 8789d8c91580d0..25d70296a79b9f 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations @@ -4989,8 +4989,6 @@ crbug.com/1194557 http/tests/devtools/local-object-properties-section.js [ Failu crbug.com/1194557 http/tests/devtools/application-panel/resources-panel-resource-preview.js [ Failure Timeout ] crbug.com/1194557 http/tests/devtools/sources/debugger-breakpoints/set-breakpoint-while-blocking-main-thread.js [ Failure Timeout ] crbug.com/1194557 http/tests/devtools/unit/object-properties-expand-recursively.js [ Failure Timeout ] -crbug.com/1194557 http/tests/inspector-protocol/issues/sab-creation-issue.js [ Failure Timeout ] -crbug.com/1194557 http/tests/inspector-protocol/issues/sab-postMessage-issue.js [ Failure Timeout ] crbug.com/1194557 http/tests/websocket/send-arraybufferview.html [ Failure Timeout ] crbug.com/1194557 storage/indexeddb/shared-array-buffer-throws.html [ Failure Timeout ] crbug.com/1194557 virtual/shared_array_buffer_on_desktop/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-subdomain-yes-2-subdomain2-no.sub.https.html [ Failure Timeout ] diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue-expected.txt index 7c4dd89b0eb869..25d0a6c8ca83b8 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue-expected.txt @@ -7,7 +7,7 @@ Inspector issue: { sharedArrayBufferIssueDetails : { isWarning : true sourceCodeLocation : { - columnNumber : 9 + columnNumber : 14 lineNumber : 0 scriptId : url : diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue.js b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue.js index ce90e134fe5932..364d9c48e7a859 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-creation-issue.js @@ -4,7 +4,9 @@ `Verifies that creating a SAB in a non-COI context causes an issue.\n`); await dp.Audits.enable(); - session.evaluate(`var x = new SharedArrayBuffer();`); + session.evaluate( + `var x = new (new WebAssembly.Memory( + { shared:true, initial:0, maximum:0 }).buffer.constructor)();`); const issue = await dp.Audits.onceIssueAdded(); testRunner.log(issue.params, 'Inspector issue: '); diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt index 63e16f6baf4b8a..5029e3ac85dcaa 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt @@ -7,7 +7,7 @@ Creation issue: { sharedArrayBufferIssueDetails : { isWarning : true sourceCodeLocation : { - columnNumber : 13 + columnNumber : 18 lineNumber : 0 scriptId : url : @@ -22,7 +22,7 @@ Transfer issue: { code : SharedArrayBufferIssue details : { sharedArrayBufferIssueDetails : { - isWarning : true + isWarning : false sourceCodeLocation : { columnNumber : 1 lineNumber : 0 diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue.js b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue.js index ff47ec1cb87a42..1e5599250455a4 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/sab-postMessage-issue.js @@ -4,7 +4,8 @@ `Verifies that post-messaging a SAB causes an issue.\n`); await dp.Audits.enable(); - session.evaluate(`postMessage(new SharedArrayBuffer());`); + session.evaluate(`postMessage(new (new WebAssembly.Memory( + { shared:true, initial:0, maximum:0 }).buffer.constructor)());`); const issues = await Promise.all( [dp.Audits.onceIssueAdded(), dp.Audits.onceIssueAdded()]); diff --git a/third_party/blink/web_tests/virtual/shared_array_buffer_on_desktop/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt b/third_party/blink/web_tests/virtual/shared_array_buffer_on_desktop/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt new file mode 100644 index 00000000000000..fc82b5673d7eac --- /dev/null +++ b/third_party/blink/web_tests/virtual/shared_array_buffer_on_desktop/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt @@ -0,0 +1,37 @@ +Verifies that post-messaging a SAB causes an issue. + +Creation issue: { + issue : { + code : SharedArrayBufferIssue + details : { + sharedArrayBufferIssueDetails : { + isWarning : true + sourceCodeLocation : { + columnNumber : 18 + lineNumber : 0 + scriptId : + url : + } + type : CreationIssue + } + } + } +} +Transfer issue: { + issue : { + code : SharedArrayBufferIssue + details : { + sharedArrayBufferIssueDetails : { + isWarning : true + sourceCodeLocation : { + columnNumber : 1 + lineNumber : 0 + scriptId : + url : + } + type : TransferIssue + } + } + } +} + diff --git a/third_party/blink/web_tests/virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt b/third_party/blink/web_tests/virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt new file mode 100644 index 00000000000000..fc82b5673d7eac --- /dev/null +++ b/third_party/blink/web_tests/virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/sab-postMessage-issue-expected.txt @@ -0,0 +1,37 @@ +Verifies that post-messaging a SAB causes an issue. + +Creation issue: { + issue : { + code : SharedArrayBufferIssue + details : { + sharedArrayBufferIssueDetails : { + isWarning : true + sourceCodeLocation : { + columnNumber : 18 + lineNumber : 0 + scriptId : + url : + } + type : CreationIssue + } + } + } +} +Transfer issue: { + issue : { + code : SharedArrayBufferIssue + details : { + sharedArrayBufferIssueDetails : { + isWarning : true + sourceCodeLocation : { + columnNumber : 1 + lineNumber : 0 + scriptId : + url : + } + type : TransferIssue + } + } + } +} +