Bug 47672
| Summary: | ES5 strict mode bugs | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | kangax <kangax> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | barraclough, erights, ggaren, oliver |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | PC | ||
| OS: | OS X 10.6 | ||
| URL: | http://kangax.github.com/es5-compat-table/strict-mode/ | ||
| Bug Depends on: | 47788, 47791, 47833 | ||
| Bug Blocks: | |||
kangax
There are 3 oversights in the way strict mode works in webkit, which results in 4 failing tests with the above example page — http://kangax.github.com/es5-compat-table/strict-mode/
Also, for the ref, early error on "assignment to an unresolved reference" was discussed here — https://mail.mozilla.org/pipermail/es5-discuss/2010-October/003742.html
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
The tests being:
__i_dont_exist = 1; is a ReferenceError
arguments++; is a SyntaxError
(function(){ return this === undefined; })();
(function(){ return this === undefined; }).call();
Oliver Hunt
Fixing the reference error for global properties at the moment
Oliver Hunt
__i_dont_exist = blah should now be fixed.
Oliver Hunt
pre-/post-fix operations on arguments are now disallowed.
Oliver Hunt
i've got the null vs. undefined |this| fix up for review now
Oliver Hunt
And now the undefined vs null patch is landed.
kangax are there any other problems you've found?
kangax
Hey Oliver.
I don't have this fresh build yet, but the previous one seems to also fail to set strict mode for eval code (in certain cases). For example:
(function(){ "use strict"; eval('with({ }) { }') })(); // no error
To quote 10.1.1:
"Eval code is strict eval code if it begins with a Directive Prologue that contains a Use Strict Directive or if the call to eval is a direct call (see 15.1.2.1.1) to the eval function that is contained in strict mode code."
Note "direct call [...] contained in strict mode code". So based on my understanding (and actually, FF4 behavior) this should throw error, but currently doesn't.
Oliver Hunt
(In reply to comment #7)
> Hey Oliver.
>
> I don't have this fresh build yet, but the previous one seems to also fail to set strict mode for eval code (in certain cases). For example:
>
> (function(){ "use strict"; eval('with({ }) { }') })(); // no error
Was this in the inspector? I'm seeing weird behaviour where code in the inspectors console fails to trigger strict mode
kangax
(In reply to comment #8)
> (In reply to comment #7)
> > Hey Oliver.
> >
> > I don't have this fresh build yet, but the previous one seems to also fail to set strict mode for eval code (in certain cases). For example:
> >
> > (function(){ "use strict"; eval('with({ }) { }') })(); // no error
>
> Was this in the inspector? I'm seeing weird behaviour where code in the inspectors console fails to trigger strict mode
Ah. yes it was. Doesn't happen when run from within <script> element.
Well, then I have nothing else as far as strict mode. Will file bugs if I find anything.
Oliver Hunt
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > Hey Oliver.
> > >
> > > I don't have this fresh build yet, but the previous one seems to also fail to set strict mode for eval code (in certain cases). For example:
> > >
> > > (function(){ "use strict"; eval('with({ }) { }') })(); // no error
> >
> > Was this in the inspector? I'm seeing weird behaviour where code in the inspectors console fails to trigger strict mode
>
> Ah. yes it was. Doesn't happen when run from within <script> element.
>
> Well, then I have nothing else as far as strict mode. Will file bugs if I find anything.
I just landed a fix for the Function constructor which should appear in the next nightly
kangax
I think I'm seeing browser crash under strict mode. Filed a separate bug for it — https://bugs.webkit.org/show_bug.cgi?id=48109
Oliver, can you please take a look?
Gavin Barraclough
All the strict mode tests pass for me in ToT.