aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsundar <none@none>2014-06-05 18:31:11 +0530
committersundar <none@none>2014-06-05 18:31:11 +0530
commit3766722d463fcc909607d0d52e5500df9b28e7df (patch)
tree116f7d4ca5283d0660d83e8a0995da0d71e2d82c /src
parent4b0a69d09ea3c8c0ab75e1056d21fa493956c7e4 (diff)
downloadnashorn-3766722d463fcc909607d0d52e5500df9b28e7df.tar.gz
8044695: __stack__ becomes visible in Error properties
Reviewed-by: jlaskey, attila, lagergren
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;
}