helium/core: use webstore when extension proxy is off#1594
helium/core: use webstore when extension proxy is off#1594Umbranoxio wants to merge 1 commit intoimputnet:mainfrom
Conversation
|
this should be a flag and not default behavior |
|
| + Profile* profile = Profile::FromBrowserContext(context_.get()); | ||
| + PrefService* prefs = profile->GetPrefs(); | ||
| + GURL services_url = helium::GetServicesBaseURL(*prefs).Resolve("/ext"); | ||
| + const GURL& update_url = it.second.update_url(); | ||
| + bool is_webstore_update_url = | ||
| + (update_url.host() == baseUrl.host() && | ||
| + update_url.path() == baseUrl.path()) || | ||
| + extension_urls::CanPatchUpdateUrl(update_url) || | ||
| + (update_url.host() == services_url.host() && | ||
| + update_url.path() == services_url.path()); | ||
| + | ||
| + if (is_webstore_update_url) { | ||
| + it.second.OverrideURL(helium::GetExtensionUpdateURL(*prefs)); | ||
| + } |
There was a problem hiding this comment.
Unchecked
Profile::FromBrowserContext return value in update loop
Profile::FromBrowserContext(context_.get()) can return nullptr when context_ is not backed by a Profile (e.g., certain off-the-record or system contexts). The previous code guarded this behind if (prefs && ...) and also restricted the block to extensions whose host matched baseUrl. The new code executes the profile/prefs lookup unconditionally for every pending extension, so a null profile will cause a crash on profile->GetPrefs().
| + downloader->set_manifest_query_params(GetManifestQueryParams( | ||
| + helium::ShouldAccessExtensionService(*profile->GetPrefs()) | ||
| + ? UpdateQueryParams::CRX_DUMMY | ||
| + : UpdateQueryParams::CRX)); | ||
| + downloader->set_ping_enabled_domain( | ||
| + helium::ShouldAccessExtensionService(*profile->GetPrefs()) | ||
| + ? "helium.computer" | ||
| + : "google.com"); |
There was a problem hiding this comment.
Stale downloader config after proxy-setting toggle
manifest_query_params and ping_enabled_domain are baked into the ExtensionDownloader at creation time in EnsureDownloaderCreated(). When the user toggles kHeliumExtProxyEnabled, the pref-change hook triggers CheckSoon(), which calls EnsureDownloaderCreated() — but since downloader_ is already non-null, it is not recreated. The old query params (e.g., CRX_DUMMY vs CRX) and ping domain stay in effect until the downloader is destroyed (typically on browser restart). On the OFF→ON transition the proxy receives real platform params instead of the spoofed ones, defeating privacy.
| + downloader->set_manifest_query_params(GetManifestQueryParams( | ||
| + helium::ShouldAccessExtensionService(*profile->GetPrefs()) | ||
| + ? UpdateQueryParams::CRX_DUMMY | ||
| + : UpdateQueryParams::CRX)); | ||
| + downloader->set_ping_enabled_domain( | ||
| + helium::ShouldAccessExtensionService(*profile->GetPrefs()) | ||
| + ? "helium.computer" | ||
| + : "google.com"); |
There was a problem hiding this comment.
ShouldAccessExtensionService called twice for the same pref state
helium::ShouldAccessExtensionService(*profile->GetPrefs()) is evaluated separately for set_manifest_query_params and set_ping_enabled_domain. Computing the result once into a local variable would be cleaner and avoids the redundant prefs read.
ah, alrighty |
|
thought about it, guess that changes things a bit then.. there's a few ways this can be handled, which would you prefer @dumbmoron
|
i think this would be fine since it's kind of a fringe configuration, flags usually take precedence over everything else |
|
actually maybe not, can't get the original code to build because of my pc specs, would have loved to though |
For your pull request to not get closed without review, please confirm that:
(an approved feature request, or confirmed bug).
otherwise I have marked my PR as draft.
organization if I lied by checking any of these checkboxes.
Tested on (check one or more):
closes #1031 (probably #451 too but i didn't test that case)
changes:
testing:
chrome://net-export-- off used google, on used proxy