Browse Source

Fix overwriting the value of 'arguments' through defineProperty

Mihail Stoykov 4 years ago
parent
commit
e1c977e55c
2 changed files with 8 additions and 1 deletions
  1. 1 1
      object_args.go
  2. 7 0
      tc39_test.go

+ 1 - 1
object_args.go

@@ -97,7 +97,7 @@ func (a *argumentsObject) defineOwnPropertyStr(name unistring.String, descr Prop
 			configurable: mapped.configurable,
 			configurable: mapped.configurable,
 			writable:     true,
 			writable:     true,
 			enumerable:   mapped.enumerable,
 			enumerable:   mapped.enumerable,
-			value:        mapped.get(a.val),
+			value:        *mapped.v,
 		}
 		}
 
 
 		val, ok := a.baseObject._defineOwnProperty(name, existing, descr, throw)
 		val, ok := a.baseObject._defineOwnProperty(name, existing, descr, throw)

+ 7 - 0
tc39_test.go

@@ -268,6 +268,12 @@ var (
 		"test/language/statements/for-in/head-var-bound-names-dup.js": true,
 		"test/language/statements/for-in/head-var-bound-names-dup.js": true,
 		"test/language/statements/for/head-let-destructuring.js":      true,
 		"test/language/statements/for/head-let-destructuring.js":      true,
 		"test/language/statements/for-in/head-let-destructuring.js":   true,
 		"test/language/statements/for-in/head-let-destructuring.js":   true,
+
+		// arguments exotic-object specifics
+		"test/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js":              true,
+		"test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js": true,
+		"test/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js":                          true,
+		"test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js":         true,
 	}
 	}
 
 
 	featuresBlackList = []string{
 	featuresBlackList = []string{
@@ -363,6 +369,7 @@ var (
 		"sec-try-*",
 		"sec-try-*",
 		"sec-strict-mode-of-ecmascript",
 		"sec-strict-mode-of-ecmascript",
 		"sec-let-and-const-declarations*",
 		"sec-let-and-const-declarations*",
+		"sec-arguments-exotic-objects-defineownproperty-p-desc",
 	}
 	}
 )
 )