aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/nashorn/internal/runtime/resources
diff options
context:
space:
mode:
authorsundar <none@none>2013-03-28 20:48:25 +0530
committersundar <none@none>2013-03-28 20:48:25 +0530
commite394a4a68d38a1c659e79c623cfccc1ac131a287 (patch)
treec7a01bd629bf6309b49e0fa2cb5b1b5bcbf1a752 /src/jdk/nashorn/internal/runtime/resources
parentd1011f14290fbcee99b6bd75f7226351de30858b (diff)
downloadnashorn-e394a4a68d38a1c659e79c623cfccc1ac131a287.tar.gz
8010924: Dealing with undefined property gets you a fatal stack
Reviewed-by: lagergren, jlaskey
Diffstat (limited to 'src/jdk/nashorn/internal/runtime/resources')
-rw-r--r--src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js b/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js
index 0b967d69..206a193f 100644
--- a/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js
+++ b/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js
@@ -49,6 +49,7 @@ Object.defineProperty(this, "importPackage", {
var global = this;
var oldNoSuchProperty = global.__noSuchProperty__;
global.__noSuchProperty__ = function(name) {
+ 'use strict';
for (var i in _packages) {
try {
var type = Java.type(_packages[i] + "." + name);
@@ -57,7 +58,15 @@ Object.defineProperty(this, "importPackage", {
} catch (e) {}
}
- return oldNoSuchProperty? oldNoSuchProperty(name) : undefined;
+ if (oldNoSuchProperty) {
+ return oldNoSuchProperty.call(this, name);
+ } else {
+ if (this === undefined) {
+ throw new ReferenceError(name + " is not defined");
+ } else {
+ return undefined;
+ }
+ }
}
var prefix = "[JavaPackage ";