Closed
Bug 191377
Opened 22 years ago
Closed 22 years ago
window.open("") does not open blank window
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: bugzilla, Assigned: nisheeth_mozilla)
References
()
Details
(Keywords: dom0, regression)
Attachments
(2 files)
2.13 KB,
text/html
|
Details | |
575 bytes,
patch
|
peterv
:
review+
hjtoi-bugzilla
:
superreview+
asa
:
approval1.3b+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3b) Gecko/20030128 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3b) Gecko/20030128 After creating a sub-window with WindowObjectReference = window.open("", "WindowName", windowFeaturesList), a script attempts to populate the empty document with nodes using DOM level 1 methods (createElement, createTextNode, appendChild). The script will work flawlessly in NS 7.01 and MSIE 6 for Windows while it will fail in Mozilla 1.3beta 2003012804 without any error or warning from the javascript console. An upcoming testcase will give more details. Reproducible: Always Steps to Reproduce: 1. Load the test case 2. Press the "Create a child window" button Actual Results: The popup is created but it copies, duplicates the document content (nodes) of the opener (parent) window. Expected Results: - The popup should render the title "This is the dynamically assigned text of the title of the popup window" in the titlebar of the popup. - The popup should render the text "This is the text of the dynamically DOM-inserted paragraph in the body" in the content area. If the url in the window.open() call is "about:blank", then both Mozilla 1.3beta and NS 7.01 will FAIL to insert and render the created nodes. If the url in the window.open() call is "file:///", then both Mozilla 1.3beta and NS 7.01 will SUCCEED to insert and render the created nodes. Using document.open(), document.write[ln] and document.close() is a workaround so I'm setting the severity to Minor.
Reporter | ||
Comment 1•22 years ago
|
||
For testing purposes, here are some comparative results with the testcase: WindowObjectReference = window.open("", [...]); works in NS 7.01 and in MSIE 6 for Windows but not in Mozilla 1.3b. WindowObjectReference = window.open("about:blank", [...]); works in MSIE 6 for Windows but will not work in NS 7.01 and in Mozilla 1.3b. (I personally do not see how or why there is/would be/should be a difference between the empty string and "about:blank".) WindowObjectReference = window.open("file:///", [...]); works in NS 7.01 and in Mozilla 1.3b but will not work in MSIE 6 for Windows.
Comment 2•22 years ago
|
||
I see the nodes being set fine, then a different page loading in the new window... The real problem here is that you're munging the document in the new window before the window load (which is async) completes....
Reporter | ||
Comment 3•22 years ago
|
||
Boris, I agree with what you say. I nevertheless still see a bug here. Even after breaking the function CreateChildWindow() into 2 distinct functions (one to create the popup, the other to populate the document), there is still a problem in 1.3b: the empty string for the url argument leads to the copying and duplication of the opener/parent document content. Not so in NS 7.01, not so in MSIE 6 for Windows, not so in Opera 7b1 and apparently not so either in NS 4.x I'll upload a new and reduced testcase and will re-summarize.
Comment 4•22 years ago
|
||
DOM0, changing summary to what the real problem is, setting url to problem url.
Status: UNCONFIRMED → NEW
Component: DOM Core → DOM Level 0
Ever confirmed: true
OS: Windows XP → All
QA Contact: stummala → desale
Hardware: PC → All
Summary: Creating and appending nodes into a blank document fails. → window.open("") does not open blank window
Updated•22 years ago
|
Reporter | ||
Comment 5•22 years ago
|
||
References: ----------- "If URL is an empty string, a new, empty window is created. (...) if you pass the empty string for the URL, you will get a reference to the existing window, but not load anything into it." http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1202771 "If no URL is specified, a new window with about:blank is displayed." http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp I think "about:blank" should be shown into the location bar as well in such case.
Comment 6•22 years ago
|
||
This works in 2003-01-25-22 and is broken in 2003-01-27-21. I suspect the fix for bug 174628 is responsible (I'll try a local backout later if I have time, if no one does it first).
Keywords: regression
Assignee | ||
Comment 7•22 years ago
|
||
i should deal with this as it looks as if it is my regression...
Assignee: jst → nisheeth
Assignee | ||
Comment 8•22 years ago
|
||
Yes, this bug was caused by the fix to bug 174628. About to attach a one line patch that fixes it... I've tested this patch and made sure that it doesn't regress bug 174628. Are there some set of window.open() tests anywhere that I can run? I want to make sure I test window.open() exhaustively this time...
Status: NEW → ASSIGNED
Assignee | ||
Comment 9•22 years ago
|
||
Here's the fix. My fix to bug 174628 changed the local variable, "url", from nsXPIDLCString to nsCAutoString. When a blank url was passed into window.open(), "url.get()" (later in the function) used to return a null ptr earlier but after my change started returning a pointer to a null string. This violated asumptions in downstream logic in window watcher code. I just added heikki to the cc list. Heikki, are there any window.open() tests I can run to make sure I've got it right this time around?
Assignee | ||
Comment 10•22 years ago
|
||
Comment on attachment 113162 [details] [diff] [review] Fix guys, please review this one line fix. this bug is a regression from the fix to the topembed+ bug 174628 I checked in earlier this week. pl see comment 9 for details about this fix. thanks!
Attachment #113162 -
Flags: superreview?(heikki)
Attachment #113162 -
Flags: review?(peterv)
Assignee | ||
Comment 11•22 years ago
|
||
I think this should be a beta blocker. Its a regression to core DOM functionality. Maybe some web developers want to jump in to say how often they use the window.open("") pattern. If the pattern is widely used, I think beta blocker status is justified...
Flags: blocking1.3b?
Updated•22 years ago
|
Attachment #113162 -
Flags: superreview?(heikki) → superreview+
Reporter | ||
Comment 12•22 years ago
|
||
I have seen quite often in newsgroups this type of dynamic document construction WindowObjectReference = window.open("" [,...]) WindowObjectReference.document.open(); // or WindowObjectReference.document.open("text/html", "replace"); WindowObjectReference.document.write("<html><head>..."); WindowObjectReference.document.close(); Even old Netscape documentation give examples precisely on how to do this: http://developer.netscape.com/docs/manuals/js/client/jsref/document.htm#1196361
Updated•22 years ago
|
Attachment #113162 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 13•22 years ago
|
||
Comment on attachment 113162 [details] [diff] [review] Fix I have a one line fix for a regression caused by the fix to topembed+ bug 174628. window.open("") is supposed to open a blank window. Instead it opened up a window and loaded the parent window's url into it. This patch makes window.open("") do the right thing. pl see comment 9 for details on this fix. r=peterv, sr=heikki
Attachment #113162 -
Flags: approval1.3b?
Comment 14•22 years ago
|
||
Comment on attachment 113162 [details] [diff] [review] Fix a=asa (on behalf of drivers) for checkin to 1.3beta.
Attachment #113162 -
Flags: approval1.3b? → approval1.3b+
Assignee | ||
Comment 15•22 years ago
|
||
Fix checked into trunk...
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Updated•22 years ago
|
Flags: blocking1.3b?
You need to log in
before you can comment on or make changes to this bug.
Description
•