1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 * vim: set ts=8 sts=4 et sw=4 tw=99: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 // OSObject.h - os object for exposing posix system calls in the JS shell 8 9 #ifndef shell_OSObject_h 10 #define shell_OSObject_h 11 12 #include "jsapi.h" 13 14 namespace js { 15 namespace shell { 16 17 struct RCFile; 18 19 /* Define an os object on the given global object. */ 20 bool DefineOS(JSContext* cx, JS::HandleObject global, bool fuzzingSafe, 21 RCFile** shellOut, RCFile** shellErr); 22 23 enum PathResolutionMode { RootRelative, ScriptRelative }; 24 25 JSString* ResolvePath(JSContext* cx, JS::HandleString filenameStr, 26 PathResolutionMode resolveMode); 27 28 JSObject* FileAsTypedArray(JSContext* cx, JS::HandleString pathnameStr); 29 30 JS::UniqueChars GetCWD(); 31 32 } // namespace shell 33 } // namespace js 34 35 #endif /* shell_OSObject_h */ 36