зеркало из https://github.com/electron/electron.git
fix: bind fake mojo service for badging (#25294)
* fix: bind fake mojo service for badging * Add a test
This commit is contained in:
Родитель
5a8046c994
Коммит
f6df79b927
|
@ -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<blink::mojom::BadgeService> 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<content::RenderFrameHost*>* map) {
|
||||
map->Add<network_hints::mojom::NetworkHintsHandler>(
|
||||
base::BindRepeating(&BindNetworkHintsHandler));
|
||||
map->Add<blink::mojom::BadgeService>(
|
||||
base::BindRepeating(&BindBadgeManagerFrameReceiver));
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
map->Add<extensions::mime_handler::MimeHandlerService>(
|
||||
base::BindRepeating(&BindMimeHandlerService));
|
||||
|
|
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче