forked from mozilla/rhino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missing properties are not enumerable when checking enumerability
When checking property enumerability _(`Object.prototype.propertyIsEnumerable`)_, missing properties should return `false` instead of throwing a `Property {0} not found.` exception. Fixes mozilla#415
- Loading branch information
1 parent
1a83fd3
commit 6e2b67f
Showing
2 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
testsrc/org/mozilla/javascript/tests/es5/StringPropertyIsEnumerableTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.mozilla.javascript.tests.es5; | ||
|
||
import org.junit.Test; | ||
import org.mozilla.javascript.NativeObject; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.mozilla.javascript.tests.Evaluator.eval; | ||
|
||
public class StringPropertyIsEnumerableTest { | ||
|
||
@Test | ||
public void testStringPropertyIsEnumerable() { | ||
NativeObject object = new NativeObject(); | ||
|
||
Object result = eval("'s'.propertyIsEnumerable(0)", "obj", object); | ||
|
||
assertFalse((Boolean)result); | ||
} | ||
|
||
} |