Closed Bug 822283 Opened 7 years ago Closed 7 years ago

Poison TokenStream::strictMode() when not in the parser

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: Benjamin, Unassigned)

References

Details

Attachments

(1 file)

After parsing is done, if someone calls TokenStream::strictMode(), the StrictModeGetter will still access the parser's shared context to look for the strict flag. This is wrong when BytecodeEmitter is reporting a strict error a nested strict function (see bug 821470 and bug 821103). TokenStream::strictMode() should be poisoned after parsing, so errors can be detected.
Here's something. It makes APIs that access strictness not directly related to tokenizing private. I removed reportStrictWarning, since it is no longer used.
Attachment #693182 - Flags: review?(n.nethercote)
Comment on attachment 693182 [details] [diff] [review]
make strictness apis private

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

Looks good, thanks.

::: js/src/frontend/TokenStream.h
@@ +545,5 @@
>                                            va_list args);
>  
>    private:
> +    // This are private because they should only be called by the tokenizer
> +    // while tokenizing.

Maybe add something like "E.g. they shouldn't be called from the BytecodeEmitter."?
Attachment #693182 - Flags: review?(n.nethercote) → review+
https://hg.mozilla.org/mozilla-central/rev/391f4cf534e1
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.