From d1a833873cf3dc2709089a135c651fd5b62a2744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 25 Apr 2011 18:41:13 +0000 Subject: [PATCH] Set prototype and parent scope for JavaAdapters extending ScriptableObject. --- src/org/mozilla/javascript/JavaAdapter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/mozilla/javascript/JavaAdapter.java b/src/org/mozilla/javascript/JavaAdapter.java index 0ccde2beb5..cd10f63547 100644 --- a/src/org/mozilla/javascript/JavaAdapter.java +++ b/src/org/mozilla/javascript/JavaAdapter.java @@ -208,6 +208,10 @@ static Object js_createAdapter(Context cx, Scriptable scope, Object[] args) if (self instanceof Wrapper) { Object unwrapped = ((Wrapper) self).unwrap(); if (unwrapped instanceof Scriptable) { + if (unwrapped instanceof ScriptableObject) { + ScriptRuntime.setObjectProtoAndParent( + (ScriptableObject)unwrapped, scope); + } return unwrapped; } }