Backed out changeset 367b6f947f87 (bug 1370630) for breaking mozilla-internal jenkins site. r=backout.

This commit is contained in:
Stone Shih 2017-07-11 15:59:03 +08:00
Родитель 139730a55e
Коммит 1da6cd22e9
3 изменённых файлов: 2 добавлений и 46 удалений

Просмотреть файл

@ -180,4 +180,3 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
[test_bug1332699.html]
[test_bug1339758.html]
[test_dnd_with_modifiers.html]
[test_submitevent_on_form.html]

Просмотреть файл

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test submit event on form</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<form action="javascript:doDefault()" id="form">
<input type="submit" value="Do Default Action">
</form>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
var doDefaultAction = false;
function doDefault()
{
doDefaultAction = true;
}
function runTests()
{
let form = document.getElementById("form");
form.dispatchEvent(new Event('submit'));
setTimeout(() => {
ok(!doDefaultAction, "untrusted submit event shouldn't trigger form default action");
SimpleTest.finish();
});
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -474,10 +474,7 @@ nsresult
HTMLFormElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
{
aVisitor.mWantsWillHandleEvent = true;
// 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()) {
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
uint32_t msg = aVisitor.mEvent->mMessage;
if (msg == eFormSubmit) {
if (mGeneratingSubmit) {
@ -519,10 +516,7 @@ HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
nsresult
HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
{
// 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()) {
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
EventMessage msg = aVisitor.mEvent->mMessage;
if (msg == eFormSubmit) {
// let the form know not to defer subsequent submissions