Bug 682166 - Allow absolute pathnames in js console read(). r=cdleary
authorAlon Zakai <azakai@mozilla.com>
Wed, 31 Aug 2011 09:40:14 -0700
changeset 76290 5a7e488482a5e1a23bbc9ea07a36a92894a1fec2
parent 76289 5117dd88992107cafedfe60e6d06167ed14124ff
child 76291 891e5dbae3ec7f84ee003213e6377b2602066119
push id1605
push userazakai@mozilla.com
push dateWed, 31 Aug 2011 16:42:53 +0000
treeherdermozilla-inbound@5a7e488482a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscdleary
bugs682166
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 682166 - Allow absolute pathnames in js console read(). r=cdleary
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -3803,16 +3803,21 @@ Parent(JSContext *cx, uintN argc, jsval 
  */
 static char *
 MakeAbsolutePathname(JSContext *cx, const char *from, const char *leaf)
 {
     size_t dirlen;
     char *dir;
     const char *slash = NULL, *cp;
 
+    if (*leaf == '/') {
+        /* We were given an absolute pathname. */
+        return JS_strdup(cx, leaf);
+    }
+
     cp = from;
     while (*cp) {
         if (*cp == '/') {
             slash = cp;
         }
 
         ++cp;
     }