As a security precaution, we have turned on the setting "Require API key authentication for API requests" for everyone. If this has broken something, please contact
Last Comment Bug 682166 - Allow absolute pathnames in js console read()
: Allow absolute pathnames in js console read()
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All Linux
: -- normal (vote)
: mozilla9
Assigned To: Alon Zakai (:azakai)
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-08-25 17:38 PDT by Alon Zakai (:azakai)
Modified: 2011-09-01 01:46 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (409 bytes, patch)
2011-08-25 17:38 PDT, Alon Zakai (:azakai)
no flags Details | Diff | Splinter Review
patch with context (586 bytes, patch)
2011-08-25 17:40 PDT, Alon Zakai (:azakai)
cdleary: review+
Details | Diff | Splinter Review

Description User image Alon Zakai (:azakai) 2011-08-25 17:38:01 PDT
Created attachment 555902 [details] [diff] [review]

Currently the js console, when told to


will try to read


(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.
Comment 1 User image Alon Zakai (:azakai) 2011-08-25 17:40:25 PDT
Created attachment 555903 [details] [diff] [review]
patch with context

(forgot -U 8, sorry)
Comment 2 User image Chris Leary [:cdleary] (not checking bugmail) 2011-08-25 19:09:09 PDT
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)|?
Comment 3 User image Alon Zakai (:azakai) 2011-08-25 19:54:26 PDT
MakeAbsolutePathname is actually only defined and used ifdef XP_UNIX. I guess no one uses the shell on Windows ;)
Comment 5 User image Ed Morley [:emorley] 2011-09-01 01:46:46 PDT

Note You need to log in before you can comment on or make changes to this bug.