aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsundar <none@none>2014-01-17 20:09:47 +0530
committersundar <none@none>2014-01-17 20:09:47 +0530
commit798250cf4d3447691959ff5fad39373296786f4f (patch)
tree26f9fdc5480a972a61ee64470bb305abbd61b0d0 /src
parent227595398f06e485ee717375403f93232f41fb2e (diff)
downloadnashorn-798250cf4d3447691959ff5fad39373296786f4f.tar.gz
8032060: PropertyMap of Error objects is not stable
Reviewed-by: jlaskey, hannesw
Diffstat (limited to 'src')
-rw-r--r--src/jdk/nashorn/internal/objects/Global.java21
-rw-r--r--src/jdk/nashorn/internal/objects/NativeError.java4
-rw-r--r--src/jdk/nashorn/internal/objects/NativeEvalError.java4
-rw-r--r--src/jdk/nashorn/internal/objects/NativeRangeError.java4
-rw-r--r--src/jdk/nashorn/internal/objects/NativeReferenceError.java4
-rw-r--r--src/jdk/nashorn/internal/objects/NativeSyntaxError.java4
-rw-r--r--src/jdk/nashorn/internal/objects/NativeTypeError.java4
-rw-r--r--src/jdk/nashorn/internal/objects/NativeURIError.java4
-rw-r--r--src/jdk/nashorn/internal/runtime/Context.java5
-rw-r--r--src/jdk/nashorn/internal/runtime/ECMAException.java1
10 files changed, 52 insertions, 3 deletions
diff --git a/src/jdk/nashorn/internal/objects/Global.java b/src/jdk/nashorn/internal/objects/Global.java
index db79f5f9..819095c0 100644
--- a/src/jdk/nashorn/internal/objects/Global.java
+++ b/src/jdk/nashorn/internal/objects/Global.java
@@ -1705,8 +1705,25 @@ public final class Global extends ScriptObject implements GlobalObject, Scope {
initScripting(env);
}
- if (Context.DEBUG && System.getSecurityManager() == null) {
- initDebug();
+ if (Context.DEBUG) {
+ boolean debugOkay;
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ try {
+ sm.checkPermission(new RuntimePermission(Context.NASHORN_DEBUG_MODE));
+ debugOkay = true;
+ } catch (final SecurityException ignored) {
+ // if no permission, don't initialize Debug object
+ debugOkay = false;
+ }
+
+ } else {
+ debugOkay = true;
+ }
+
+ if (debugOkay) {
+ initDebug();
+ }
}
copyBuiltins();
diff --git a/src/jdk/nashorn/internal/objects/NativeError.java b/src/jdk/nashorn/internal/objects/NativeError.java
index 53355f9f..0541084d 100644
--- a/src/jdk/nashorn/internal/objects/NativeError.java
+++ b/src/jdk/nashorn/internal/objects/NativeError.java
@@ -85,6 +85,10 @@ public final class NativeError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/objects/NativeEvalError.java b/src/jdk/nashorn/internal/objects/NativeEvalError.java
index 357cee14..df8164c1 100644
--- a/src/jdk/nashorn/internal/objects/NativeEvalError.java
+++ b/src/jdk/nashorn/internal/objects/NativeEvalError.java
@@ -55,6 +55,10 @@ public final class NativeEvalError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/objects/NativeRangeError.java b/src/jdk/nashorn/internal/objects/NativeRangeError.java
index 5c61b2fd..a71b28b1 100644
--- a/src/jdk/nashorn/internal/objects/NativeRangeError.java
+++ b/src/jdk/nashorn/internal/objects/NativeRangeError.java
@@ -55,6 +55,10 @@ public final class NativeRangeError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/objects/NativeReferenceError.java b/src/jdk/nashorn/internal/objects/NativeReferenceError.java
index 76eccb63..d02a3250 100644
--- a/src/jdk/nashorn/internal/objects/NativeReferenceError.java
+++ b/src/jdk/nashorn/internal/objects/NativeReferenceError.java
@@ -55,6 +55,10 @@ public final class NativeReferenceError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/objects/NativeSyntaxError.java b/src/jdk/nashorn/internal/objects/NativeSyntaxError.java
index 6d892906..5d71ade7 100644
--- a/src/jdk/nashorn/internal/objects/NativeSyntaxError.java
+++ b/src/jdk/nashorn/internal/objects/NativeSyntaxError.java
@@ -55,6 +55,10 @@ public final class NativeSyntaxError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/objects/NativeTypeError.java b/src/jdk/nashorn/internal/objects/NativeTypeError.java
index 472df9a7..8857da71 100644
--- a/src/jdk/nashorn/internal/objects/NativeTypeError.java
+++ b/src/jdk/nashorn/internal/objects/NativeTypeError.java
@@ -55,6 +55,10 @@ public final class NativeTypeError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/objects/NativeURIError.java b/src/jdk/nashorn/internal/objects/NativeURIError.java
index c82afe50..7ff6c196 100644
--- a/src/jdk/nashorn/internal/objects/NativeURIError.java
+++ b/src/jdk/nashorn/internal/objects/NativeURIError.java
@@ -54,6 +54,10 @@ public final class NativeURIError extends ScriptObject {
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
public Object message;
+ /** Nashorn extension: underlying exception */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public Object nashornException;
+
// initialized by nasgen
private static PropertyMap $nasgenmap$;
diff --git a/src/jdk/nashorn/internal/runtime/Context.java b/src/jdk/nashorn/internal/runtime/Context.java
index 86b5abd8..55114881 100644
--- a/src/jdk/nashorn/internal/runtime/Context.java
+++ b/src/jdk/nashorn/internal/runtime/Context.java
@@ -91,6 +91,11 @@ public final class Context {
*/
public static final String NASHORN_JAVA_REFLECTION = "nashorn.JavaReflection";
+ /**
+ * Permission to enable nashorn debug mode.
+ */
+ public static final String NASHORN_DEBUG_MODE = "nashorn.debugMode";
+
// nashorn load psuedo URL prefixes
private static final String LOAD_CLASSPATH = "classpath:";
private static final String LOAD_FX = "fx:";
diff --git a/src/jdk/nashorn/internal/runtime/ECMAException.java b/src/jdk/nashorn/internal/runtime/ECMAException.java
index b7308782..c900963d 100644
--- a/src/jdk/nashorn/internal/runtime/ECMAException.java
+++ b/src/jdk/nashorn/internal/runtime/ECMAException.java
@@ -33,7 +33,6 @@ import javax.script.ScriptException;
import jdk.nashorn.api.scripting.NashornException;
import jdk.nashorn.internal.codegen.CompilerConstants.Call;
import jdk.nashorn.internal.codegen.CompilerConstants.FieldAccess;
-import jdk.nashorn.internal.objects.NativeError;
/**
* Exception used to implement ECMAScript "throw" from scripts. The actual thrown