Commit 7a695172 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

v8binding: Disallow cross-origin named access on Window

We've been allowing cross-origin named access on Window just
in order to keep the backward compatibility for a while.
This patch finally fixes it and ignores cross-origin window
name when performing named access on Window.

Basically, this is a revert of
https://codereview.chromium.org/2753773003

Bug: 538562
Change-Id: I3856bb5c655a9415c2d0b87d1ec4b3743b94d076
Reviewed-on: https://chromium-review.googlesource.com/c/1314021Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606373}
parent d0a70f4b
ALERT: true CONSOLE ERROR: line 11: Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "http://localhost:8080". The frame requesting access has a protocol of "data", the frame being accessed has a protocol of "http". Protocols must match.
CONSOLE ERROR: line 3: Uncaught TypeError: Cannot read property 'innerHTML' of null CONSOLE ERROR: line 9: Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "http://localhost:8080". The frame requesting access has a protocol of "data", the frame being accessed has a protocol of "http". Protocols must match.
CONSOLE MESSAGE: line 6: FAIL CONSOLE MESSAGE: line 9: SecurityError: Blocked a frame with origin "null" from accessing a cross-origin frame.
CONSOLE MESSAGE: line 7: compatible with old versions = true
CONSOLE MESSAGE: line 6: iframe1: SecurityError: Blocked a frame with origin "null" from accessing a cross-origin frame. CONSOLE MESSAGE: line 6: iframe1: SecurityError: Blocked a frame with origin "null" from accessing a cross-origin frame.
CONSOLE MESSAGE: line 12: FAIL CONSOLE MESSAGE: line 14: iframe1: SecurityError: Blocked a frame with origin "null" from accessing a cross-origin frame.
CONSOLE MESSAGE: line 4: FAIL CONSOLE MESSAGE: line 6: iframe2: SecurityError: Blocked a frame with origin "null" from accessing a cross-origin frame.
...@@ -235,13 +235,16 @@ void V8Window::namedPropertyGetterCustom( ...@@ -235,13 +235,16 @@ void V8Window::namedPropertyGetterCustom(
CurrentExecutionContext(info.GetIsolate()), CurrentExecutionContext(info.GetIsolate()),
WebFeature:: WebFeature::
kNamedAccessOnWindow_ChildBrowsingContext_CrossOriginNameMismatch); kNamedAccessOnWindow_ChildBrowsingContext_CrossOriginNameMismatch);
// In addition to the above spec'ed case, we return the child window if (!RuntimeEnabledFeatures::
// regardless of step 3 due to crbug.com/701489 for the time being. IgnoreCrossOriginWindowWhenNamedAccessOnWindowEnabled()) {
// TODO(yukishiino): Makes iframe.name update the browsing context name // In addition to the above spec'ed case, we return the child window
// appropriately and makes the new name available in the named access on // regardless of step 3 due to crbug.com/701489 for the time being.
// window. Then, removes the following two lines. // TODO(yukishiino): Makes iframe.name update the browsing context name
V8SetReturnValueFast(info, child->DomWindow(), window); // appropriately and makes the new name available in the named access on
return; // window. Then, removes the following two lines.
V8SetReturnValueFast(info, child->DomWindow(), window);
return;
}
} }
// This is a cross-origin interceptor. Check that the caller has access to the // This is a cross-origin interceptor. Check that the caller has access to the
......
...@@ -587,6 +587,10 @@ ...@@ -587,6 +587,10 @@
name: "IdleTimeColdModeSpellChecking", name: "IdleTimeColdModeSpellChecking",
status: "stable", status: "stable",
}, },
{
name: "IgnoreCrossOriginWindowWhenNamedAccessOnWindow",
status: "experimental",
},
{ {
name: "ImageOrientation", name: "ImageOrientation",
status: "test", status: "test",
......
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