Repository navigation
daemon: Allow clients to cancel requests - #246
Open
dangerousplay wants to merge 1 commit into
Open
dangerousplay wants to merge 1 commit into
dangerousplay wants to merge 1 commit into
Conversation
xdg-desktop-portal calls org.freedesktop.impl.portal.Request.Close() on the handler when a client closes its request or disconnects, but the daemon never exported such an object, so requests could not be cancelled. Accept an optional `request_handle` object path in the CreateCredential and GetCredential options. For the duration of the ceremony, export an org.freedesktop.impl.portal.Request object at that path. Close() is only accepted from the connection that started the ceremony; it cancels a token that is passed down to the flow controller, which cancels the request and dismisses the UI. The cancellation does not need the gateway service lock, which is held for the whole ceremony. The method call then returns response code 1 (cancelled). Fixes linux-credentials#90
Member
|
Thanks for this! I will take a look at this next week :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello I hope you are having a good day ^^
This pull request fixes #90.
xdg-desktop-portal creates an
org.freedesktop.impl.portal.Requestproxy for everyCredential request at
request->idon the handler's bus name and callsClose()on itwhen the client closes its
org.freedesktop.portal.Requestor disconnects. credentialsdnever learned that path and never exported the object, so client cancellation was a no-op
and the UI stayed open.
This adds an optional
request_handle(o) option to the handler'sCreateCredential/GetCredential. When present, credentialsd exportsorg.freedesktop.impl.portal.Requestat that path for the lifetime of the ceremony:
Close()is only accepted from the bus name that issued the handler call(others get
AccessDenied).CancellationTokenthat is threaded down to the flow controller; it nevertakes the gateway mutex, so it cannot deadlock with the running ceremony. A request
still queued behind another one is cancelled too.
cancel_request()and sendsErrorCancelled, which dismisses the UIthrough the existing path, and the handler call returns response code 1 (Cancelled).
/org/freedesktop/portal/desktop/request/.Without the option, behaviour is unchanged. The matching one-line xdg-desktop-portal change
(passing
request_handle = request->id) is in linux-credentials/xdg-desktop-portal#1.Tested with unit tests (option parsing, response codes, invalid handles), private-bus
integration tests (
gio::TestDBus: foreign Close -> AccessDenied, caller Close -> code 1,object removed), flow-control tests, and end to end from a WebKitGTK client
(AbortController.abort() -> Request.Close -> ceremony cancelled, UI dismissed).