refactor: follow upstream's suggestions on when to use EmptyGURL() (#45521)

- Prefer GURL() when we want to return a non-reference empty URL.

- In ServiceWorkerMain::GetStorageKey(), use a reference instead
  of instantiating a new temporary GURL.

From url/gurl.h:

> // Returns a reference to a singleton empty GURL. This object is for
> // callers who return references but don't have anything to return in
> // some cases. If you just want an empty URL for normal use, prefer
> // GURL().

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-02-13 11:30:40 +01:00 committed by GitHub
parent 8fb9fd97df
commit 5b90ce2290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -214,7 +214,7 @@ GURL ElectronManagementAPIDelegate::GetEffectiveUpdateURL(
const extensions::Extension& extension,
content::BrowserContext* context) const {
// TODO(codebytere): we do not currently support ExtensionManagement.
return GURL::EmptyGURL();
return {};
}
void ElectronManagementAPIDelegate::ShowMv2DeprecationReEnableDialog(