From 8799f9f62bf37ad3432ff264a3e27eff1b00f7d2 Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Wed, 28 Jul 2004 15:20:08 +0000 Subject: [PATCH] Ignore any exception during script class initialization unless it is an instance of RhinoException. In this way lazily class loading or incompatible with the current JVMs jars will simply hide the script variables. --- js/rhino/src/org/mozilla/javascript/LazilyLoadedCtor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/rhino/src/org/mozilla/javascript/LazilyLoadedCtor.java b/js/rhino/src/org/mozilla/javascript/LazilyLoadedCtor.java index 5ccdabfb4859..a05a2a38d0dc 100644 --- a/js/rhino/src/org/mozilla/javascript/LazilyLoadedCtor.java +++ b/js/rhino/src/org/mozilla/javascript/LazilyLoadedCtor.java @@ -83,10 +83,14 @@ public final class LazilyLoadedCtor { try { ScriptableObject.defineClass(obj, cl, sealed); isReplaced = true; + } catch (RhinoException e) { + throw e; } catch (SecurityException ex) { removeOnError = true; - } catch (Exception e) { - throw Context.throwAsScriptRuntimeEx(e); + } catch (Throwable ex) { + // Ignore any other erors. Due to lazily class loading + // it may indicate absence of some necessary classes. + removeOnError = true; } } if (removeOnError) {