From 2b2decb7d30712da5332a340e5d212f9c124737c Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Mon, 16 Aug 2004 09:57:15 +0000 Subject: [PATCH] Fixing regression caused by the committed patch under bug 255595 --- js/rhino/src/org/mozilla/javascript/ScriptRuntime.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java b/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java index bfe19bfdfb2d..dd74827a12ff 100644 --- a/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java +++ b/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java @@ -124,7 +124,13 @@ public class ScriptRuntime { scope = new NativeObject(); } scope.associateValue(LIBRARY_SCOPE_KEY, scope); - scope.associateValue(CONTEXT_FACTORY_KEY, cx.getFactory()); + ContextFactory factory = cx.getFactory(); + if (factory == null) { + // factory is null for Context asociated with the current thread + // via Context.enter() + factory = ContextFactory.getGlobal(); + } + scope.associateValue(CONTEXT_FACTORY_KEY, factory); (new ClassCache()).associate(scope); BaseFunction.init(cx, scope, sealed);