Add renderMethodReady() using postMessage().#15
Open
BigBlueHat wants to merge 2 commits into
Open
Conversation
The implementation uses an object passed to `renderMethodReady()`. It currently supports
values of `{ready: true}` or `{error: {message: ...}}`. Obviously additional data could
be passed through on that object making this a risk if the renderer is not meant to know
of the results or if the JS in the sandbox could surface JS (perhaps embedded in an SVG
or PDF) if that were sent back through the `postMessage()`. So...we should proceed with
caution.
It is now possible to supply an `application/pdf` value to the parent page (for better or worse)
via `renderMethodReady({ready: true, pdf: ...data URL of application/pdf...})`.
Deploying vc-viewer with
|
| Latest commit: |
62a35f6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5feacd84.vc-viewer.pages.dev |
| Branch Preview URL: | https://render-ready.vc-viewer.pages.dev |
This was referenced May 19, 2026
dlongley
reviewed
May 19, 2026
Comment on lines
+54
to
+57
| window.renderMethodReady = function(resp) { | ||
| portPromise.then(port => port.postMessage( | ||
| !resp.error ? resp : {error: {message: resp.error.message}})); | ||
| }; |
Member
There was a problem hiding this comment.
Maybe we'll want a different name than renderMethodReady if we're going to pass other things -- or at least, we don't want to have both {ready: true} and renderMethodReady as the names, it seems redundant. Maybe it's the {ready: true} that should change -- and passing any object at all is optional.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The implementation uses an object passed to
renderMethodReady(). It currently supportsvalues of
{ready: true}or{error: {message: ...}}. Obviously additional data couldbe passed through on that object making this a risk if the renderer is not meant to know
of the results or if the JS in the sandbox could surface JS (perhaps embedded in an SVG
or PDF) if that were sent back through the
postMessage(). So...we should proceed withcaution.