This is reproduced by the test specs/frame in
thatcher/env-js/tree/frame-scope as of
fa042d516cf1c26bafcd2e10ac61b6295d2d70e1.
This test fails with error messages like:
[java] could not load script file:///home/gei/Repos/Mainlines/env-js/specs/dom/spec.js
[java] ReferenceError: "XMLSerializer" is not defined.
[java] error loading script [object HTMLScriptElement] ReferenceError: "XMLSerializer" is not defined.
because top-level code in JavaScript files included by
<script> tags within HTML loaded into an IFrame doesn't have
access to global objects the way it should. The code executing in
the IFrame does have its own global object, and objects
defined in the global scope in one included JavaScript file (like
the QUnit framework) are accessible from others (like
specs/dom/spec.js), but the global scope seems not to be loaded
with the normal set of global objects. (For what it's worth, some
investigation I've done indicates that the global object creation
code in env.js itself does not execute each time an IFrame
is instantiated, so this may be part of the problem.) In addition,
while the test as committed to Git doesn't show this, I've also
found that including print() calls (intended for the
Rhino shell) in code loaded within an IFrame also generate
ReferenceErrors, but top.print() works as
expected.