Skip to content

Commit 47e27e2

Browse files
Merge branch 'dev'
2 parents 98c45af + dc9b744 commit 47e27e2

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/app/plugin/MailtoProtocolHandlerPlugin.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ Ext.define("conjoon.cn_mail.app.plugin.MailtoProtocolHandlerPlugin", {
3737
run (controller) {
3838
"use strict";
3939

40-
const origin = window.location.origin;
41-
42-
navigator.registerProtocolHandler(
43-
"mailto",
44-
origin + "/#cn_mail/message/compose/%s",
45-
"mailto handler"
46-
);
40+
if (navigator.registerProtocolHandler) {
41+
const origin = window.location.origin;
42+
navigator.registerProtocolHandler(
43+
"mailto",
44+
origin + "/#cn_mail/message/compose/%s",
45+
"mailto handler"
46+
);
47+
}
4748

4849
return true;
4950
}

tests/src/app/plugin/MailtoProtocolHandlerPluginTest.js

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ StartTest(t => {
6565

6666
let registerProtocolHandler = function (){};
6767

68+
navigator.registerProtocolHandler = undefined;
69+
70+
t.expect(plugin.run(ctrl)).toBe(true);
71+
6872
navigator.registerProtocolHandler = registerProtocolHandler;
6973

7074
let registerSpy = t.spyOn(navigator, "registerProtocolHandler").and.callFake(() => {});

0 commit comments

Comments
 (0)