Commit 6931ab86 authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Skip NavigationScheduler for form submission, attempt #3

Bug: 914587
Change-Id: I366cbd78cd80b3814865ed6d5565d11d28415fec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1520353
Commit-Queue: Nate Chapin <japhet@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644537}
parent 8f4e07de
...@@ -329,6 +329,16 @@ bool LocalFrame::IsLocalRoot() const { ...@@ -329,6 +329,16 @@ bool LocalFrame::IsLocalRoot() const {
return Tree().Parent()->IsRemoteFrame(); return Tree().Parent()->IsRemoteFrame();
} }
static ClientNavigationReason ClientNavigationReasonFromRequest(
const FrameLoadRequest& request) {
if (request.Form()) {
if (request.GetResourceRequest().HttpMethod() == http_names::kPOST)
return ClientNavigationReason::kFormSubmissionPost;
return ClientNavigationReason::kFormSubmissionGet;
}
return ClientNavigationReason::kFrameNavigation;
}
void LocalFrame::ScheduleNavigation(Document& origin_document, void LocalFrame::ScheduleNavigation(Document& origin_document,
const KURL& url, const KURL& url,
WebFrameLoadType frame_load_type, WebFrameLoadType frame_load_type,
...@@ -343,7 +353,20 @@ void LocalFrame::Navigate(const FrameLoadRequest& request, ...@@ -343,7 +353,20 @@ void LocalFrame::Navigate(const FrameLoadRequest& request,
WebFrameLoadType frame_load_type) { WebFrameLoadType frame_load_type) {
if (!navigation_rate_limiter().CanProceed()) if (!navigation_rate_limiter().CanProceed())
return; return;
if (request.ClientRedirect() == ClientRedirectPolicy::kClientRedirect) {
ClientNavigationReason reason = ClientNavigationReasonFromRequest(request);
probe::FrameScheduledNavigation(this, request.GetResourceRequest().Url(),
0.0, reason);
probe::FrameRequestedNavigation(this, request.GetResourceRequest().Url(),
reason);
if (NavigationScheduler::MustReplaceCurrentItem(this))
frame_load_type = WebFrameLoadType::kReplaceCurrentItem;
}
loader_.StartNavigation(request, frame_load_type); loader_.StartNavigation(request, frame_load_type);
if (request.ClientRedirect() == ClientRedirectPolicy::kClientRedirect)
probe::FrameClearedScheduledNavigation(this);
} }
void LocalFrame::DetachImpl(FrameDetachType type) { void LocalFrame::DetachImpl(FrameDetachType type) {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h" #include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
#include "third_party/blink/renderer/core/dom/node_lists_node_data.h" #include "third_party/blink/renderer/core/dom/node_lists_node_data.h"
#include "third_party/blink/renderer/core/dom/user_gesture_indicator.h" #include "third_party/blink/renderer/core/dom/user_gesture_indicator.h"
#include "third_party/blink/renderer/core/events/current_input_event.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
...@@ -481,27 +482,6 @@ void HTMLFormElement::ScheduleFormSubmission(FormSubmission* submission) { ...@@ -481,27 +482,6 @@ void HTMLFormElement::ScheduleFormSubmission(FormSubmission* submission) {
return; return;
} }
if (submission->Action().ProtocolIsJavaScript()) {
if (FastHasAttribute(kDisabledAttr)) {
UseCounter::Count(GetDocument(),
WebFeature::kFormDisabledAttributePresentAndSubmit);
}
GetDocument().ProcessJavaScriptUrl(submission->Action(),
kCheckContentSecurityPolicy);
return;
}
Frame* target_frame = GetDocument().GetFrame()->FindFrameForNavigation(
submission->Target(), *GetDocument().GetFrame(),
submission->RequestURL());
if (!target_frame) {
target_frame = GetDocument().GetFrame();
} else {
submission->ClearTarget();
}
if (!target_frame->GetPage())
return;
UseCounter::Count(GetDocument(), WebFeature::kFormsSubmitted); UseCounter::Count(GetDocument(), WebFeature::kFormsSubmitted);
if (MixedContentChecker::IsMixedFormAction(GetDocument().GetFrame(), if (MixedContentChecker::IsMixedFormAction(GetDocument().GetFrame(),
submission->Action())) { submission->Action())) {
...@@ -512,22 +492,16 @@ void HTMLFormElement::ScheduleFormSubmission(FormSubmission* submission) { ...@@ -512,22 +492,16 @@ void HTMLFormElement::ScheduleFormSubmission(FormSubmission* submission) {
WebFeature::kFormDisabledAttributePresentAndSubmit); WebFeature::kFormDisabledAttributePresentAndSubmit);
} }
// TODO(lukasza): Investigate if the code below can uniformly handle remote FrameLoadRequest frame_load_request =
// and local frames (i.e. by calling virtual Frame::navigate from a timer). submission->CreateFrameLoadRequest(&GetDocument());
// See also https://goo.gl/95d2KA. frame_load_request.SetNavigationPolicy(submission->GetNavigationPolicy());
if (auto* target_local_frame = DynamicTo<LocalFrame>(target_frame)) { frame_load_request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect);
target_local_frame->GetNavigationScheduler().ScheduleFormSubmission( frame_load_request.GetResourceRequest().SetHasUserGesture(
&GetDocument(), submission); LocalFrame::HasTransientUserActivation(GetDocument().GetFrame()));
} else { if (const WebInputEvent* input_event = CurrentInputEvent::Get())
FrameLoadRequest frame_load_request = frame_load_request.SetInputStartTime(input_event->TimeStamp());
submission->CreateFrameLoadRequest(&GetDocument()); GetDocument().GetFrame()->Navigate(frame_load_request,
frame_load_request.GetResourceRequest().SetHasUserGesture( WebFrameLoadType::kStandard);
LocalFrame::HasTransientUserActivation(GetDocument().GetFrame()));
// TODO(dgozman): we lose information about triggering event and desired
// navigation policy here.
To<RemoteFrame>(target_frame)
->Navigate(frame_load_request, WebFrameLoadType::kStandard);
}
} }
void HTMLFormElement::reset() { void HTMLFormElement::reset() {
......
...@@ -272,8 +272,10 @@ void FormSubmission::Trace(blink::Visitor* visitor) { ...@@ -272,8 +272,10 @@ void FormSubmission::Trace(blink::Visitor* visitor) {
} }
KURL FormSubmission::RequestURL() const { KURL FormSubmission::RequestURL() const {
if (method_ == FormSubmission::kPostMethod) if (method_ == FormSubmission::kPostMethod ||
action_.ProtocolIsJavaScript()) {
return action_; return action_;
}
KURL request_url(action_); KURL request_url(action_);
request_url.SetQuery(form_data_->FlattenToString()); request_url.SetQuery(form_data_->FlattenToString());
......
...@@ -118,8 +118,6 @@ class FormSubmission : public GarbageCollectedFinalized<FormSubmission> { ...@@ -118,8 +118,6 @@ class FormSubmission : public GarbageCollectedFinalized<FormSubmission> {
SubmitMethod Method() const { return method_; } SubmitMethod Method() const { return method_; }
const KURL& Action() const { return action_; } const KURL& Action() const { return action_; }
const AtomicString& Target() const { return target_; }
void ClearTarget() { target_ = g_null_atom; }
HTMLFormElement* Form() const { return form_.Get(); } HTMLFormElement* Form() const { return form_.Get(); }
EncodedFormData* Data() const { return form_data_.get(); } EncodedFormData* Data() const { return form_data_.get(); }
NavigationPolicy GetNavigationPolicy() const { return navigation_policy_; } NavigationPolicy GetNavigationPolicy() const { return navigation_policy_; }
......
...@@ -729,29 +729,7 @@ bool FrameLoader::PrepareRequestForThisFrame(FrameLoadRequest& request) { ...@@ -729,29 +729,7 @@ bool FrameLoader::PrepareRequestForThisFrame(FrameLoadRequest& request) {
return false; return false;
} }
// Block renderer-initiated loads of data: and filesystem: URLs in the top if (request.FrameName().IsEmpty())
// frame.
//
// If the mime type of the data URL is supported, the URL will
// eventually be rendered, so block it here. Otherwise, the load might be
// handled by a plugin or end up as a download, so allow it to let the
// embedder figure out what to do with it. Navigations to filesystem URLs are
// always blocked here.
if (frame_->IsMainFrame() &&
!frame_->Client()->AllowContentInitiatedDataUrlNavigations(
request.OriginDocument()->Url()) &&
(url.ProtocolIs("filesystem") ||
(url.ProtocolIsData() &&
network_utils::IsDataURLMimeTypeSupported(url)))) {
frame_->GetDocument()->AddConsoleMessage(ConsoleMessage::Create(
mojom::ConsoleMessageSource::kSecurity,
mojom::ConsoleMessageLevel::kError,
"Not allowed to navigate top frame to " + url.Protocol() +
" URL: " + url.ElidedString()));
return false;
}
if (!request.Form() && request.FrameName().IsEmpty())
request.SetFrameName(frame_->GetDocument()->BaseTarget()); request.SetFrameName(frame_->GetDocument()->BaseTarget());
return true; return true;
} }
...@@ -817,12 +795,8 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request, ...@@ -817,12 +795,8 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request,
if (!PrepareRequestForThisFrame(request)) if (!PrepareRequestForThisFrame(request))
return; return;
// Form submissions appear to need their special-case of finding the target at Frame* target_frame = frame_->FindFrameForNavigation(
// schedule rather than at fire. AtomicString(request.FrameName()), *frame_, url);
Frame* target_frame =
request.Form() ? nullptr
: frame_->FindFrameForNavigation(
AtomicString(request.FrameName()), *frame_, url);
// Downloads and navigations which specifically target a *new* frame // Downloads and navigations which specifically target a *new* frame
// (e.g. because of a ctrl-click) should ignore the target. // (e.g. because of a ctrl-click) should ignore the target.
...@@ -839,6 +813,28 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request, ...@@ -839,6 +813,28 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request,
return; return;
} }
// Block renderer-initiated loads of data: and filesystem: URLs in the top
// frame.
//
// If the mime type of the data URL is supported, the URL will
// eventually be rendered, so block it here. Otherwise, the load might be
// handled by a plugin or end up as a download, so allow it to let the
// embedder figure out what to do with it. Navigations to filesystem URLs are
// always blocked here.
if (frame_->IsMainFrame() && origin_document &&
!frame_->Client()->AllowContentInitiatedDataUrlNavigations(
request.OriginDocument()->Url()) &&
(url.ProtocolIs("filesystem") ||
(url.ProtocolIsData() &&
network_utils::IsDataURLMimeTypeSupported(url)))) {
frame_->GetDocument()->AddConsoleMessage(ConsoleMessage::Create(
mojom::ConsoleMessageSource::kSecurity,
mojom::ConsoleMessageLevel::kError,
"Not allowed to navigate top frame to " + url.Protocol() +
" URL: " + url.ElidedString()));
return;
}
SetReferrerForFrameRequest(request); SetReferrerForFrameRequest(request);
if (!target_frame && !request.FrameName().IsEmpty() && if (!target_frame && !request.FrameName().IsEmpty() &&
......
...@@ -64,64 +64,7 @@ namespace blink { ...@@ -64,64 +64,7 @@ namespace blink {
unsigned NavigationDisablerForBeforeUnload::navigation_disable_count_ = 0; unsigned NavigationDisablerForBeforeUnload::navigation_disable_count_ = 0;
class ScheduledURLNavigation : public ScheduledNavigation { class ScheduledRedirect final : public ScheduledNavigation {
protected:
ScheduledURLNavigation(ClientNavigationReason reason,
double delay,
Document* origin_document,
const KURL& url,
WebFrameLoadType frame_load_type,
base::TimeTicks input_timestamp)
: ScheduledNavigation(reason,
delay,
origin_document,
input_timestamp),
url_(url),
should_check_main_world_content_security_policy_(
kCheckContentSecurityPolicy),
frame_load_type_(frame_load_type) {
if (ContentSecurityPolicy::ShouldBypassMainWorld(origin_document)) {
should_check_main_world_content_security_policy_ =
kDoNotCheckContentSecurityPolicy;
}
if (origin_document && url.ProtocolIs("blob") &&
BlobUtils::MojoBlobURLsEnabled()) {
origin_document->GetPublicURLManager().Resolve(
url_, MakeRequest(&blob_url_token_));
}
}
void Fire(LocalFrame* frame) override {
std::unique_ptr<UserGestureIndicator> gesture_indicator =
CreateUserGestureIndicator();
FrameLoadRequest request(OriginDocument(), ResourceRequest(url_), "_self",
should_check_main_world_content_security_policy_);
request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect);
request.SetInputStartTime(InputTimestamp());
if (blob_url_token_) {
mojom::blink::BlobURLTokenPtr token_clone;
blob_url_token_->Clone(MakeRequest(&token_clone));
request.SetBlobURLToken(std::move(token_clone));
}
frame->Loader().StartNavigation(request, frame_load_type_);
}
KURL Url() const override { return url_; }
WebFrameLoadType LoadType() const { return frame_load_type_; }
private:
KURL url_;
mojom::blink::BlobURLTokenPtr blob_url_token_;
ContentSecurityPolicyDisposition
should_check_main_world_content_security_policy_;
WebFrameLoadType frame_load_type_;
};
class ScheduledRedirect final : public ScheduledURLNavigation {
public: public:
static ScheduledRedirect* Create(double delay, static ScheduledRedirect* Create(double delay,
Document* origin_document, Document* origin_document,
...@@ -140,12 +83,12 @@ class ScheduledRedirect final : public ScheduledURLNavigation { ...@@ -140,12 +83,12 @@ class ScheduledRedirect final : public ScheduledURLNavigation {
Document::HttpRefreshType http_refresh_type, Document::HttpRefreshType http_refresh_type,
WebFrameLoadType frame_load_type, WebFrameLoadType frame_load_type,
base::TimeTicks input_timestamp) base::TimeTicks input_timestamp)
: ScheduledURLNavigation(ToReason(http_refresh_type), : ScheduledNavigation(ToReason(http_refresh_type),
delay, delay,
origin_document, origin_document,
url, url,
frame_load_type, frame_load_type,
input_timestamp) { input_timestamp) {
ClearUserGesture(); ClearUserGesture();
} }
...@@ -185,7 +128,7 @@ class ScheduledRedirect final : public ScheduledURLNavigation { ...@@ -185,7 +128,7 @@ class ScheduledRedirect final : public ScheduledURLNavigation {
} }
}; };
class ScheduledFrameNavigation final : public ScheduledURLNavigation { class ScheduledFrameNavigation final : public ScheduledNavigation {
public: public:
static ScheduledFrameNavigation* Create(Document* origin_document, static ScheduledFrameNavigation* Create(Document* origin_document,
const KURL& url, const KURL& url,
...@@ -199,60 +142,47 @@ class ScheduledFrameNavigation final : public ScheduledURLNavigation { ...@@ -199,60 +142,47 @@ class ScheduledFrameNavigation final : public ScheduledURLNavigation {
const KURL& url, const KURL& url,
WebFrameLoadType frame_load_type, WebFrameLoadType frame_load_type,
base::TimeTicks input_timestamp) base::TimeTicks input_timestamp)
: ScheduledURLNavigation(ClientNavigationReason::kFrameNavigation, : ScheduledNavigation(ClientNavigationReason::kFrameNavigation,
0.0, 0.0,
origin_document, origin_document,
url, url,
frame_load_type, frame_load_type,
input_timestamp) {}
};
class ScheduledFormSubmission final : public ScheduledNavigation {
public:
static ScheduledFormSubmission* Create(Document* document,
FormSubmission* submission,
WebFrameLoadType frame_load_type,
base::TimeTicks input_timestamp) {
return MakeGarbageCollected<ScheduledFormSubmission>(
document, submission, frame_load_type, input_timestamp);
}
ScheduledFormSubmission(Document* document,
FormSubmission* submission,
WebFrameLoadType frame_load_type,
base::TimeTicks input_timestamp)
: ScheduledNavigation(submission->Method() == FormSubmission::kGetMethod
? ClientNavigationReason::kFormSubmissionGet
: ClientNavigationReason::kFormSubmissionPost,
0,
document,
input_timestamp), input_timestamp),
submission_(submission), should_check_main_world_content_security_policy_(
frame_load_type_(frame_load_type) { kCheckContentSecurityPolicy) {
DCHECK_NE(submission->Method(), FormSubmission::kDialogMethod); if (ContentSecurityPolicy::ShouldBypassMainWorld(origin_document)) {
DCHECK(submission_->Form()); should_check_main_world_content_security_policy_ =
kDoNotCheckContentSecurityPolicy;
}
if (origin_document && url.ProtocolIs("blob") &&
BlobUtils::MojoBlobURLsEnabled()) {
origin_document->GetPublicURLManager().Resolve(
Url(), MakeRequest(&blob_url_token_));
}
} }
void Fire(LocalFrame* frame) override { void Fire(LocalFrame* frame) override {
std::unique_ptr<UserGestureIndicator> gesture_indicator = std::unique_ptr<UserGestureIndicator> gesture_indicator =
CreateUserGestureIndicator(); CreateUserGestureIndicator();
FrameLoadRequest frame_request = FrameLoadRequest request(OriginDocument(), ResourceRequest(Url()), "_self",
submission_->CreateFrameLoadRequest(OriginDocument()); should_check_main_world_content_security_policy_);
frame_request.SetNavigationPolicy(submission_->GetNavigationPolicy()); request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect);
frame_request.SetInputStartTime(InputTimestamp()); request.SetInputStartTime(InputTimestamp());
frame->Loader().StartNavigation(frame_request, frame_load_type_);
}
KURL Url() const override { return submission_->RequestURL(); } if (blob_url_token_) {
mojom::blink::BlobURLTokenPtr token_clone;
blob_url_token_->Clone(MakeRequest(&token_clone));
request.SetBlobURLToken(std::move(token_clone));
}
void Trace(blink::Visitor* visitor) override { frame->Loader().StartNavigation(request, LoadType());
visitor->Trace(submission_);
ScheduledNavigation::Trace(visitor);
} }
private: private:
Member<FormSubmission> submission_; mojom::blink::BlobURLTokenPtr blob_url_token_;
WebFrameLoadType frame_load_type_; ContentSecurityPolicyDisposition
should_check_main_world_content_security_policy_;
}; };
NavigationScheduler::NavigationScheduler(LocalFrame* frame) : frame_(frame) {} NavigationScheduler::NavigationScheduler(LocalFrame* frame) : frame_(frame) {}
...@@ -353,22 +283,6 @@ void NavigationScheduler::ScheduleFrameNavigation( ...@@ -353,22 +283,6 @@ void NavigationScheduler::ScheduleFrameNavigation(
kCancelParsing); kCancelParsing);
} }
void NavigationScheduler::ScheduleFormSubmission(Document* document,
FormSubmission* submission) {
DCHECK(frame_->GetPage());
WebFrameLoadType frame_load_type = WebFrameLoadType::kStandard;
if (MustReplaceCurrentItem(frame_))
frame_load_type = WebFrameLoadType::kReplaceCurrentItem;
// Cancel parsing if the form submission is targeted at this frame.
CancelParsingPolicy policy =
submission->Target().IsEmpty() || submission->Target() == "_self"
? kCancelParsing
: kDoNotCancelParsing;
Schedule(ScheduledFormSubmission::Create(document, submission,
frame_load_type, InputTimestamp()),
policy);
}
void NavigationScheduler::NavigateTask() { void NavigationScheduler::NavigateTask() {
if (!frame_->GetPage()) if (!frame_->GetPage())
return; return;
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
namespace blink { namespace blink {
class FormSubmission;
class LocalFrame; class LocalFrame;
class ScheduledNavigation; class ScheduledNavigation;
...@@ -67,11 +66,12 @@ class CORE_EXPORT NavigationScheduler final ...@@ -67,11 +66,12 @@ class CORE_EXPORT NavigationScheduler final
void ScheduleRedirect(double delay, const KURL&, Document::HttpRefreshType); void ScheduleRedirect(double delay, const KURL&, Document::HttpRefreshType);
void ScheduleFrameNavigation(Document*, const KURL&, WebFrameLoadType); void ScheduleFrameNavigation(Document*, const KURL&, WebFrameLoadType);
void ScheduleFormSubmission(Document*, FormSubmission*);
void StartTimer(); void StartTimer();
void Cancel(); void Cancel();
static bool MustReplaceCurrentItem(LocalFrame* target_frame);
void Trace(blink::Visitor*); void Trace(blink::Visitor*);
private: private:
...@@ -82,7 +82,6 @@ class CORE_EXPORT NavigationScheduler final ...@@ -82,7 +82,6 @@ class CORE_EXPORT NavigationScheduler final
enum CancelParsingPolicy { kCancelParsing, kDoNotCancelParsing }; enum CancelParsingPolicy { kCancelParsing, kDoNotCancelParsing };
void Schedule(ScheduledNavigation*, CancelParsingPolicy); void Schedule(ScheduledNavigation*, CancelParsingPolicy);
static bool MustReplaceCurrentItem(LocalFrame* target_frame);
base::TimeTicks InputTimestamp(); base::TimeTicks InputTimestamp();
Member<LocalFrame> frame_; Member<LocalFrame> frame_;
......
...@@ -15,10 +15,14 @@ namespace blink { ...@@ -15,10 +15,14 @@ namespace blink {
ScheduledNavigation::ScheduledNavigation(ClientNavigationReason reason, ScheduledNavigation::ScheduledNavigation(ClientNavigationReason reason,
double delay, double delay,
Document* origin_document, Document* origin_document,
const KURL& url,
WebFrameLoadType frame_load_type,
base::TimeTicks input_timestamp) base::TimeTicks input_timestamp)
: reason_(reason), : reason_(reason),
delay_(delay), delay_(delay),
origin_document_(origin_document), origin_document_(origin_document),
url_(url),
frame_load_type_(frame_load_type),
input_timestamp_(input_timestamp) { input_timestamp_(input_timestamp) {
if (LocalFrame::HasTransientUserActivation( if (LocalFrame::HasTransientUserActivation(
origin_document ? origin_document->GetFrame() : nullptr)) origin_document ? origin_document->GetFrame() : nullptr))
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/web_frame_load_type.h"
#include "third_party/blink/renderer/core/loader/frame_loader_types.h" #include "third_party/blink/renderer/core/loader/frame_loader_types.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
namespace blink { namespace blink {
...@@ -22,18 +24,19 @@ class ScheduledNavigation ...@@ -22,18 +24,19 @@ class ScheduledNavigation
ScheduledNavigation(ClientNavigationReason, ScheduledNavigation(ClientNavigationReason,
double delay, double delay,
Document* origin_document, Document* origin_document,
const KURL&,
WebFrameLoadType,
base::TimeTicks input_timestamp); base::TimeTicks input_timestamp);
virtual ~ScheduledNavigation(); virtual ~ScheduledNavigation();
virtual void Fire(LocalFrame*) = 0; virtual void Fire(LocalFrame*) = 0;
virtual KURL Url() const = 0;
virtual bool ShouldStartTimer(LocalFrame*) { return true; } virtual bool ShouldStartTimer(LocalFrame*) { return true; }
ClientNavigationReason GetReason() const { return reason_; } ClientNavigationReason GetReason() const { return reason_; }
double Delay() const { return delay_; } double Delay() const { return delay_; }
Document* OriginDocument() const { return origin_document_.Get(); } Document* OriginDocument() const { return origin_document_.Get(); }
const KURL& Url() const { return url_; }
std::unique_ptr<UserGestureIndicator> CreateUserGestureIndicator(); std::unique_ptr<UserGestureIndicator> CreateUserGestureIndicator();
base::TimeTicks InputTimestamp() const { return input_timestamp_; } base::TimeTicks InputTimestamp() const { return input_timestamp_; }
...@@ -43,11 +46,14 @@ class ScheduledNavigation ...@@ -43,11 +46,14 @@ class ScheduledNavigation
protected: protected:
void ClearUserGesture() { user_gesture_token_ = nullptr; } void ClearUserGesture() { user_gesture_token_ = nullptr; }
WebFrameLoadType LoadType() const { return frame_load_type_; }
private: private:
ClientNavigationReason reason_; ClientNavigationReason reason_;
double delay_; double delay_;
Member<Document> origin_document_; Member<Document> origin_document_;
KURL url_;
WebFrameLoadType frame_load_type_;
scoped_refptr<UserGestureToken> user_gesture_token_; scoped_refptr<UserGestureToken> user_gesture_token_;
base::TimeTicks input_timestamp_; base::TimeTicks input_timestamp_;
......
...@@ -90,7 +90,7 @@ function HTMLFormElement10() { ...@@ -90,7 +90,7 @@ function HTMLFormElement10() {
assertSize("Asize",1,nodeList); assertSize("Asize",1,nodeList);
testNode = nodeList.item(0); testNode = nodeList.item(0);
testNode.submit(); testNode.submit();
window.stop();
} }
function runTest() { function runTest() {
......
CONSOLE ERROR: Not allowed to navigate top frame to data URL: data:text/html,<script>alert(window)</script>? CONSOLE ERROR: line 15: Not allowed to navigate top frame to data URL: data:text/html,<script>alert(window)</script>?
If the POST pop-up was not blocked then there will be an ALERT containing a Window object. Otherwise, the test passes. If the POST pop-up was not blocked then there will be an ALERT containing a Window object. Otherwise, the test passes.
...@@ -18,6 +18,7 @@ runTest = function() { ...@@ -18,6 +18,7 @@ runTest = function() {
textNode.dispatchEvent(event); textNode.dispatchEvent(event);
if (window.testRunner) if (window.testRunner)
testRunner.notifyDone(); testRunner.notifyDone();
window.stop();
} }
setTimeout(runTest, 0); setTimeout(runTest, 0);
......
...@@ -4,6 +4,9 @@ function submitForm() ...@@ -4,6 +4,9 @@ function submitForm()
{ {
if (window.testRunner) if (window.testRunner)
testRunner.dumpAsText(); testRunner.dumpAsText();
if (sessionStorage.submitted)
return;
sessionStorage.submitted = true;
document.getElementById("submitform").submit(); document.getElementById("submitform").submit();
} }
</script> </script>
......
...@@ -38,7 +38,8 @@ document.getElementById('target').onload = function(event) { ...@@ -38,7 +38,8 @@ document.getElementById('target').onload = function(event) {
} }
window.onload = function() { window.onload = function() {
document.getElementById('submitButton').click(); if (location.search == "")
document.getElementById('submitButton').click();
} }
if (window.testRunner) if (window.testRunner)
......
main frame - didCommitLoadForFrame main frame - didCommitLoadForFrame
main frame - didReceiveTitle: main frame - didReceiveTitle:
main frame - didFinishDocumentLoadForFrame main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
main frame - BeginNavigation request to 'http://127.0.0.1:8000/history/post-replace-state-reload.html', http method POST main frame - BeginNavigation request to 'http://127.0.0.1:8000/history/post-replace-state-reload.html', http method POST
main frame - DidStartNavigation main frame - DidStartNavigation
main frame - didFinishLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - ReadyToCommitNavigation main frame - ReadyToCommitNavigation
main frame - didCommitLoadForFrame main frame - didCommitLoadForFrame
main frame - didCommitLoadForFrame main frame - didCommitLoadForFrame
......
...@@ -3,10 +3,10 @@ main frame - ReadyToCommitNavigation ...@@ -3,10 +3,10 @@ main frame - ReadyToCommitNavigation
main frame - didCommitLoadForFrame main frame - didCommitLoadForFrame
main frame - didReceiveTitle: main frame - didReceiveTitle:
main frame - didFinishDocumentLoadForFrame main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
main frame - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/post-to-303-target.php', http method POST main frame - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/post-to-303-target.php', http method POST
main frame - DidStartNavigation main frame - DidStartNavigation
main frame - didFinishLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - ReadyToCommitNavigation main frame - ReadyToCommitNavigation
http://127.0.0.1:8000/loading/resources/307-post-output-target.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/307-post-output-target.php, http status code 200> http://127.0.0.1:8000/loading/resources/307-post-output-target.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/307-post-output-target.php, http status code 200>
main frame - didCommitLoadForFrame main frame - didCommitLoadForFrame
......
...@@ -21,10 +21,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR ...@@ -21,10 +21,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR
frame "0" - didCommitLoadForFrame frame "0" - didCommitLoadForFrame
frame "0" - didReceiveTitle: frame "0" - didReceiveTitle:
frame "0" - didFinishDocumentLoadForFrame frame "0" - didFinishDocumentLoadForFrame
frame "0" - didHandleOnloadEventsForFrame
frame "0" - didFinishLoadForFrame
frame "0" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST frame "0" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST
frame "0" - DidStartNavigation frame "0" - DidStartNavigation
frame "0" - didFinishLoadForFrame
frame "0" - didHandleOnloadEventsForFrame
frame "0" - ReadyToCommitNavigation frame "0" - ReadyToCommitNavigation
http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
frame "0" - didCommitLoadForFrame frame "0" - didCommitLoadForFrame
...@@ -48,10 +48,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR ...@@ -48,10 +48,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR
frame "1" - didCommitLoadForFrame frame "1" - didCommitLoadForFrame
frame "1" - didReceiveTitle: frame "1" - didReceiveTitle:
frame "1" - didFinishDocumentLoadForFrame frame "1" - didFinishDocumentLoadForFrame
frame "1" - didHandleOnloadEventsForFrame
frame "1" - didFinishLoadForFrame
frame "1" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST frame "1" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST
frame "1" - DidStartNavigation frame "1" - DidStartNavigation
frame "1" - didFinishLoadForFrame
frame "1" - didHandleOnloadEventsForFrame
frame "1" - ReadyToCommitNavigation frame "1" - ReadyToCommitNavigation
http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
frame "1" - didCommitLoadForFrame frame "1" - didCommitLoadForFrame
...@@ -75,10 +75,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR ...@@ -75,10 +75,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR
frame "2" - didCommitLoadForFrame frame "2" - didCommitLoadForFrame
frame "2" - didReceiveTitle: frame "2" - didReceiveTitle:
frame "2" - didFinishDocumentLoadForFrame frame "2" - didFinishDocumentLoadForFrame
frame "2" - didHandleOnloadEventsForFrame
frame "2" - didFinishLoadForFrame
frame "2" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST frame "2" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST
frame "2" - DidStartNavigation frame "2" - DidStartNavigation
frame "2" - didFinishLoadForFrame
frame "2" - didHandleOnloadEventsForFrame
frame "2" - ReadyToCommitNavigation frame "2" - ReadyToCommitNavigation
http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
frame "2" - didCommitLoadForFrame frame "2" - didCommitLoadForFrame
...@@ -102,10 +102,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR ...@@ -102,10 +102,10 @@ http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveR
frame "3" - didCommitLoadForFrame frame "3" - didCommitLoadForFrame
frame "3" - didReceiveTitle: frame "3" - didReceiveTitle:
frame "3" - didFinishDocumentLoadForFrame frame "3" - didFinishDocumentLoadForFrame
frame "3" - didHandleOnloadEventsForFrame
frame "3" - didFinishLoadForFrame
frame "3" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST frame "3" - BeginNavigation request to 'http://127.0.0.1:8000/loading/resources/redirect-methods-result.php', http method POST
frame "3" - DidStartNavigation frame "3" - DidStartNavigation
frame "3" - didFinishLoadForFrame
frame "3" - didHandleOnloadEventsForFrame
frame "3" - ReadyToCommitNavigation frame "3" - ReadyToCommitNavigation
http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
frame "3" - didCommitLoadForFrame frame "3" - didCommitLoadForFrame
......
CONSOLE ERROR: Refused to send form data to 'http://localhost:8000/' because it violates the following Content Security Policy directive: "form-action 127.0.0.1:8000". CONSOLE ERROR: line 16: Refused to send form data to 'http://localhost:8000/' because it violates the following Content Security Policy directive: "form-action 127.0.0.1:8000".
......
CONSOLE ERROR: Refused to send form data to 'http://localhost:8000/' because it violates the following Content Security Policy directive: "form-action 127.0.0.1:8000". CONSOLE ERROR: line 14: Refused to send form data to 'http://localhost:8000/' because it violates the following Content Security Policy directive: "form-action 127.0.0.1:8000".
......
CONSOLE ERROR: Not allowed to navigate top frame to data URL: data:text/html,<script>alert(window)</script>? CONSOLE ERROR: line 15: Not allowed to navigate top frame to data URL: data:text/html,<script>alert(window)</script>?
If the POST pop-up was not blocked then there will be an ALERT containing a Window object. Otherwise, the test passes. If the POST pop-up was not blocked then there will be an ALERT containing a Window object. Otherwise, the test passes.
CONSOLE ERROR: Not allowed to navigate top frame to data URL: data:text/html,<script>alert(window)</script>? CONSOLE ERROR: line 15: Not allowed to navigate top frame to data URL: data:text/html,<script>alert(window)</script>?
If the POST pop-up was not blocked then there will be an ALERT containing a Window object. Otherwise, the test passes. If the POST pop-up was not blocked then there will be an ALERT containing a Window object. Otherwise, the test passes.
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