webgpu_inspector icon indicating copy to clipboard operation
webgpu_inspector copied to clipboard

URL issue

Open maierfelix opened this issue 1 year ago • 7 comments
trafficstars

For some URLs like http://localhost:5800 I'm getting Failed to construct 'URL': Invalid URL in https://github.com/brendan-duncan/webgpu_inspector/blob/dbb8ebc8d034b6d0cd573e0c4573e9c88cd457e5/src/webgpu_inspector.js#L2019

maierfelix avatar Jul 31 '24 10:07 maierfelix

Can you provide a small repo? I tried a few URL patterns like you suggested, but haven't hit the error yet.

brendan-duncan avatar Aug 02 '24 04:08 brendan-duncan

I found a repo for the error. Not sure if it's the same issue you have or not. I pushed an update to github that seems to get around the problem I saw in testing, which is the pattern new Worker("/foo/bar.js").

brendan-duncan avatar Aug 02 '24 21:08 brendan-duncan

Thanks for looking into this! Yes I just checked the url and it's indeed a path without hostname which new URL() then throws an error for.

maierfelix avatar Aug 05 '24 10:08 maierfelix

It still throws an error during the URL construction here. In my case the URL is: http://localhost:5800./js/test.js. Changing the URL construction to _url = new URL(`${baseUrl.protocol}//${baseUrl.host}/${url}`); fixed it for me

maierfelix avatar Aug 05 '24 10:08 maierfelix

Thanks for the extra info, I'll look into it soon. I suppose the additional fix is to check if url starts with a "/" or not, and add the "/" if not.

brendan-duncan avatar Aug 05 '24 16:08 brendan-duncan

I pushed a fix for that to git.

brendan-duncan avatar Aug 07 '24 02:08 brendan-duncan

It works, thanks a lot!

maierfelix avatar Aug 13 '24 10:08 maierfelix

@brendan-duncan Is it possible to get this fix released to the chrome extension?

fanciful-marmot avatar Aug 29 '24 14:08 fanciful-marmot

Oh yeah, sure. I got distracted by work and forgot. I'll push a chrome store update today, and it'll take a day or so for it to go public.

brendan-duncan avatar Aug 29 '24 15:08 brendan-duncan

I submitted the update to the chrome store.

brendan-duncan avatar Aug 30 '24 00:08 brendan-duncan

It's on the store now. I'll go ahead and close the ticket.

brendan-duncan avatar Aug 30 '24 05:08 brendan-duncan