lack of URL.canParse exposing issue when using `&embed`
Mearman opened this issue · comments
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
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
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
).
Yeah, that makes sense since URL.canParse
landed in Chrome 119: https://caniuse.com/?search=canParse.