Fix for AVATAR_JS-158, handle JS Object with null prototype
This commit is contained in:
parent
16bfaa6fba
commit
fda778d3c8
|
@ -1,5 +1,5 @@
|
|||
--- ../node/lib/repl.js 2013-12-16 17:07:31.000000000 +0100
|
||||
+++ ./src/main/js/lib/repl.js 2014-01-13 15:40:15.000000000 +0100
|
||||
+++ src/main/js/lib/repl.js 2014-01-13 18:56:58.000000000 +0100
|
||||
@@ -236,6 +236,8 @@
|
||||
|
||||
// First we attempt to eval as expression with parens.
|
||||
|
@ -19,14 +19,16 @@
|
|||
|
||||
} else {
|
||||
finish(null);
|
||||
@@ -565,7 +570,18 @@
|
||||
@@ -565,7 +570,20 @@
|
||||
|
||||
if (obj != null) {
|
||||
if (typeof obj === 'object' || typeof obj === 'function') {
|
||||
+ try {
|
||||
memberGroups.push(Object.getOwnPropertyNames(obj));
|
||||
+ } catch(err) {
|
||||
+ if ((typeof(obj) == 'object' || typeof(obj) == 'function') && !(obj instanceof Object)) { // Completion on java
|
||||
+ if (typeof(obj.__proto__) === 'undefined' &&
|
||||
+ (typeof(obj) == 'object' || typeof(obj) == 'function') &&
|
||||
+ !(obj instanceof Object)) { // Completion on java
|
||||
+ var arr = obj.class.getMethods()
|
||||
+ var methods = [];
|
||||
+ for (var m in arr) {
|
||||
|
@ -38,7 +40,7 @@
|
|||
}
|
||||
// works for non-objects
|
||||
try {
|
||||
@@ -923,5 +939,5 @@
|
||||
@@ -923,5 +941,5 @@
|
||||
// "strict mode" syntax errors
|
||||
!e.match(/^SyntaxError: .*strict mode.*/i) &&
|
||||
// JSON.parse() error
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
--- ../node/lib/util.js 2013-12-09 10:27:58.000000000 +0100
|
||||
+++ ./src/main/js/lib/util.js 2014-01-13 15:51:02.000000000 +0100
|
||||
@@ -218,6 +218,12 @@
|
||||
+++ src/main/js/lib/util.js 2014-01-13 18:53:58.000000000 +0100
|
||||
@@ -218,6 +218,14 @@
|
||||
return primitive;
|
||||
}
|
||||
|
||||
+ // Java thing, can be a Dynalink function, a java instance, a java class
|
||||
+ if ((typeof(value) == 'object' || typeof(value) == 'function') && !(value instanceof Object)) { // java
|
||||
+ if (typeof(value.__proto__) === 'undefined' &&
|
||||
+ (typeof(value) == 'object' || typeof(value) == 'function') &&
|
||||
+ !(value instanceof Object)) { // java
|
||||
+ // equivalent to toString whatever toString exists or not
|
||||
+ return "" + value;
|
||||
+ }
|
||||
|
|
Loading…
Reference in New Issue