New issue
Advanced search Search tips

Issue 862591 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 10
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 861808



Sign in to add a comment

Is http/tests/history/redirect-js-form-submit-0-seconds.html correct?

Project Member Reported by arthurso...@chromium.org, Jul 11

Issue description

The test is:
~~~
  <html>
  <head>
  <title>JavaScript Redirect</title>

  <script>
  if (window.testRunner) {
      testRunner.clearBackForwardList();
      testRunner.waitUntilDone();
  }
  </script>
  </head>

  <body>
  <p>This page is a JavaScript redirect on a 0 second delay.</p>
  <form id="form" action="resources/redirect-target.html#1"></form>
  <script>
  setTimeout(function () { document.getElementById("form").submit(); }, 0);
  </script>
  </body>
  </html>

~~~

The current test expectation is:

~~~
  This page is the target of a redirect.
  
  FAIL: History item count should be 1 but instead is 2.
  
  
  ============== Back Forward List ==============
  				http://127.0.0.1:8000/history/redirect-js-form-submit-0-seconds.html
  curr->  http://127.0.0.1:8000/history/resources/redirect-target.html?#1
  ===============================================

~~~

So this test is currently expected to display "FAIL".

I don't quite understand what guarantees |must_replace_current_item| to be false or true here. For me both may happen.

I think it depends only on the load event. Non-user navigation before the page has finished firing onload should not create a new back/forward history item. See NavigationScheduler::MustReplaceCurrentItem

+CC japhet@. Do you think this test make sense? I would like to replace it by two tests:
1) Navigation before the onload event => no new entry created.
2) Navigation after the onload event => new entry appended.

Note: I am interested on working on this test because I have a CL where setTimeout(..., 0) and the onload event handler are not executed in the same order. It gives my a different test output.
 
Blocking: 861808
Hi Nate,

Both tests:
* http/tests/history/redirect-js-location-assign-0-seconds.html
* http/tests/history/redirect-js-form-submit-0-seconds.html
uses setTimeout(navigate, 0);

They expect no navigation entry to be created (i.e. == javascript-redirect).
The actual test expectation is the opposite.

According to me, the actual behavior is undefined. It depends on whether the setTimeout task is ran before of after the load event.

Do you have any thought on this? Can I update the tests (See #1)?
Nate: Friendly ping ;-)
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 31

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/36f5bb5e7c843d8768b86977fc879135da365eea

commit 36f5bb5e7c843d8768b86977fc879135da365eea
Author: Arthur Sonzogni <arthursonzogni@chromium.org>
Date: Fri Aug 31 08:09:27 2018

Update LayoutTest /history/redirect-js-* (11 tests)

The current behavior of chrome is the following one:
---
When a javascript navigation is triggered, if it happens:
   * before the load event, replace the current history entry.
   * after the load event, append a new history entry.
---

The first case is sometimes called "javascript-redirect".

The current set of tests uses two kind of tests. One with a timeout of 2
seconds. This one is expected to happens after the load event. Another
one with a timeout of 0 seconds. We don't really know this one is
expected to happens. This is flaky. It usually happens after the load
event, but it is non deterministic.

This CLs removes:
  * /http/tests/history/redirect-js-*-0-seconds}.html
  * /http/tests/history/redirect-js-*-2-seconds}.html

And completes:
  * /http/tests/history/redirect-js-*-before-load}.html
  * /http/tests/history/redirect-js-*-after-load}.html

It modifies the tests so that they really depend on the load event, not
on timing, which is not reliable.

Bug:  862591 , 831155
Change-Id: I3d568019c8616e6b52b9db554ad95ed312bd82d9
Reviewed-on: https://chromium-review.googlesource.com/1185094
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587965}
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-document-location-2-seconds.html
[rename] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-document-location-after-load-expected.txt
[add] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-document-location-after-load.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-form-submit-0-seconds-expected.txt
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-form-submit-0-seconds.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-form-submit-2-seconds-expected.txt
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-form-submit-2-seconds.html
[copy] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-form-submit-after-load-expected.txt
[add] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-form-submit-after-load.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-2-seconds-expected.txt
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-2-seconds.html
[rename] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-after-load-expected.txt
[add] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-after-load.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-assign-0-seconds.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-assign-2-seconds-expected.txt
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-assign-2-seconds.html
[rename] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-assign-after-load-expected.txt
[add] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-assign-after-load.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-href-2-seconds.html
[rename] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-href-after-load-expected.txt
[add] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-href-after-load.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-replace-0-seconds.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-replace-2-seconds.html
[rename] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-replace-after-load-expected.txt
[add] https://crrev.com/36f5bb5e7c843d8768b86977fc879135da365eea/third_party/WebKit/LayoutTests/http/tests/history/redirect-js-location-replace-after-load.html
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/reload-during-load-after-load-event-expected.txt
[delete] https://crrev.com/3b06b81f4b9d5eafc7f65821522bc19bc362a93f/third_party/WebKit/LayoutTests/http/tests/history/reload-during-load-after-load-event.html

Status: Fixed (was: Assigned)
Tests have been updated.

Sign in to add a comment