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) {