Closed Bug 195769 Opened 22 years ago Closed 21 years ago

window.open fails when setting innerHTML property of calling document

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 169429

People

(Reporter: myers, Unassigned)

References

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210 After using the innerHTML property of the calling document's body element the window.open method fails on subsequent attempts, with no errors or warnings being thrown. A test case is given below to show that this behavior only occurs when inserting content to the document.body via the innerHTML property. --------------------------------- parent window HTML ------------------ <html> <head> <title>popupTest.html</title> <script type="text/javascript"> var test= null; function insertContent() { if (test == 'DOM') { var newDiv= document.createElement('div'); var text= document.createTextNode('New Div!'); newDiv.appendChild(text); document.body.appendChild(newDiv); } else if (test == 'mixed') { var newDiv= document.createElement('div'); newDiv.innerHTML= 'New Div!'; document.body.appendChild(newDiv); } else { var newHTML= '<div>New Div!</div>'; document.body.innerHTML+= newHTML; } } /* * Test inner HTML insertion */ function innerTest() { test= 'innerHTML'; window.open('popup.html', 'popuptest', 'resizable,height=380,width=520,dependent'); alert('the popup window opened!'); } /** * mixed DOM and innerHTML test */ function mixedTest() { test= 'mixed'; window.open('popup.html', 'popuptest', 'resizable,height=380,width=520,dependent'); alert('the popup window opened!'); } /** * Test DOM insertion */ function DOMTest() { test= 'DOM'; window.open('popup.html', 'popuptest', 'resizable,height=380,width=520,dependent'); alert('the popup window opened!'); } </script> </head> <body> <button onCLick="DOMTest()">DOM Insertion test</button> <button onCLick="mixedTest()">mixed Insertion test</button> <button onCLick="innerTest()">innerHTML Insertion test</button> </body> </html> -------------------------------------- Child window HTML ----------------- <html> <head> <title>popup.html</title> <script type="text/javascript"> function callback() { self.opener.insertContent(); self.opener.focus(); self.close(); } </script> </head> <body> <button onCLick="callback()">Make Callback</button> </body> </html> Reproducible: Always Steps to Reproduce: 1. Click on "DOM insertion Test" - a new window should open 2. Click on "Make Callback" - a new Div element is inserted into the opening document using pure DOM methods. 3. Click on "mixed insertion Test - a new window should open 4. Click on "Make Callback" - a new Div element is inserted into the opening document using DOM appendChild method but setting the Div content with innerHTML. 5. Click on "innerHTML insertion Test - a new window should open 6. Click on "Make Callback" - a new Div element is inserted into the opening document using the innerHTML property of the document body. 7. Click on any of the buttons - the new window will not appear. Actual Results: Calls to window.open will fail with no notification to the user. The browser window must be refreshed for window.open to work properly. Expected Results: Calling window.open should open a new window. This bug also appeared in moz 1.1 . I upgraded to moz 1.3b and the problem is still present
Attached file Parent window HTML
This may be a dup of bug 169429 (Missed it when I was doing a bugzilla search, sorry about that)
Depends on: 169429
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
I can reproduce the problem in Firebird 0.7, Mozilla 1.5, Netscape 7.1 I think this bug is blocker since I couldn't find a workaround.
Both test files could be improved to eliminate potential sources of error. Only the innerHTML insertion (innerTest() function; when test=="innerHTML") is causing the bug. The other 2 (DOM insertion and mixed insertion) work flawlessly. So the attached testcases can be reduced here and furthermore help pinpoint the problem. I think this bug is a DUPLICATE of bug 169429 Mozilla 1.6 final build 20040113 under XP Pro SP1 here.
*** This bug has been marked as a duplicate of 169429 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: