Commit 9433a2df authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

[COOP] access reporting: Remove "isolate" argument.

I was suggested the "isolate" argument of ReportCoopAccess could be
determined by the DomWindow instance itself:
https://chromium-review.googlesource.com/c/chromium/src/+/2339353/4

This patch removes it from the ReportCoopAccess method and updates the
callers.

Bug: 1090273
Change-Id: I0286f13ea8700c419728f89f706baf71bb0f0642
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346569
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796842}
parent 703febc0
......@@ -65,11 +65,9 @@ namespace blink {
template <typename CallbackInfo>
static void LocationAttributeGet(const CallbackInfo& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> holder = info.Holder();
DOMWindow* window = V8Window::ToImpl(holder);
window->ReportCoopAccess(isolate, "location");
window->ReportCoopAccess("location");
Location* location = window->location();
DCHECK(location);
......@@ -77,6 +75,7 @@ static void LocationAttributeGet(const CallbackInfo& info) {
if (DOMDataStore::SetReturnValue(info.GetReturnValue(), location))
return;
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Value> wrapper;
// Note that this check is gated on whether or not |window| is remote, not
......@@ -141,9 +140,8 @@ void V8Window::FrameElementAttributeGetterCustom(
template <typename CallbackInfo>
static void OpenerAttributeSet(v8::Local<v8::Value> value,
const CallbackInfo& info) {
v8::Isolate* isolate = info.GetIsolate();
DOMWindow* impl = V8Window::ToImpl(info.Holder());
impl->ReportCoopAccess(isolate, "opener");
impl->ReportCoopAccess("opener");
if (!impl->GetFrame())
return;
......@@ -157,6 +155,7 @@ static void OpenerAttributeSet(v8::Local<v8::Value> value,
To<LocalFrame>(impl->GetFrame())->Loader().SetOpener(nullptr);
}
v8::Isolate* isolate = info.GetIsolate();
// Delete the accessor from the inner object.
if (info.Holder()
->Delete(isolate->GetCurrentContext(),
......@@ -210,7 +209,7 @@ void V8Window::NamedPropertyGetterCustom(
// https://html.spec.whatwg.org/C/#document-tree-child-browsing-context-name-property-set
Frame* child = frame->Tree().ScopedChild(name);
if (child) {
window->ReportCoopAccess(info.GetIsolate(), "named");
window->ReportCoopAccess("named");
UseCounter::Count(CurrentExecutionContext(info.GetIsolate()),
WebFeature::kNamedAccessOnWindow_ChildBrowsingContext);
......@@ -271,7 +270,7 @@ void V8Window::NamedPropertyGetterCustom(
if (!has_named_item && !has_id_item)
return;
window->ReportCoopAccess(info.GetIsolate(), "named");
window->ReportCoopAccess("named");
if (!has_named_item && has_id_item &&
!doc->ContainsMultipleElementsWithId(name)) {
......
......@@ -70,7 +70,7 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% endif %}{# not attribute.is_static #}
{% if interface_name == "Window" and attribute.has_cross_origin_getter %}
impl->ReportCoopAccess(info.GetIsolate(), "{{attribute.name}}");
impl->ReportCoopAccess("{{attribute.name}}");
{% endif %}
{% if attribute.cached_attribute_validation_method %}
......
......@@ -55,7 +55,7 @@ static void {{method.camel_case_name}}{{method.overload_index}}Method{{world_suf
{% endif %}{# not method.is_static #}
{% if interface_name == "Window" and method.is_cross_origin %}
impl->ReportCoopAccess(info.GetIsolate(), "{{method.name}}");
impl->ReportCoopAccess("{{method.name}}");
{% endif %}
{# Security checks #}
......
......@@ -166,7 +166,7 @@ void DOMWindow::postMessage(v8::Isolate* isolate,
}
DOMWindow* DOMWindow::AnonymousIndexedGetter(uint32_t index) {
ReportCoopAccess(window_proxy_manager_->GetIsolate(), "indexed");
ReportCoopAccess("indexed");
if (!GetFrame())
return nullptr;
......@@ -450,11 +450,11 @@ void DOMWindow::InstallCoopAccessMonitor(
// Check if the accessing context would be able to access this window if COOP
// was enforced. If this isn't a report is sent.
void DOMWindow::ReportCoopAccess(v8::Isolate* isolate,
const char* property_name) {
void DOMWindow::ReportCoopAccess(const char* property_name) {
if (coop_access_monitor_.IsEmpty()) // Fast early return. Very likely true.
return;
v8::Isolate* isolate = window_proxy_manager_->GetIsolate();
LocalDOMWindow* accessing_window = IncumbentDOMWindow(isolate);
LocalFrame* accessing_frame = accessing_window->GetFrame();
......
......@@ -147,7 +147,7 @@ class CORE_EXPORT DOMWindow : public EventTargetWithInlineData {
//
// This function must be called when accessing any attributes and methods
// marked as "CrossOrigin" in the window.idl.
void ReportCoopAccess(v8::Isolate* isolate, const char* property_name);
void ReportCoopAccess(const char* property_name);
protected:
explicit DOMWindow(Frame&);
......
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