New issue
Advanced search Search tips

Issue 878491 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 3
Type: Bug



Sign in to add a comment

document.close() sets document.readyState synchronously

Project Member Reported by timothygu@chromium.org, Aug 28

Issue description

Chrome Version: (copy from chrome://version) 70.0.3535.0 (Official Build) canary (64-bit)
OS: (e.g. Win10, MacOS 10.12, etc...) macOS 10.13.6

What steps will reproduce the problem?

document.open();
document.close();
console.log(document.readyState);

What is the expected result?

"interactive" is printed. This is the case in Firefox (but not Safari). Per spec, the readiness is changed to "complete" in a queued task (https://html.spec.whatwg.org/multipage/parsing.html#stop-parsing step 7).

What happens instead?

"complete" is printed.
 
Hi, I have an interest in this issue.
If no one is assigned to this issue, Can I take a look at this issue?
Also, Can I get a good start point for this issue?

Thanks a lot!
timothygu@, is there a test in WPT that shows the difference in behavior here? Would it be the final parts of https://github.com/web-platform-tests/wpt/pull/10844, if landed?
foolip@, the linked PR is indeed a test for this topic, but the code fragment

    frame.onload = t.step_func_done(() => {
      [...]
      frame.contentDocument.close();
      assert_equals(frame.contentDocument.readyState, "complete");
      assert_array_equals(states, ["interactive", "complete"]);
    });

would need to be changed to

    frame.onload = t.step_func(() => {
      [...]
      frame.contentDocument.close();
      assert_equals(frame.contentDocument.readyState, "interactive");
      assert_array_equals(states, ["interactive"]);
      frame.contentDocument.onreadystatechange = t.step_func_done(() => {
        assert_equals(frame.contentDocument.readyState, "complete");
      });
    });

to reflect the current specification. The PR as it stands uses the current Chrome behavior as reference.

Sign in to add a comment