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

lack of URL.canParse exposing issue when using &embed #2409

Closed
Mearman opened this issue Jul 3, 2024 · 2 comments · Fixed by #2422
Closed

lack of URL.canParse exposing issue when using &embed #2409

Mearman opened this issue Jul 3, 2024 · 2 comments · Fixed by #2422
Assignees

Comments

@Mearman
Copy link
Collaborator

Mearman commented Jul 3, 2024

Issue exposed in Obsidian. I know that specifically is a very edge case but I think there is an underlying issue.
the following works

<iframe src="https://breadboard-ai.web.app/?board=https://raw.githubusercontent.com/ExaDev/breadboard/business-review-reply/packages/breadboard-web/public/graphs/business-review-replier-demo.json" style="width: 100%; height: 500px; border: 0;"></iframe>

whereas with the &embed param

<iframe src="https://breadboard-ai.web.app/?board=https://raw.githubusercontent.com/ExaDev/breadboard/business-review-reply/packages/breadboard-web/public/graphs/business-review-replier-demo.json&embed" style="width: 100%; height: 500px; border: 0;"></iframe>

yields the following error:

Uncaught (in promise) TypeError: URL.canParse is not a function
    at Main.makeRelativeToCurrentBoard_fn (index.ts:851:25)
    at Main.onStartBoard_fn (index.ts:866:17)
    at index.ts:556:11
makeRelativeToCurrentBoard_fn @ index.ts:851
onStartBoard_fn @ index.ts:866
(anonymous) @ index.ts:556
Promise.then (async)
Main @ index.ts:537
(anonymous) @ index.html:35

if (boardUrl && URL.canParse(boardUrl)) {

It smells funky to me that the non-embed works, but embed does not.

My nose says it might be something to do with when using &embed it gets redirected to &embed=

This is found in Obsidian Installer 1.4.13 which uses chromium 114.0.5735.289 and does not have canParse (see https://caniuse.com/mdn-api_url_canparse_static)

The appropriate Obsidian Chrome version can be installed with

brew install --cask https://raw.githubusercontent.com/Homebrew/homebrew-cask/cd10f80d8ec2604df6fa36e93c63238872886bc5/Casks/o/obsidian.rb

or

brew install --cask https://github.com/Homebrew/homebrew-cask/blob/24e9ef7a18d9725c21b5545736f6bcc1ccafc5da/Casks/g/google-chrome.rb
@alexandraM98
Copy link
Contributor

alexandraM98 commented Jul 4, 2024

I tried to replicate the above issues by running the visual editor locally and using both Obsidian and Chrome for Testing (chromium 114.0.5735.289). The results were the same for both, as described below:

Without embed param:

<iframe src="http://localhost:5173/?board=https://raw.githubusercontent.com/ExaDev/breadboard/business-review-reply/packages/breadboard-web/public/graphs/business-review-replier-demo.json" style="width: 100%; height: 500px; border: 0;"></iframe>

Although the iframe loads, I cannot interact with it due to the Uncaught (in promise) TypeError: URL.canParse is not a function error.

With embed param:

<iframe src="http://localhost:5173/?board=https://raw.githubusercontent.com/ExaDev/breadboard/business-review-reply/packages/breadboard-web/public/graphs/business-review-replier-demo.json&embed=" style="width: 100%; height: 500px; border: 0;"></iframe>

The above does not work. In addition to the URL.canParse error, the iframe itself does not render at all and it seems like the query string param is not recognised (attempting to print the url to the console displays an empty string and the url shows as http://localhost:5173/preview.html?board=&embed=true).

@paullewis
Copy link
Contributor

Yeah, that makes sense since URL.canParse landed in Chrome 119: https://caniuse.com/?search=canParse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants