diff --git a/src/org/mozilla/javascript/NativeScript.java b/src/org/mozilla/javascript/NativeScript.java
index <HASH>..<HASH> 100644
--- a/src/org/mozilla/javascript/NativeScript.java
+++ b/src/org/mozilla/javascript/NativeScript.java
@@ -192,7 +192,10 @@ public class NativeScript extends NativeFunction implements Script
                         : ScriptRuntime.toString(args[0]);
 
         Script script = compile(cx, scope, source);
-        return new NativeScript(script);
+        NativeScript nscript = new NativeScript(script);
+        nscript.setParentScope(scope);
+        nscript.setPrototype(getClassPrototype(scope, "Script"));
+        return nscript;
     }
 
     private Scriptable js_compile(Context cx, Scriptable scope, String source)
Fixing <URL> result has no prototype and scope chains

Fix: initialize scope and prototype for Script instances in
NativeScript.jsConstructor

If Script is called as a constructor, it will get the proper parent and
prototype from the generic code to initialize newly constructed objects but if
it is called as a function, then it is the responsibility of the call
implementation to do the job.