Commit 6cbc117e authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

[COOP] Access reporting [11/N] Fix wrong accessing context used.

There are 3 function to get a DomWindow from an isolate:
- LocalDOMWindow* EnteredDOMWindow(v8::Isolate*);
- LocalDOMWindow* IncumbentDOMWindow(v8::Isolate*);
- LocalDOMWindow* CurrentDOMWindow(v8::Isolate*);

The difference is explained by:
third_party/blink/renderer/bindings/core/v8/V8BindingDesign.md

For same-origin accesses to a window's method, the wrong V8 context was
used. Instead of being the "calling" context, it was the "called"
context.

Using IncumbentDomWindow instead of CurrentDOMWindow fixed the issue.
See response from:
https://bugs.chromium.org/p/chromium/issues/detail?id=1109153#c2

COOP access reporting:
[ 1/N] https://chromium-review.googlesource.com/c/chromium/src/+/2264294
[ 2/N] https://chromium-review.googlesource.com/c/chromium/src/+/2270185
[ 3/N] https://chromium-review.googlesource.com/c/chromium/src/+/2270472
[ 4/N] https://chromium-review.googlesource.com/c/chromium/src/+/2273120
[ 5/N] https://chromium-review.googlesource.com/c/chromium/src/+/2309433
[ 6/N] https://chromium-review.googlesource.com/c/chromium/src/+/2308715
[ 7/N] https://chromium-review.googlesource.com/c/chromium/src/+/2309697
[ 8/N] https://chromium-review.googlesource.com/c/chromium/src/+/2275889
[ 9/N] https://chromium-review.googlesource.com/c/chromium/src/+/2310530
[10/N] https://chromium-review.googlesource.com/c/chromium/src/+/2315024
[11/N] this patch.

Bug: 1090273
Change-Id: I3da021c33af25831a242f64ff732556aa6775a46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2323250Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792671}
parent 34d4eecd
......@@ -450,7 +450,7 @@ void DOMWindow::ReportCoopAccess(v8::Isolate* isolate,
if (coop_access_monitor_.IsEmpty()) // Fast early return. Very likely true.
return;
DOMWindow* accessing_window = CurrentDOMWindow(isolate);
LocalDOMWindow* accessing_window = IncumbentDOMWindow(isolate);
Frame* accessing_frame = accessing_window->GetFrame();
// A frame might be destroyed, but its context can still be able to execute
......
This is a testharness.js-based test.
FAIL Opener (COOP-RO+COEP) accesses openee. Report to opener assert_not_equals: Report not received got disallowed value "timeout"
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Openee accesses opener (COOP-RO-COEP). Report to opener assert_not_equals: Report not received got disallowed value "timeout"
Harness: the test ran to completion.
......@@ -16,10 +16,10 @@ PASS cross-origin > w => w.postMessage("", "")
PASS cross-origin > w => w.self
PASS cross-origin > w => w.top
PASS cross-origin > w => w.window
FAIL same-site > w => w.blur() assert_not_equals: Report not received got disallowed value "timeout"
FAIL same-site > w => w.close() assert_not_equals: Report not received got disallowed value "timeout"
PASS same-site > w => w.blur()
PASS same-site > w => w.close()
PASS same-site > w => w.closed
FAIL same-site > w => w.focus() assert_not_equals: Report not received got disallowed value "timeout"
PASS same-site > w => w.focus()
PASS same-site > w => w.frames
FAIL same-site > w => w[0] assert_not_equals: Report not received got disallowed value "timeout"
PASS same-site > w => w.length
......@@ -28,8 +28,8 @@ PASS same-site > w => w.location = "#"
FAIL same-site > w => w["test"] assert_not_equals: Report not received got disallowed value "timeout"
PASS same-site > w => w.opener
PASS same-site > w => w.opener = ""
FAIL same-site > w => w.postMessage("") assert_not_equals: Report not received got disallowed value "timeout"
FAIL same-site > w => w.postMessage("", "") assert_not_equals: Report not received got disallowed value "timeout"
PASS same-site > w => w.postMessage("")
PASS same-site > w => w.postMessage("", "")
PASS same-site > w => w.self
PASS same-site > w => w.top
FAIL same-site > w => w.window assert_not_equals: Report not received got disallowed value "timeout"
......
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