Bug 50431

Summary: |delete name| in strict mode code should be an early error
Product: WebKit Reporter: Jeff Walden (remove +bwo to email) <jwalden+bwo>
Component: JavaScriptCoreAssignee: Oliver Hunt <oliver>
Status: RESOLVED FIXED    
Severity: Normal CC: oliver
Priority: P2 Keywords: ES5
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: javascript: try { eval("function x() { 'use strict'; delete y; }"); throw 'no error'; } catch (e) { alert(e instanceof SyntaxError ? "PASS" : "FAIL " + e); }
Attachments:
Description Flags
Patch ggaren: review+

Description Jeff Walden (remove +bwo to email) 2010-12-02 18:56:15 PST
ES5 16:

"An early error is an error that can be detected and reported prior to the evaluation of any construct in the Program containing the error. An implementation must report early errors in a Program prior to the first evaluation of that Program."

A name always evaluates to either an unresolvable Reference or a Reference with an environment record as its base.  But an object environment record's HasBinding method calls [[HasProperty]] and through it [[GetProperty]].  Neither of these in the spec has any side effect, nor does either terminate abruptly (ignoring OOM and the like), so only host objects matter.  But it seems clear enough that going down the rat's nest just for host objects (or for proxies should they reach full standardization) is a bad idea, so |delete name| should just be an early error.  This is also how it's implemented in SpiderMonkey.
Comment 1 Oliver Hunt 2010-12-20 16:05:45 PST
fixing now.
Comment 2 Oliver Hunt 2010-12-20 16:23:22 PST
Created attachment 77050 [details]
Patch
Comment 3 Geoffrey Garen 2010-12-20 16:39:02 PST
Comment on attachment 77050 [details]
Patch

r=me if you delete deleteProperty and related code.
Comment 4 Oliver Hunt 2010-12-20 17:02:48 PST
Committed r74377: <http://trac.webkit.org/changeset/74377>