Commit 4a5ed276 authored by jam's avatar jam Committed by Commit bot

Fix subframe loads with RenderViewTest when PlzNavigate is enabled.

While main frame loads already disabled the load being handled by the browser (in RenderViewTest::LoadHTML), requests from subframes are created inside Blink and so were missing that flag. Fix this by adding it in TestRenderFrame. Note this only modifies WebURLRequest::setCheckForBrowserSideNavigation, so that the other codepaths that check IsBrowserSideNavigationEnabled don't see any behavior change.

This fixes
ThreatDOMDetailsTest.Everything
with PlzNavigate.

BUG=504347

Review-Url: https://codereview.chromium.org/2557223002
Cr-Commit-Position: refs/heads/master@{#437654}
parent cee4c12b
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "content/common/resource_request_body_impl.h" #include "content/common/resource_request_body_impl.h"
#include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/resource_response.h" #include "content/public/common/resource_response.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
namespace content { namespace content {
...@@ -70,4 +71,18 @@ void TestRenderFrame::SetCompositionFromExistingText( ...@@ -70,4 +71,18 @@ void TestRenderFrame::SetCompositionFromExistingText(
OnSetCompositionFromExistingText(start, end, underlines); OnSetCompositionFromExistingText(start, end, underlines);
} }
blink::WebNavigationPolicy TestRenderFrame::decidePolicyForNavigation(
const blink::WebFrameClient::NavigationPolicyInfo& info) {
if (IsBrowserSideNavigationEnabled() &&
info.urlRequest.checkForBrowserSideNavigation() &&
GetWebFrame()->parent() &&
info.form.isNull()) {
// RenderViewTest::LoadHTML already disables PlzNavigate for the main frame
// requests. However if the loaded html has a subframe, the WebURLRequest
// will be created inside Blink and it won't have this flag set.
info.urlRequest.setCheckForBrowserSideNavigation(false);
}
return RenderFrameImpl::decidePolicyForNavigation(info);
}
} // namespace content } // namespace content
...@@ -45,6 +45,9 @@ class TestRenderFrame : public RenderFrameImpl { ...@@ -45,6 +45,9 @@ class TestRenderFrame : public RenderFrameImpl {
int end, int end,
const std::vector<blink::WebCompositionUnderline>& underlines); const std::vector<blink::WebCompositionUnderline>& underlines);
blink::WebNavigationPolicy decidePolicyForNavigation(
const blink::WebFrameClient::NavigationPolicyInfo& info) override;
private: private:
explicit TestRenderFrame(const RenderFrameImpl::CreateParams& params); explicit TestRenderFrame(const RenderFrameImpl::CreateParams& params);
DISALLOW_COPY_AND_ASSIGN(TestRenderFrame); DISALLOW_COPY_AND_ASSIGN(TestRenderFrame);
......
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