diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 8768c7be2ce14..4d6d93e7e0500 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -97,6 +97,7 @@ #include "shell/common/options_switches.h" #include "shell/common/platform_util.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" +#include "third_party/blink/public/mojom/badging/badging.mojom.h" #include "ui/base/resource/resource_bundle.h" #include "ui/native_theme/native_theme.h" #include "v8/include/v8.h" @@ -1573,6 +1574,12 @@ void ElectronBrowserClient::BindHostReceiverForRenderer( #endif } +void BindBadgeManagerFrameReceiver( + content::RenderFrameHost* frame, + mojo::PendingReceiver receiver) { + LOG(WARNING) << "The Chromium Badging API is not available in Electron"; +} + #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) void BindMimeHandlerService( content::RenderFrameHost* frame_host, @@ -1609,6 +1616,8 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame( mojo::BinderMapWithContext* map) { map->Add( base::BindRepeating(&BindNetworkHintsHandler)); + map->Add( + base::BindRepeating(&BindBadgeManagerFrameReceiver)); #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) map->Add( base::BindRepeating(&BindMimeHandlerService)); diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index 1e1c75b4bbfde..f872d7342d7e6 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -17,6 +17,14 @@ const features = process._linkedBinding('electron_common_features'); describe('chromium feature', () => { const fixtures = path.resolve(__dirname, 'fixtures'); + describe('Badging API', () => { + it('does not crash', () => { + expect(() => { + navigator.setAppBadge(42); + }).to.not.throw(); + }); + }); + describe('heap snapshot', () => { it('does not crash', function () { process._linkedBinding('electron_common_v8_util').takeHeapSnapshot();