Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Allow absolute pathnames in js console read()

RESOLVED FIXED in mozilla9

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: azakai, Assigned: azakai)

Tracking

Trunk
mozilla9
All
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

6 years ago
Created attachment 555902 [details] [diff] [review]
patch

Currently the js console, when told to

  read('/usr/share/...')

will try to read

  CURRENT_DIR//user/share

(and fail) since it appends the parameter to the current directory.

Attached is a patch that leaves absolute pathnames (starting with '/') alone. For comparison, v8 does that.
Attachment #555902 - Flags: review?(cdleary)
(Assignee)

Comment 1

6 years ago
Created attachment 555903 [details] [diff] [review]
patch with context

(forgot -U 8, sorry)
Attachment #555902 - Attachment is obsolete: true
Attachment #555902 - Flags: review?(cdleary)
Attachment #555903 - Flags: review?(cdleary)
Comment on attachment 555903 [details] [diff] [review]
patch with context

Review of attachment 555903 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/shell/js.cpp
@@ +3805,5 @@
>  
> +    if (*leaf == '/') {
> +        /* We were given an absolute pathname. */
> +        return JS_strdup(cx, leaf);
> +    }

Do we want to wrap this in an |#if !defined(XP_WIN)|?
Attachment #555903 - Flags: review?(cdleary) → review+
(Assignee)

Comment 3

6 years ago
MakeAbsolutePathname is actually only defined and used ifdef XP_UNIX. I guess no one uses the shell on Windows ;)
(Assignee)

Comment 4

6 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/5a7e488482a5
Whiteboard: [inbound]

Comment 5

6 years ago
http://hg.mozilla.org/mozilla-central/rev/5a7e488482a5
Assignee: general → azakai
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.