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

[Bug] Luakit not re-emitting "send-request" when redirecting after handling it the first time #1062

Open
ghost opened this issue Oct 11, 2023 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Oct 11, 2023

Current Behavior:
When using a webmodule that rewrites the url like this:

luakit.add_signal("page-created", function(page)
    page:add_signal("send-request", function (_, uri)
        return "https://example.com"
    end)
end)

Other webmodules that depend on send-request will now fail, because nothing is triggered:

luakit.add_signal("page-created", function(page)
    print("'page-created' is triggered!")
    page:add_signal("send-request", function(_, uri)
        print("'send-request' is triggered!")
    end)
end)

This'll only print 'page-created' is triggered!:
2023-10-11-142754_727x102_scrot

Desired Behavior:
When redirecting/changing the destination URL, send-request should be triggered again (as the URL is changed).

How can we reproduce it (step by step):

  1. Create 2 webmodules, wm_one.lua:
luakit.add_signal("page-created", function(page)
    page:add_signal("send-request", function (_, uri)
        return "https://example.com"
    end)
end)

and wm_two.lua:

luakit.add_signal("page-created", function(page)
    print("'page-created' is triggered!")
    page:add_signal("send-request", function(_, uri)
        print("'send-request' is triggered!")
    end)
end)
  1. Now load both in your userconf.lua or whatever you use:
require_web_module("wm_one")
require_web_module("wm_two")
  1. Open luakit (should redirect to https://example.com)

As you can see, only 'page-created' is triggered! appears in the terminal

Environment:

Linux Distribution & Version: Linux host 6.1.56-0-lts #1-Alpine SMP PREEMPT_DYNAMIC Fri, 06 Oct 2023 15:07:55 0000 x86_64 Linux
Output of luakit --version: luakit 68e4ffc7 built with webkit 2.40.1 (installed version: 2.40.5)

Note about webkit issues:

If you're reporting a rendering issue, please test it with the gnome
browser ephiphany as well. If the issue occurs there too, we're very
likely not able to help. These issues should be reported to webkit:
https://bugs.webkit.org

@ghost
Copy link
Author

ghost commented Nov 2, 2023

Back from a break, and I've figured out (I think) where the problem is:

webkit_uri_request_set_uri(request, lua_tostring(L, -1));

It never emits send-request again after calling webkit_uri_request_set_uri, so if a redirect does happen, there is no way of knowing it happened (because send-request gets caught, and isn't sent again).

This breaks all but the single module that catches send-request, and redirects it to something else.

Could this be fixed by simply re-emitting send-request?

@ghost ghost changed the title [Bug] Redirects (from webmodules) won't trigger "send-request" [Bug] Luakit not re-emitting "send-request" after handling it the first time Nov 2, 2023
@ghost ghost changed the title [Bug] Luakit not re-emitting "send-request" after handling it the first time [Bug] Luakit not re-emitting "send-request" when redirecting after handling it the first time Nov 2, 2023
@c0dev0id
Copy link
Member

OP is a ghost, but I'll keep this open because it's something we should fix.

@c0dev0id c0dev0id added the bug label Jan 26, 2024
@ghost
Copy link

ghost commented Jan 26, 2024

Getting this problem too while working on multiple extensions that rely on the signal using Luakit 2.3.3-r1 from the Alpine Linux packages repo here

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

No branches or pull requests

1 participant