using strict mode

105 views
Skip to first unread message

Charles Fei

unread,
Mar 5, 2015, 11:58:22 PM3/5/15
to mozill...@googlegroups.com
Hi guys,

I'm embedding rhino to my current project and I want strict mode enabled which introduced from 1.6r6 [New_in_Rhino_1.6R6]

but the document was quite ambiguous:
To enable strict mode for the Rhino shell, add -strict to the command line. If you are using the API directly, set the Context feature FEATURE_STRICT_MODE.

Anyone knows how to set the context feature? I'm using Rhino1.7R2,  FEATURE_STRICT_MODE field is final in the context class.

Cheers,

Charles

Greg Brail

unread,
Mar 6, 2015, 7:51:59 PM3/6/15
to mozill...@googlegroups.com
The way that you customize a Context in Rhino is to create a subclass of ContextFactory, and then pass the ContextFactory to Context.enter(). You then override "hasFeature" in your ContextFactory implementation to return different results than the default.

I don't understand why it was done that way but that's how it works.

With that said, I believe that "use strict" in a script works the way it's supposed to even if you don't set this flag.

--
You received this message because you are subscribed to the Google Groups "mozilla-rhino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozilla-rhin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
greg brail | apigee twitter @gbrail

Reply all
Reply to author
Forward
0 new messages