Closed
Bug 125887
Opened 23 years ago
Closed 23 years ago
Window.open yes/true attributes broken by trailing spaces
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: fabricio, Assigned: hwaara)
Details
Attachments
(3 files, 2 obsolete files)
|
190 bytes,
text/html
|
Details | |
|
196 bytes,
text/html
|
Details | |
|
2.08 KB,
patch
|
john
:
review+
bzbarsky
:
superreview+
brendan
:
approval+
|
Details | Diff | Splinter Review |
Steps to reproduce:
1- create a html with this window.open:
window.open ('http://www.mozilla.org','mozillawindow','width=500 , height=500 ,
resizable=yes , scrollbars=yes');
2- open this html
Expecting result:
the window open with the resize handlers and with the maximize button, just like
if you had coded without the spaces between the commas.
Actual result:
the window open but the resize handlers and the maximize button are disabled.
| Reporter | ||
Comment 1•23 years ago
|
||
This way works fine.
| Reporter | ||
Comment 2•23 years ago
|
||
This way doesnt work, the resizable=yes is ignored
Comment 3•23 years ago
|
||
I first thought that this was a bug with spaces in the features string of
window.open. JavaScript: The Definitive Guide says "The features argument is a
comma-separated list of features to appear in the window.... The string should
not contain any spaces or other whitespace." I don't know if this is also
documented in any DOM standard. Netscape 4.x definitely had problems with
whitespace in the string. It appears that IE5.0 and 5.5 and Mozilla do support
whitespace in the string. For example, this works:
javascript:window.open("about:blank","test","width=200 , height=200 , resizable=1")
The problem seems to be that "resizable=yes " with a trailing space is not
working. If you change it to resizeable=1 or remove the space it works. Perhaps
the string parser needs to trim trailling spaces before it tries a comparison?
Confirming bug because I can't find a duplicate for it.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 4•23 years ago
|
||
A better summary might be "Window.open yes/true attributes broken by trailing
spaces". This same problem affects the other attributes, such as toolbar=yes ,
scrollbars=yes , location=yes , etc.
In case I wasn't clear, the workaround for this is to just use 1 for the value
instead of yes or to remove the spaces.
I suspect this is really DOM0 and not JS engine, so changing component. I
confirmed this with 20020208 nightly on Win2K.
Component: JavaScript Engine → DOM Level 0
Comment 5•23 years ago
|
||
Setting default owner and QA -
Assignee: rogerl → jst
QA Contact: pschwartau → desale
| Reporter | ||
Comment 6•23 years ago
|
||
Confirmed in 2002040303 win2k and changed the sumary for the one suggested in
comment #4.
Summary: windows opened by javascript does not respect the resizable attribute if there are space between the commas → Window.open yes/true attributes broken by trailing spaces
| Assignee | ||
Comment 7•23 years ago
|
||
Here's a patch to ignore whitespace in the "features" argument of window.open()
and window.openDialog().
| Assignee | ||
Comment 8•23 years ago
|
||
CC boris for r=.
| Assignee | ||
Comment 9•23 years ago
|
||
CC caillon and sicking too. Seems like jst is busy. Maybe bz can sr= and you
guys can r=? Thanks.
Comment 10•23 years ago
|
||
Comment on attachment 91964 [details] [diff] [review]
Patch
Please remove the code in nsWindowWatcher::WinHasOption that skips whitespace
and add a debug-only check there that there is no whitespace in the string,
with an assertion if there is.
With that, sr=bzbarsky
Attachment #91964 -
Flags: superreview+
Comment 11•23 years ago
|
||
Comment on attachment 91964 [details] [diff] [review]
Patch
Actually, use StripWhitespace() instead of StripChars()
Comment 12•23 years ago
|
||
Comment on attachment 91964 [details] [diff] [review]
Patch
So I guess this makes sense after talking to Boris, and I agree that we should
remove the foo in nsWindowWatcher::WinHasOption() but to me it seems wrong to
move the check out of the window watcher and into its callers. I'd rather you
do StripWhitespace() somewhere either in nsWindowWatcher::OpenWindow() or
nsWindowWatcher::OpenWindowJS()...
| Assignee | ||
Comment 13•23 years ago
|
||
Better patch, addressing caillon's and bzbarsky's suggestions.
Attachment #91964 -
Attachment is obsolete: true
Comment 14•23 years ago
|
||
Comment on attachment 92061 [details] [diff] [review]
Patch v2
>+#include "nsReadableUtils.h"
Don't you actually want nsString.h? And only in debug builds?
>+#if DEBUG
#ifdef
>+ nsCString options(aOptions);
nsCAutoString
| Assignee | ||
Comment 15•23 years ago
|
||
Attachment #92061 -
Attachment is obsolete: true
Comment 16•23 years ago
|
||
Comment on attachment 92064 [details] [diff] [review]
Patch v3
sr=bzbarsky
Attachment #92064 -
Flags: superreview+
Comment 17•23 years ago
|
||
Comment on attachment 92064 [details] [diff] [review]
Patch v3
r=jkeiser
Attachment #92064 -
Flags: review+
Comment 18•23 years ago
|
||
Comment on attachment 92064 [details] [diff] [review]
Patch v3
a=brendan@mozilla.org for trunk checkin -- seems safe and right.
/be
Attachment #92064 -
Flags: approval+
| Assignee | ||
Comment 20•23 years ago
|
||
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 21•23 years ago
|
||
>+ NS_ASSERTION(options.FindCharInSet(" \n\r\t") == kNotFound,
>+ "There should be no whitespace in this string!");
Nice indentation. ^^^^
r=caillon with that fixed. <yawn>
You need to log in
before you can comment on or make changes to this bug.
Description
•