Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

scoping in iframes: global objects missing

#156

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.

Reported by gleneivey · April 16th, 2010 @ 11:58 AM

State: new
Milestone: none
Assigned to: nobody

Activity

  1. gleneivey
    gleneivey
    • Tag changed from scope iframe to iframe, scope

    April 16th, 2010 @ 12:10 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.