Open Bug 931618 Opened 11 years ago Updated 2 years ago

onpopstate event can't work after document.write() is used

Categories

(Core :: DOM: Events, defect, P5)

24 Branch
x86
Windows 7
defect

Tracking

()

REOPENED

People

(Reporter: owyntyler, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36

Steps to reproduce:

1. document.write()
2. window.onpopstate = function( e ) {alert(1);}
3. history.back()


Actual results:

no event firing


Expected results:

alert(1)
Could you upload a minimal testcase
(note, in certain cases webkit/blink based browsers don't have document.write and session history the
way it is specified in HTML spec so this might be related to that).
Attached file test.html
So document.write in that timeout creates a new window object, and you set listener there.
Then back goes back to the previous window/document-before-write and possible
events fire on that window, not the window object which was created when 
document.write was called.
This is exactly the case where webkit/blink don't follow the spec, so you'll get different behavior there.

As far as I see this is invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Attached file test2.html
>and possible events fire on that window
no, it's not firing anywhere and I don't see a way for onpopstate event to possible be triggered after execution of document.write(), here's testpage where event listener is set to window before doing document.write()
Ok, I can see a problem.
Well two problems. The spec has changed (again) after popstate was implemented so
popstate dispatching should be async and SharesDocumentWith doesn't seem to do the right thing
always.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: