Commit 147b8d57 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Revert "Add RuntimeEnabledFeature for retargeting _blank navigations to _top"

This reverts commit 2c8d5bfc.

Reason for revert: Looks like this doesn't do what I hoped it would (The sites I was testing on weren't sufficient).

var foo = window.open('foo.html); will set the target to "_blank" implicitly.

Original change's description:
> Add RuntimeEnabledFeature for retargeting _blank navigations to _top
> 
> See bug for context.
> 
> Notry=true
> 
> Bug: 961035
> Change-Id: Icfb0b2e62dbe7a07321d5fefee4a8cbeec42451f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1674677
> Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#673535}

TBR=dcheng@chromium.org,mthiesse@chromium.org,clamy@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 961035
Change-Id: I906713ed297ea8894650563db7036d6baf56112c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695697Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676109}
parent 0873b1e6
......@@ -3624,36 +3624,6 @@ TEST_F(WebViewTest, FocusExistingFrameOnNavigate) {
web_view_helper.Reset(); // Remove dependency on locally scoped client.
}
class RedirectBlankToTopClient
: public ViewCreatingWebViewClient,
private ScopedRedirectBlankNavigationToTopForTest {
public:
RedirectBlankToTopClient()
: ScopedRedirectBlankNavigationToTopForTest(true) {}
};
TEST_F(WebViewTest, BlankRedirectsToTop) {
RedirectBlankToTopClient client;
frame_test_helpers::WebViewHelper web_view_helper;
WebViewImpl* web_view_impl = web_view_helper.Initialize(nullptr, &client);
WebLocalFrameImpl* frame = web_view_impl->MainFrameImpl();
frame->SetName("_start");
// Make a request that will open a new window
WebURLRequest web_url_request(KURL("about:blank"));
FrameLoadRequest request(nullptr, web_url_request.ToResourceRequest());
const FrameTree::FindResult& found_frame =
To<LocalFrame>(web_view_impl->GetPage()->MainFrame())
->Tree()
.FindOrCreateFrameForNavigation(request, "_blank");
ASSERT_FALSE(client.CreatedWebView());
WebLocalFrameImpl* found_local_frame = WebLocalFrameImpl::FromFrame(
DynamicTo<LocalFrame>(found_frame.frame.Get()));
EXPECT_EQ(found_local_frame, frame);
web_view_helper.Reset(); // Remove dependency on locally scoped client.
}
class ViewReusingWebViewClient : public frame_test_helpers::TestWebViewClient {
public:
ViewReusingWebViewClient() = default;
......
......@@ -242,17 +242,10 @@ Frame* FrameTree::FindFrameForNavigationInternal(const AtomicString& name,
if (EqualIgnoringASCIICase(name, "_parent"))
return Parent() ? Parent() : this_frame_.Get();
if (EqualIgnoringASCIICase(name, "_blank")) {
if (RuntimeEnabledFeatures::RedirectBlankNavigationToTopEnabled()) {
// TODO(mthiesse): Only apply this behavior to navigations without
// rel=opener once
// https://html.spec.whatwg.org/multipage/links.html#link-type-opener is
// implemented.
return &Top();
} else {
return nullptr;
}
}
// Since "_blank" should never be any frame's name, the following just amounts
// to an optimization.
if (EqualIgnoringASCIICase(name, "_blank"))
return nullptr;
// Search subtree starting with this frame first.
for (Frame* frame = this_frame_; frame;
......
......@@ -1266,9 +1266,6 @@
name: "RasterInducingScroll",
status: "experimental",
},
{
name: "RedirectBlankNavigationToTop",
},
{
name: "ReducedReferrerGranularity",
},
......
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