src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java

Print this page
rev 754 : 8030197: Nashorn: Object.defineProperty() can be lured to change fixed NaN property
Reviewed-by: attila, jlaskey
rev 755 : 8035948: Redesign property listeners for shared classes
Reviewed-by: sundar, lagergren
rev 760 : 8037400: Remove getInitialMap getters and GlobalObject interface
Reviewed-by: lagergren, jlaskey, attila

*** 53,68 **** public Object enumerable; // initialized by nasgen private static PropertyMap $nasgenmap$; - static PropertyMap getInitialMap() { - return $nasgenmap$; - } - GenericPropertyDescriptor(final boolean configurable, final boolean enumerable, final Global global) { ! super(global.getObjectPrototype(), global.getGenericPropertyDescriptorMap()); this.configurable = configurable; this.enumerable = enumerable; } @Override --- 53,64 ---- public Object enumerable; // initialized by nasgen private static PropertyMap $nasgenmap$; GenericPropertyDescriptor(final boolean configurable, final boolean enumerable, final Global global) { ! super(global.getObjectPrototype(), $nasgenmap$); this.configurable = configurable; this.enumerable = enumerable; } @Override
*** 147,156 **** --- 143,169 ---- public int type() { return GENERIC; } @Override + public boolean hasAndEquals(final PropertyDescriptor other) { + if (has(CONFIGURABLE) && other.has(CONFIGURABLE)) { + if (isConfigurable() != other.isConfigurable()) { + return false; + } + } + + if (has(ENUMERABLE) && other.has(ENUMERABLE)) { + if (isEnumerable() != other.isEnumerable()) { + return false; + } + } + + return true; + } + + @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof GenericPropertyDescriptor)) {