Closed document in error handlers

Confirmed Issue #9484577 • Assigned to Travis L.

Details

Created
Oct 23, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
  • Internet Explorer
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

This HTML produces “Hello World” on Chrome, Safari and Firefox (after https://bugzilla.mozilla.org/show_bug.cgi?id=1297125 was fixed), but on IE11 it produces “World” and on Edge it produces "Hello":

<!DOCTYPE html>
<html>
<head>
<script>
errorHandler = function() {
document.write(“<h1>Hello</h1>”);
}
</script>
<script src=’http://httpstat.us/404’ onerror=’errorHandler()'></script>
</head>
<body>
<h1>World!</h1>
</body>
</html>

Actual results:

By the time the error handler runs, Edge has already closed the document and it thus overwrites all existing content by re-opening it. The final result is “Hello”

Expected results:

In Chrome, Safari and Firefox the document is still open, and thus the final result is "Hello World!". Is Edge’s behaviour caused by speculative parsing?

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Ibrahim O.”

    Changed Assigned To to “Travis L.”

    Changed Status to “Confirmed”

  • Hello Travis,

    thanks for picking up the issue and confirming it.
    Do you have any details on why this is happening and if there is anything a web dev can do to avoid this issue?

    Thanks!

You need to sign in to your Microsoft account to add a comment.

Sign in