Bug 1370630 - Untrusted submit event shouldn't trigger form submission. r=smaug.
MozReview-Commit-ID: 6jl7Xvh1Y1Y
This commit is contained in:
@@ -474,7 +474,10 @@ nsresult
|
||||
HTMLFormElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mWantsWillHandleEvent = true;
|
||||
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
|
||||
// According to the UI events spec section "Trusted events", we shouldn't
|
||||
// trigger UA default action with an untrusted event except click.
|
||||
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this) &&
|
||||
aVisitor.mEvent->IsTrusted()) {
|
||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == eFormSubmit) {
|
||||
if (mGeneratingSubmit) {
|
||||
@@ -516,7 +519,10 @@ HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
nsresult
|
||||
HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
|
||||
// According to the UI events spec section "Trusted events", we shouldn't
|
||||
// trigger UA default action with an untrusted event except click.
|
||||
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this) &&
|
||||
aVisitor.mEvent->IsTrusted()) {
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == eFormSubmit) {
|
||||
// let the form know not to defer subsequent submissions
|
||||
|
||||
Reference in New Issue
Block a user