Closed Bug 369097 Opened 18 years ago Closed 17 years ago

Only escape % in to-be-evaluated JavaScript code

Categories

(Toolkit Graveyard :: Error Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9alpha5

People

(Reporter: zeniko, Assigned: zeniko)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Steps to reproduce:
1. Open the Error Console
2. Evaluate [""]..length

Expected result:
Error: XML descendants internal method called on incompatible Array
Source file: javascript: [""]..length

Actual result:
Source file: javascript: %5B%22%22%5D..length

Suggested solution:
Instead of encodeURIComponent, using .replace(/%/g, "%25") should be sufficient (that's what Console² does).

From bug 342662 comment #12:
If you want to be sure about non-ASCII Unicode characters, what about
.replace(/[^\x20-\x24\x26-\x7F]+/g, encodeURI) as a compromise? This encodes
everything except printable 7-bit-ASCII characters (% being the exception to
the exception).

OTOH I haven't seen any bug report to that end so far and we haven't encoded
any (Unicode) characters since day 0, so we might just as well escape only that
one character (which shouldn't make much of a difference) and wait for further
bug reports such as this one [i.e. bug 342662] about other characters.
Attached patch fix (obsolete) — Splinter Review
Assignee: nobody → zeniko
Status: NEW → ASSIGNED
Attachment #264504 - Flags: review?(gavin.sharp)
Attachment #264504 - Flags: review?(gavin.sharp) → review+
Attachment #264504 - Flags: superreview?(neil)
Comment on attachment 264504 [details] [diff] [review]
fix

Evaluator.location ;-)
Attachment #264504 - Flags: superreview?(neil) → superreview+
Attachment #264504 - Attachment is obsolete: true
Whiteboard: [checkin needed]
mozilla/toolkit/components/console/content/console.js         1.9
mozilla/xpfe/components/console/resources/content/console.js  1.28
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → Firefox 3 alpha5
Product: Firefox → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: