Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parent.parent is not top-level viewer for task pane content if viewer itself is in iframe #130

Closed
jumpinjackie opened this issue Feb 21, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@jumpinjackie
Copy link
Owner

Reported by Rémy Gourrat

http://osgeo-org.1560.x6.nabble.com/mapguide-react-js-embeded-in-div-or-iframe-issue-td5308462.html

When loading devguide samples, the pageLoadFunctions.js fails with Cannot read property 'mapInit' of undefined, the expression being parent.parent.mapFrame.mapInit

The issue is that in the original AJAX viewer, the task pane is 2 frames down from the top level content.

For this viewer, the task pane is only 1 frame down (the iframe itself). However, the expression parent.parent.mapFrame.mapInit is still valid because window.parent == window is true for top-level content. That is to say, you can walk up the parent as many times as you want because at the top-level, a widows's parent is itself.

However, when this viewer is embedded in an iframe, this trick falls apart because the task pane content will actually try to walk 2 physical frames upwards because there are actually 2 levels of frame nesting (1. The task pane's iframe, 2. The iframe the viewer is in). Because our AJAX Viewer shim API is installed at the content window where the viewer is mounted, the task pane content skips over this frame and enters a parent content window where the shim APIs are not installed, hence the error.

The fix is to install the AJAX Viewer shim APIs at the viewer's content window and its parent. If not embedded in a frame, this would just install the shim APIs in the viewer's content window twice, which is inconsequential.

@jumpinjackie jumpinjackie added this to the 0.9 milestone Feb 21, 2017
@jumpinjackie jumpinjackie self-assigned this Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant