diff --git a/js/src/xpconnect/src/nsXPConnect.cpp b/js/src/xpconnect/src/nsXPConnect.cpp index 51649a7baef8..96de158b35f2 100644 --- a/js/src/xpconnect/src/nsXPConnect.cpp +++ b/js/src/xpconnect/src/nsXPConnect.cpp @@ -78,13 +78,13 @@ nsXPConnect::nsXPConnect() #ifdef XPC_TOOLS_SUPPORT { - const char* filename = PR_GetEnv("MOZILLA_JS_PROFILER_OUTPUT"); - if(filename) + nsDependentCString filename(PR_GetEnv("MOZILLA_JS_PROFILER_OUTPUT")); + if(!filename.IsEmpty()) { mProfilerOutputFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); if(mProfilerOutputFile && - NS_SUCCEEDED(mProfilerOutputFile->InitWithPath(filename))) + NS_SUCCEEDED(mProfilerOutputFile->InitWithNativePath(filename))) { mProfiler = do_GetService(XPCTOOLS_PROFILER_CONTRACTID); if(mProfiler) @@ -93,7 +93,7 @@ nsXPConnect::nsXPConnect() { #ifdef DEBUG printf("***** profiling JavaScript. Output to: %s\n", - filename); + filename.get()); #endif } } diff --git a/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp b/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp index 63be3cad7cc2..b2fdccd9595c 100644 --- a/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp +++ b/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp @@ -116,8 +116,8 @@ NS_IMETHODIMP nsXPCToolsCompiler::CompileFile(nsILocalFile *aFile, PRBool strict if (!JS_InitStandardClasses(cx, glob)) return NS_ERROR_FAILURE; - char * path = nsnull; - if(NS_FAILED(aFile->GetPath(&path))) + nsCAutoString path; + if(NS_FAILED(aFile->GetNativePath(path))) return NS_ERROR_FAILURE; uint32 oldoptions = JS_GetOptions(cx); @@ -125,7 +125,7 @@ NS_IMETHODIMP nsXPCToolsCompiler::CompileFile(nsILocalFile *aFile, PRBool strict JSErrorReporter older = JS_SetErrorReporter(cx, ErrorReporter); JSExceptionState *es =JS_SaveExceptionState(cx); - if(!JS_CompileFileHandle(cx, glob, path, handle)) + if(!JS_CompileFileHandle(cx, glob, path.get(), handle)) { jsval v; JSErrorReport* report; @@ -152,7 +152,5 @@ NS_IMETHODIMP nsXPCToolsCompiler::CompileFile(nsILocalFile *aFile, PRBool strict JS_SetErrorReporter(cx, older); JS_SetOptions(cx, oldoptions); - if(path) - nsMemory::Free(path); return NS_OK; }