Closed Bug 311903 Opened 19 years ago Closed 19 years ago

JS prompt always returns null

Categories

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

x86
Windows XP
defect
Not set
major

Tracking

()

VERIFIED FIXED

People

(Reporter: mozilla, Unassigned)

References

Details

(Keywords: regression)

Attachments

(1 file)

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.
Bug 311024 looks suspicious, but I can't look at it to see what it's about. Yay for security through obscurity.
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
Assignee: general → general
Component: JavaScript Engine → DOM: Level 0
QA Contact: general → ian
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?
20051007 trunk works, 20051008 trunk does not.
Attached patch so this works (deleted) — Splinter Review
This patch window.prompt actually return something, but it seems like it should be unnecessary. Did string code change recently that could cause this?
> 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
Yep. This appears to be fixed by the backout for bug 311456. Marking FIXED.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Verified 20051010 trunk.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: