Repository navigation
Conversation
The Share Extension selected the WEB connection factory while suppressing its configuration and carrier demand, leaving sends waiting indefinitely. Allow the share-services extension to run the existing hardened carrier and provide a view host tied to its visible root controller lifecycle. Keep headless extensions disabled and main-app bootstrap behavior intact. Require the Share host for activation and retries; do not add a direct fallback or background-upload behavior. Cover the process activation policy. Fixes TelegramMessenger#2380
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.
Fix WEB proxy sending from the iOS Share Extension
Fixes #2380
Problem and linked reports
With an active WEB proxy, sharing a Safari URL, photo or file reaches the recipient picker but stalls after Send. In-app sending works.
fb0e62ba8a147f0821da6aa63c09da7d79a10111reproduced Safari → Share → recipient → Send → indefinite waiting on the same physical iPhone/proxy later used to validate the fix.Root cause: three missing pieces
The source links below are pinned to the tested base commit rather than moving
master.nilfor every.appex, then routes WEB connections toWebProxyTransport. Proxy-setting updates repeat the mismatch..appexguards alone does not provide a Share UI host or a bounded lifecycle.This is a client initialization/lifecycle fix, not a proxy-server timeout or upload-size change. It keeps the existing WEB transport instead of adding a silent direct-TCP fallback.
Changes
com.apple.share-servicesonly; keep notification, widget, Intents and unknown extensions disabled.WebProxyCarrierViewHostprotocol. It is noninteractive and hidden from accessibility, with the same 1pt/0.01-alpha approach as the main app.No direct-connection fallback, new proxy protocol, WebKit hardening changes, background mode, account migration or user-facing setting is introduced. Uploads are not promised to continue after dismissing Share.
Lifecycle and review points
com.apple.share-services. Other extension points, including unknown/missing identifiers, remain disabled; the main app can still bootstrap before a view host exists.Reproduction
Validation
Tested against
fb0e62ba8a147f0821da6aa63c09da7d79a10111(13.1.1), which still matches upstream master as checked on 2026-10-24. The isolated development build was fully built, signed, installed and launched; delivery was checked separately on iPhone 15 Pro Max / iOS 27.0 (24A5370h), Xcode 27.1 (27A9275), macOS 26.6.2.12 targeted scenarios passed: Safari URL; one photo; two photos with the main app terminated; 25 MiB document; mixed 16 KiB + 25 MiB documents; cancel before Send; cancel during upload; retry; downloaded-document integrity; proxy-off control; MTProto control; WEB over Network Link Conditioner 3G.
The received 26,214,400-byte document was freshly downloaded and exported; its size and SHA-256 matched the original. Relay counters rose by 33,095,257 uploaded bytes / 7 streams during the controlled large-upload window, with no new rejects, dial failures or limit hits. These are aggregate server counters, not a per-process packet capture.
Observed Share Extension physical-footprint peaks: ~57 MiB for two photos and ~72 MiB for the file pair. WebKit child processes are separate and not included. No Share Extension crash reports were found in the available inventory; this is not a long-running leak or memory-limit proof.
Host-only Swift/XCTest: 4 new process-policy tests + 6 existing demand-lease tests, 10 passed, 0 failures. Patch whitespace check passed. These host tests do not exercise real WebKit, transport teardown or UIKit lifecycle; device scenarios cover the tested paths.
Not run: full application regression, full iOS/WebKit unit suite (no iOS simulator runtime installed), long-running soak, actual cellular network. Cellular testing is explicitly outside the agreed scope; NLC 3G is a slow-link simulation, not a cellular-radio test.
Reproduce the host-only tests
Requires macOS and a full Xcode installation. Check out this PR's commit (
93e3286bdac82330fb6f927b0e23ae91dbdffd60), save the script below asrun-host-tests.shoutside the source checkout, and run:If Xcode is installed somewhere else, set
DEVELOPER_DIRto itsContents/Developerdirectory when invoking the command.Expected result:
PASS: 10 policy/lease tests; not a WebKit or device testand exit status 0. This compiles only the Foundation-based process policy and demand-set sources plus their XCTest cases. It does not rebuild Telegram, require signing or an iOS simulator, or exercise real WebKit, UIKit lifecycle or delivery. Temporary binaries andresults.logare kept in the printed/var/tmp/webproxy-host-tests.*directory.Standalone macOS test script (the exact host-only runner used for the 10/10 result)
The new test file is also included automatically by the existing
Tests/**/*.swiftglob in//submodules/WebProxyTransport:WebProxyTransportTests. That full iOS/WebKit suite is distinct from this host-only run and was not run for this validation.Only synthetic attachments and the test account's Saved Messages were used. Lab naming/signing/API credentials, local build workarounds, private screenshots, chat data and proxy credentials are not part of this patch.