Closed
Bug 311903
Opened 19 years ago
Closed 19 years ago
JS prompt always returns null
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: mozilla, Unassigned)
References
Details
(Keywords: regression)
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
20051008 trunk
Starting with the 20051008 trunk, the following JavaScript does not work:
javascript:var Qr=prompt('Test','');if(Qr)alert("TRUE");
When run, and something entered, nothing happens. If you change the JS to:
javascript:var Qr=prompt('Test','');if(!Qr)alert("TRUE");
It then works. Apparently Qr is not being set.
EXPECTED
An alert box that says "TRUE".
This worked in 20051007. This breaks any bookmarkletts that use a prompt to
build a URL.
Reporter | ||
Comment 1•19 years ago
|
||
Bug 311024 looks suspicious, but I can't look at it to see what it's about. Yay
for security through obscurity.
Reporter | ||
Comment 2•19 years ago
|
||
Confirmed that prompt is not returning a value.
javascript:alert(prompt("Enter something",""));
Returns null regardless of whether something is entered.
Summary: JS Prompt Not Setting Variable → JS prompt always returns null
Updated•19 years ago
|
Assignee: general → general
Component: JavaScript Engine → DOM: Level 0
QA Contact: general → ian
Comment 3•19 years ago
|
||
I really don't think that this is a regression from bug 311024. If it were, I'd
expect a security error. For some reason the returned value from
nsGlobalWindow::Prompt is void (i.e., nsAString::IsVoid() returns true) even
though we Assign() the correct value to it.
Jerry, do you have a regression window for this?
Reporter | ||
Comment 4•19 years ago
|
||
20051007 trunk works, 20051008 trunk does not.
Comment 5•19 years ago
|
||
This patch window.prompt actually return something, but it seems like it should
be unnecessary. Did string code change recently that could cause this?
Comment 6•19 years ago
|
||
> Yay for security through obscurity.
It's called responsible disclosure, Jerry -- as soon as we've shipped a fix for
that bug we'll open it up to all the script kiddies who feel like looking for
security bugs in bugzilla.
Blake, is your nsTSubstring.cpp up to tip? See bug 311456 (checked in for the
10/8 builds, then backed out in time for the 10/9 ones, which never
materialized). I bet if you "cvs up -A xpcom/string/src/nsTSubstring.cpp" this
bug will go away.
Blocks: 311456
Comment 7•19 years ago
|
||
Yep. This appears to be fixed by the backout for bug 311456. Marking FIXED.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•