Skip to content

Conversation

@mookums
Copy link
Contributor

@mookums mookums commented May 7, 2025

This fixes the issue with URLs being resolved resulting in a weird single slash case. It introduces a stichUrl function that basically does what the old resolve was supposed to do.

This was present here and was the cause of the error.MissingHost:

info(http_client): redirecting to: GET https://www.reddit.com/r/Zig/comments/1ke7bau/zig_has_great_potential_for_async/?rdt=45651
info(browser): GET https://www.reddit.com/r/Zig/comments/1ke7bau/zig_has_great_potential_for_async/?rdt=45651 200
info(browser): fetch https://www.redditstatic.com/shreddit/en-US/icon-97fc6e52.js: 200
info(browser): fetch https://www.redditstatic.com/shreddit/en-US/shell-ff439fbd.js: 200
error(js): fetchModuleSource for './icon-97fc6e52.js' fetch error: error.MissingHost


#
# Fatal error in ../../../../src/src/execution/isolate-inl.h, line 98
# Debug check failed: has_scheduled_exception().
#
#
#
#FailureMessage Object: 0x7fff872fd110
==== C stack trace ===============================

    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2b3a513]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2b385bd]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2be57e2]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2be5215]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2ca7f13]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x3f9b3b1]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x3fab444]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x3faae39]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2c174e7]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2b2abc0]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248b2cb]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248b533]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248bed7]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248c1dc]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248c77b]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248daf7]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x248f068]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2493bc9]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2495008]
    /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca) [0x7d080aa2a1ca]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x7d080aa2a28b]
    /home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda() [0x2398025]
run
└─ run lightpanda failure
error: the following command terminated unexpectedly:
/home/pierre/wrk/browser/.zig-cache/o/e8a82428b898dfe03a772bfde98d5109/lightpanda fetch https://www.reddit.com/r/Zig/comments/1ke7bau/zig_has_great_potential_for_async/
Build Summary: 3/5 steps succeeded; 1 failed
run transitive failure
└─ run lightpanda failure
error: the following build command failed with exit code 1:
/home/pierre/wrk/browser/.zig-cache/o/99705665cadf0f1fc911ec9c0358adb5/build /usr/local/zig-0.14.0/zig /usr/local/zig-0.14.0/lib /home/pierre/wrk/browser /home/pierre/wrk/browser/.zig-cache /home/pierre/.cache/zig --seed 0x2cc86eb5 -Z7fd4f6f6d1706933 run -- fetch https://www.reddit.com/r/Zig/comments/1ke7bau/zig_has_great_potential_for_async/

@mookums mookums requested a review from krichprollsch May 7, 2025 15:29
@karlseguin
Copy link
Collaborator

I don't think base is guaranteed to be a full url. I think it could be relative, e.g. shreddit/en-US/shell-ff439fbd.js in which case this won't work.

I assume we didn't originally use std.Uri.resolve_inplace, because of its poor ergonomics - requiring a buffer and a std.Uri.

Also, see uri.zig (which I hope we can one day use to improve / wrap the ergonomics around URL manipulation) where this would probably best be located.

@krichprollsch
Copy link
Member

Indeed, I introduced the base parameter to resolve modules. see #464 and #470
In this case, base is the src attribute value of the script tag currently executed.
I didn't think of the full url case...

@mookums mookums force-pushed the fix-url-resolving branch from ff9fa7d to 15be423 Compare May 9, 2025 14:01
@karlseguin karlseguin merged commit b5eea21 into main May 11, 2025
9 checks passed
@karlseguin karlseguin deleted the fix-url-resolving branch May 11, 2025 00:38
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants