Fix issue #115
This commit is contained in:
parent
30d1d89e91
commit
360b7df75b
3 changed files with 31 additions and 19 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Version 2.0.6
|
||||
|
||||
Fixed issues #122 #123
|
||||
Fixed issues #115 #122 #123
|
||||
|
||||
Improved background processing of Drone build commands.
|
||||
|
||||
|
|
|
@ -640,15 +640,7 @@ function __onEnable ( __engine, __plugin, __script )
|
|||
global.self = sender;
|
||||
global.__engine = __engine;
|
||||
try {
|
||||
if ( typeof eval == 'undefined' ) {
|
||||
jsResult = __engine.eval(fnBody);
|
||||
} else {
|
||||
/*
|
||||
nashorn
|
||||
https://bugs.openjdk.java.net/browse/JDK-8034055
|
||||
*/
|
||||
jsResult = eval( fnBody );
|
||||
}
|
||||
if ( typeof jsResult != 'undefined' ) {
|
||||
if ( jsResult == null) {
|
||||
sender.sendMessage('(null)');
|
||||
|
@ -661,10 +653,15 @@ function __onEnable ( __engine, __plugin, __script )
|
|||
sender.sendMessage( 'Error while trying to evaluate javascript: ' + fnBody + ', Error: '+ e );
|
||||
throw e;
|
||||
} finally {
|
||||
/*
|
||||
wph 20140312 don't delete self on nashorn until https://bugs.openjdk.java.net/browse/JDK-8034055 is fixed
|
||||
*/
|
||||
if ( typeof Java === 'undefined' ) { // Java is an object in Nashorn
|
||||
delete global.self;
|
||||
delete global.__engine;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( cmdName == 'jsp' ) {
|
||||
cmdModule.exec( jsArgs, sender );
|
||||
result = true;
|
||||
|
|
|
@ -36,6 +36,15 @@ var _getProperties = function( o ) {
|
|||
typeofProperty;
|
||||
|
||||
if ( _isJavaObject( o ) ) {
|
||||
/*
|
||||
fix for issue #115 - java objects are not iterable
|
||||
see: http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-March/002790.html
|
||||
*/
|
||||
if ( typeof Object.bindProperties === 'function' ) {
|
||||
var placeholder = {};
|
||||
Object.bindProperties(placeholder, o);
|
||||
o = placeholder;
|
||||
}
|
||||
propertyLoop:
|
||||
for ( i in o ) {
|
||||
//
|
||||
|
@ -130,6 +139,8 @@ var onTabCompleteJS = function( result, cmdSender, pluginCmd, cmdAlias, cmdArgs
|
|||
|
||||
symbol = global[name];
|
||||
|
||||
//print('DEBUG: name=' + name + ',symbol=' + symbol);
|
||||
|
||||
lastGoodSymbol = symbol;
|
||||
if ( typeof symbol !== 'undefined' ) {
|
||||
for ( i = 1; i < parts.length; i++ ) {
|
||||
|
@ -141,9 +152,13 @@ var onTabCompleteJS = function( result, cmdSender, pluginCmd, cmdAlias, cmdArgs
|
|||
if ( typeof symbol == 'undefined' ) {
|
||||
break;
|
||||
}
|
||||
// nashorn - object[missingProperty] returns null not undefined
|
||||
if ( symbol == null ) {
|
||||
break;
|
||||
}
|
||||
lastGoodSymbol = symbol;
|
||||
}
|
||||
if ( typeof symbol == 'undefined' ) {
|
||||
if ( typeof symbol == 'undefined' || symbol === null) {
|
||||
//
|
||||
// look up partial matches against last good symbol
|
||||
//
|
||||
|
|
Reference in a new issue