From b9765cf07ddddfcc9f221eff320c2393e9627798 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 21 Feb 2020 22:01:49 +0000 Subject: [PATCH] Bug 1616437 [wpt PR 21873] - Don't make anchor clicks cancel form submission when href=#, a=testonly Automatic update from web-platform-tests Don't make anchor clicks cancel form submission when href=# In http://crrev.com/c/1922699 I made anchor clicks cancel all form submissions on a page in order to make this test pass: external/wpt/html/browsers/browsing-the-web/navigating-across-documents/006.html The test basically says that anchor navigations should take precedence over form submissions when the form submission is initiated by the onclick handler of the anchor element. However, when the anchor has href="#", form submissions should actually go through, and this has introduced a bug on websites which rely on this behavior. This logic I added to cancel form submissions would not be necessary if we made anchor clicks navigate asynchronously like the spec says to do, so I made a bug to do so and remove this logic: http://crbug.com/1053679 Bug: 1053312 Change-Id: I27bf193cf0d544222cddad932728a1d0f61ba62a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063265 Reviewed-by: Kent Tamura Reviewed-by: Mason Freed Commit-Queue: Joey Arhar Cr-Commit-Position: refs/heads/master@{#743410} -- wpt-commits: af2a784ca500a061287d26b75f7822cb4cb99b34 wpt-pr: 21873 --- ...hor-fragment-form-submit-longfragment.html | 29 +++++++++++++++ .../anchor-fragment-form-submit-withpath.html | 35 +++++++++++++++++++ .../anchor-fragment-form-submit.html | 29 +++++++++++++++ .../navigating-across-documents/form.html | 5 +++ .../workers/Worker-constructor-proto.any.js | 4 +-- 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-longfragment.html create mode 100644 testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-withpath.html create mode 100644 testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit.html create mode 100644 testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/form.html diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-longfragment.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-longfragment.html new file mode 100644 index 0000000000000..8c4c77014fc92 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-longfragment.html @@ -0,0 +1,29 @@ + + + + +Anchor element with onclick form submission and href to fragment + + + + + + +
+Test + + diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-withpath.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-withpath.html new file mode 100644 index 0000000000000..b891623a2f560 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit-withpath.html @@ -0,0 +1,35 @@ + + + + +Anchor element with onclick form submission and href to fragment + + + + + + +
+Test + + diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit.html new file mode 100644 index 0000000000000..57e44f180856d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/anchor-fragment-form-submit.html @@ -0,0 +1,29 @@ + + + + +Anchor element with onclick form submission and href to fragment + + + + + + +
+Test + + diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/form.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/form.html new file mode 100644 index 0000000000000..6523a82b39309 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/form.html @@ -0,0 +1,5 @@ + + +form navigation diff --git a/testing/web-platform/tests/workers/Worker-constructor-proto.any.js b/testing/web-platform/tests/workers/Worker-constructor-proto.any.js index 90ad767b98078..f0544b6c15a9b 100644 --- a/testing/web-platform/tests/workers/Worker-constructor-proto.any.js +++ b/testing/web-platform/tests/workers/Worker-constructor-proto.any.js @@ -1,7 +1,7 @@ //META: global=!default, worker test(() => { - proto = new Number(42) + const proto = {}; assert_equals(String(Object.getPrototypeOf(WorkerLocation)).replace(/\n/g, " ").replace(/\s\s+/g, " "), "function () { [native code] }"); WorkerLocation.__proto__ = proto; - assert_object_equals(Object.getPrototypeOf(WorkerLocation), Object(42)); + assert_equals(Object.getPrototypeOf(WorkerLocation), proto); }, 'Tests that setting the proto of a built in constructor is not reset.');