This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18219 - It seems that it isn't possible to create a second load event by doing a document.open/document.write/document.close sequence from within an existing load event
Summary: It seems that it isn't possible to create a second load event by doing a docu...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Silvia Pfeiffer
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 17:43 UTC by contributor
Modified: 2013-02-17 09:08 UTC (History)
7 users (show)

See Also:


Attachments

Description contributor 2012-07-18 17:43:32 UTC
This was was cloned from bug 17231 as part of operation convergence.
Originally filed: 2012-05-29 12:43:00 +0000

================================================================================
 #0   contributor@whatwg.org                          2012-05-29 12:43:03 +0000 
--------------------------------------------------------------------------------
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#comments
Complete: http://www.whatwg.org/c#comments

Comment:
It seems that it isn't possible to create a second load event by doing a
document.open/document.write/document.close sequence from within an existing
load event

Posted from: 2001:4c28:a030:30:ecfa:bf5f:96ca:7bec
User agent: Opera/9.80 (X11; Linux x86_64; U; Edition Next; en) Presto/2.10.289 Version/12.00
================================================================================
 #1   James Graham                                    2012-05-29 12:48:49 +0000 
--------------------------------------------------------------------------------
testcase:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1549
================================================================================
 #2   Ian 'Hixie' Hickson                             2012-05-30 23:13:14 +0000 
--------------------------------------------------------------------------------
Can you elaborate? I don't understand what spec change is being requested here.
================================================================================
 #3   James Graham                                    2012-05-31 08:59:42 +0000 
--------------------------------------------------------------------------------
It seems that doing something that would cause further load events to fire from within the load handler (e.g. restarting / stopping the parser with document.open / document.write / document.close) doesn't in fact cause further load events to fire. If this was allowed the TC above would continue printing onload indefinitely, rather than once, as observed. 

It is possible that the spec already prevents this in some way that I have missed. But if not, it should.
================================================================================
 #4   Ian 'Hixie' Hickson                             2012-05-31 17:43:15 +0000 
--------------------------------------------------------------------------------
Oh, I see. You're saying that since document.open() restarts the parser, that you'll eventually go through the "stops parsing" logic, and that would fire 'load' and 'pagehide' and so forth again...

Does any of the other logic happen? What does document.readyState switch to? Do scripts run the way they do with a network parser? (e.g. does defer="" delay until document.close()?) Does DOMContentLoaded fire again? pageshow? Do appcache things get delayed again? Does window.print() get delayed again between open() and close()?
================================================================================
 #5   Henri Sivonen                                   2012-06-04 09:45:37 +0000 
--------------------------------------------------------------------------------
(In reply to comment #4)
> Does any of the other logic happen? What does document.readyState switch to? Do
> scripts run the way they do with a network parser? (e.g. does defer="" delay
> until document.close()?) Does DOMContentLoaded fire again? pageshow? Do
> appcache things get delayed again? Does window.print() get delayed again
> between open() and close()?

Per
http://hsivonen.iki.fi/test/moz/readystate/document-open.html
I expect document.open() to switch readyState back to "loading" and DOMContentLoaded to fire when the stream has been exhausted. It seems that the "load" event fires also as well as, in Gecko, "pageshow".

By code inspection, I would expect app cache selection to run again and defer scripts to be deferred again.

There should already be feedback about this in your pending mailboxes that store WHATWG e-mail.
================================================================================
 #6   James Graham                                    2012-06-05 12:12:45 +0000 
--------------------------------------------------------------------------------
It seems like the other events from The End still happen:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1562
================================================================================
 #7   Henri Sivonen                                   2012-06-06 09:27:23 +0000 
--------------------------------------------------------------------------------
IRC discussion indicates that I was missing the point in comment 5.
================================================================================
Comment 1 Silvia Pfeiffer 2013-02-17 09:08:17 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If
you are satisfied with this response, please change the state of
this bug to CLOSED. If you have additional information and would
like the Editor to reconsider, please reopen this bug. If you would
like to escalate the issue to the full HTML Working Group, please
add the TrackerRequest keyword to this bug, and suggest title and
text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this
document:   http://dev.w3.org/html5/decision-policy/decision-policy-v2.html

Status: Accepted

Change Description:
https://github.com/w3c/html/commit/f51cbef6e982d6e1327ce62ab62732c31d4477f1
https://github.com/w3c/html/commit/8f94e4086ace34bd1eb7bf3cc58987b946ec6908
https://github.com/w3c/html/commit/35683d7b35a5d2c3a5cfe8f9588d037539468de4

Rationale: Adopted WHATWG resolution