mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Implement cookie fetching for Workers
Allows formulas to update on Google Sheets, which uses a Worker to update them and makes cookie authenticated requests, which was failing before this commit. This has the limitation that it has to proxy through the WebContent process, but that's how the current infrastructure is, which is outside the scope of this commit.
This commit is contained in:
parent
05438e70f1
commit
6d3fd2b543
Notes:
github-actions[bot]
2025-09-09 13:29:33 +00:00
Author: https://github.com/Lubrsi
Commit: 6d3fd2b543
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6116
7 changed files with 32 additions and 0 deletions
|
|
@ -49,10 +49,20 @@ void WorkerAgentParent::initialize(JS::Realm& realm)
|
|||
auto transport = make<IPC::Transport>(move(worker_socket));
|
||||
|
||||
m_worker_ipc = make_ref_counted<WebWorkerClient>(move(transport));
|
||||
setup_worker_ipc_callbacks(realm);
|
||||
|
||||
m_worker_ipc->async_start_worker(m_url, m_worker_options.type, m_worker_options.credentials, m_worker_options.name, move(data_holder), m_outside_settings->serialize(), m_agent_type);
|
||||
}
|
||||
|
||||
void WorkerAgentParent::setup_worker_ipc_callbacks(JS::Realm& realm)
|
||||
{
|
||||
// NOTE: As long as WorkerAgentParent is alive, realm and m_worker_ipc will be alive.
|
||||
m_worker_ipc->on_request_cookie = [realm = GC::RawRef { realm }](URL::URL const& url, Cookie::Source source) {
|
||||
auto& client = Bindings::principal_host_defined_page(realm).client();
|
||||
return client.page_did_request_cookie(url, source);
|
||||
};
|
||||
}
|
||||
|
||||
void WorkerAgentParent::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ protected:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
void setup_worker_ipc_callbacks(JS::Realm&);
|
||||
|
||||
WorkerOptions m_worker_options;
|
||||
Bindings::AgentType m_agent_type { Bindings::AgentType::DedicatedWorker };
|
||||
URL::URL m_url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue