refactor: use std::map::extract() in api::WebRequest
Small readability refactor to api::WebRequest::blocked_requests_:
use extract() when we want to pull a BlockedRequest from the map
and then process it.
In 6399527761 we changed the path strings
that `node_modules.cc` operates on from single-byte to wide strings.
Unfortunately this means that `generic_path()` that the
"fix: ensure TraverseParent bails on resource path exit" patch was
calling was no longer a safe method to call on Windows if the underlying
string has unicode characters in it.
Here we fix it by using `ConvertGenericPathToUTF8` from the Node.js
internal utilities.
* feat(macos): add --disable-geolocation-mac command-line flag
* internally deny geolocation requests if flag set
e
* wrap PermissionRequestHandler instead
* wrap custom handler and deny regardless of response
* Update docs/api/command-line-switches.md
Co-authored-by: Will Anderson <will@itsananderson.com>
* resolving conflicts during rebase
* tests added
* tests added: minor changes
* move IsGeolocationDisabledViaCommandLine inside ElectronPermissionManager as a static member
* test: inject fixturesPath via --boot-eval
* Update shell/browser/electron_permission_manager.cc
Co-authored-by: Robo <hop2deep@gmail.com>
* chore: Fixup after merge
* fixup after merge
---------
Co-authored-by: Will Anderson <will@itsananderson.com>
Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* refactor: make api::WebRequest inherit from gin::Wrappable
refactor: remove unused v8::Isolate* arg from WebRequest ctor
refactor: make electron::api::Session::web_request_ a cppgc::Member<api::WebRequest>
refactor: allocate api::WebRequest on cpp heap
refactor: modify Create(), Find(), and FindOrCreate() to return a WebRequest*
* refactor: ProxyingURLLoaderFactory takes a concrete api::WebRequest instead of a WebRequestAPI
Experimental commit to ensure `ProxyingURLLoaderFactory::web_request_api_`
won't be a dangling pointer.
* chore: fix doc shear
* refactor: use cppgc::WeakPersistent<> in ProxyingURLLoaderFactory
* refactor: make ProxyingURLLoaderFactory::web_request_ const
* refactor: make ProxyingWebSocket::web_request_ a cppgc::WeakPersistent<>
* add a gin::WeakCellFactory to api::WebRequest
* refactor: use a gin::WeakCell for the bound WebRequest argument in HandleOnBeforeRequestResponseEvent()
* chore: update patches
* docs(timelines): Correct v40.0.0 stable release date
On the Electron Timelines tutorial page (/docs/latest/tutorial/electron-timelines), there is a clear typo in the release schedule for v40.0.0.
The table currently lists the dates as:
* Alpha: 2025-Oct-30
* Beta: 2025-Dec-03
* **Stable: 2025-Oct-28**
This is logically incorrect, as the 'Stable' release date (Oct 28) is listed *before* both the 'Alpha' (Oct 30) and 'Beta' (Dec 03) dates for the same version.
This appears to be a copy-paste error, as the 'Stable' date (2025-Oct-28) is identical to the 'Stable' date for the v39.0.0 release in the preceding row.
This commit updates the 'Stable' date for v40.0.0 to its correct value, ensuring the timeline is accurate and logical.
* docs: Update v40.0.0 stable date to 2026-Jan-13 based on Chromium schedule
trap handlers will be initialized once the user script starts
but before app#ready. Wasm compilation before that phase will
break trap handler registeration due to the check in
v8::internal::wasm::UpdateComputedInformation. For some reason
this issue was only visible in <= 39-x-y when pdf-reader.mjs
was being loaded, maybe some module loading logic changed in >= 40-x-y
which are based on Node.js v24.x. In either case, it is best to
align the loading of wasm module required for the tests in light
of changes to how we are registering the trap handlers for the
main process.
* refactor: Session::NetLog() returns a NetLog*
Use gin_helper's gin::Wrappable-to-v8::Local converter instead
of rewriting it.
* refactor: FromPath(base::FilePath&, gin::Arguments*) returns a Session*
refactor: FromPartition(std::string&, gin::Arguments*) returns a Session*
Use gin_helper's gin::Wrappable-to-v8::Local converter instead
of rewriting it.
refactor: remove unused method ExtensionActionAPI::GetExtensionPrefs()
refactor: remove unused field ExtensionActionAPI::browser_context_
refactor: remove unused field ExtensionActionAPI::browser_context_
looks like these were added in 5b105f91 but never used
* refactor: rename api::Session::CreateFrom() to api::Session::FromOrCreate()
This is both clearer and more consistent with other classes
* refactor: add Session::FromOrCreate(content::BrowserContext*)
* refactor: reimplement api::WebRequest::FromOrCreate() using api::Session::FromOrCreate()
* refactor: use base::PassKey to ensure WebRequest is only instantiated by Session
* refactor: remove WebRequest::From()
no longer needed; Session already guarantees uniqueness
* refactor: remove unused isolate arg from WebRequest ctor
* refactor: do not attach WebRequest to BrowserContext
no longer needed now that access goes through Session
* refactor: remove electron::WebRequestAPI interface
Remove the |electron::WebRequestAPI| interface class.
Use handles to the concrete class |electron::api::WebRequest| instead.
Prerequisite for https://github.com/electron/electron/pull/48762.
Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket)
hold a handle to a WebRequest via |raw_ptr<electron::WebRequestAPI>|.
|electron::WebRequestAPI| is a pure virtual interface whose concrete impl is
|electron::api::WebRequest|.
This is a problem when migrating |electron::api::WebRequest| to cppgc:
we need to change those |raw_ptr<>|s to |cppgc::WeakPersistent<>| but
can't instantiate |cppgc::WeakPersistent<electron::WebRequestAPI>| as-is.
We also can't change it to inherit from |cppgc::GarbageCollectedMixin|,
since that causes problems when |electron::api::WebRequest| inherits from
both |electron::WebRequestAPI| and |cppgc::GarbageCollected|.
* refactor: use name web_request, not web_request_api
* refactor: make ProxyingURLLoaderFactory::web_request() private
* chore: make linter happy by fixing whitespace