Global load() doesn't subsitute environment variables



10 years ago
4 years ago


(Reporter: Josh Allen, Unassigned)




(4 attachments)



10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv: Gecko/20070914 Firefox/
Build Identifier: 1.6R7 doesn't substitute environment variables for path names. So for example 

Reproducible: Always

Steps to Reproduce:
1. Create a javascript file
2. Add a first line load("$JSDIR/core-util.js")
3. Run javascript
Actual Results:  
Doesn't exapand $JSDIR

Expected Results:  
Expands $JSDIR

I have a patch ready, I'll submit it once this bugs been submitted.

Comment 1

10 years ago
Created attachment 284848 [details] [diff] [review]
Fix, part 1, patch to

Note that the patch to bug should also be applied because this solution uses runProcess.
Attachment #284848 - Flags: review?

Comment 2

10 years ago
Created attachment 284849 [details] [diff] [review]
Fix, part 2, patch to org\mozilla\javascript\tools\resources\

Comment 3

10 years ago
Created attachment 284850 [details]
Fix, part 3, new file, org\mozilla\javascript\tools\resources\

French translation to addition to

Comment 4

10 years ago
Created attachment 284851 [details]
Fix, part 4, new file,

Unit tests for (JUnit 4)

Environments this was tested on:
CentOS release 4.5 (Final)
Microsoft Windows XP [Version 5.1.2600]

To be sure, it should be tested on the Mac too.

Last part of fix.

Comment 5

8 years ago
((I know it's an old bug, but it's not RESOLVED))

I don't see a reason for load to expand env variables.
This is JavaScript, not shell scripting, if you can't use env vars the issue is a function for getting env vars is needed inside the shell so that you can grab the value of an env var and + it onto a path. load() is supposed to take a legal path to a file, NOT expected to follow shell substitution rules which rather than being helpful could result in gotchas where paths are substituted where they shouldn't be.

Recommend WONTFIX. You can already access env variables through LiveConnect.
Attachment #284848 - Flags: review?
You need to log in before you can comment on or make changes to this bug.