aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jdk/nashorn/internal/objects/NativeError.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/jdk/nashorn/internal/objects/NativeError.java b/src/jdk/nashorn/internal/objects/NativeError.java
index 1b6b8094..18aa11e5 100644
--- a/src/jdk/nashorn/internal/objects/NativeError.java
+++ b/src/jdk/nashorn/internal/objects/NativeError.java
@@ -327,7 +327,12 @@ public final class NativeError extends ScriptObject {
final Object exception = ECMAException.getException(sobj);
if (exception instanceof Throwable) {
Object value = getScriptStackString(sobj, (Throwable)exception);
- sobj.put(STACK, value, false);
+ if (sobj.hasOwnProperty(STACK)) {
+ sobj.put(STACK, value, false);
+ } else {
+ sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value);
+ }
+
return value;
}
@@ -346,7 +351,12 @@ public final class NativeError extends ScriptObject {
public static Object setStack(final Object self, final Object value) {
Global.checkObject(self);
final ScriptObject sobj = (ScriptObject)self;
- sobj.set(STACK, value, false);
+ if (sobj.hasOwnProperty(STACK)) {
+ sobj.put(STACK, value, false);
+ } else {
+ sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value);
+ }
+
return value;
}