Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jeremyrsmith
Copy link
Contributor

Sandbox HTML output in an iframe.

This is to prevent malicious HTML from accessing the notebook or communicating with the server.

An attempt is made to keep the iframe sized to its content so that it looks like it's reasonably inline. But this is tricky and will probably need some refinement as issues are discovered.

import {ArrayType, MapType, OptionalType, StructField, StructType} from "../../data/data_type";
import embed from "vega-embed";

const frames: Record<number, HTMLIFrameElement> = {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better if this was scoped to each notebook?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the practical benefit would be, other than guilt about global state in JavaScript-land. This is a big stupid workaround to begin with; I figured there was no point in pretending it wasn't 😛

resizeTimeout = window.setTimeout(updateSizes, 250);
})

function updateSizes() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still work if the frame is currently out of view (when another notebook tab is selected)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so? I mean the function will work, but I don't know what the frame will say about itself if its host iframe isn't in the DOM. 😬

@jeremyrsmith jeremyrsmith force-pushed the kernel-launching-issues branch from 22e8ebf to c6d364a Compare February 22, 2021 19:38
Base automatically changed from kernel-launching-issues to master February 22, 2021 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants