Last Comment Bug 679138 - argv past script argument should not be interpreted as options
: argv past script argument should not be interpreted as options
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
: -- normal (vote)
: mozilla9
Assigned To: Chris Leary [:cdleary] (not checking bugmail)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-15 14:23 PDT by Chris Leary [:cdleary] (not checking bugmail)
Modified: 2011-08-30 04:48 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Script arg terminates options. (7.44 KB, patch)
2011-08-15 14:32 PDT, Chris Leary [:cdleary] (not checking bugmail)
dvander: review+
Details | Diff | Splinter Review

Description Chris Leary [:cdleary] (not checking bugmail) 2011-08-15 14:23:43 PDT
Expected behavior:

<<EOF
print(uneval(arguments))
EOF

$ ./js foo.js -q
["-q"]
Comment 1 Chris Leary [:cdleary] (not checking bugmail) 2011-08-15 14:32:53 PDT
Created attachment 553267 [details] [diff] [review]
Script arg terminates options.

This also gives us the ability to make a |--| option for people passing |-f| if we cared.
Comment 2 David Anderson [:dvander] 2011-08-16 00:06:37 PDT
Comment on attachment 553267 [details] [diff] [review]
Script arg terminates options.

Review of attachment 553267 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/shell/jsoptparse.h
@@ +78,5 @@
>  
>      virtual ~Option() = 0;
>  
> +    void setTerminatesOptions(bool enabled) { terminatesOptions = enabled; }
> +    bool getTerminatesOptions() const { return terminatesOptions; }

I think this reads better as just "terminatesOptions()" but get is fine too

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