无法在 Thunderbird 68.5.0 附加组件的 xul 对话框中触发 ondialogaccept 事件处理程序

Can not fire the ondialogaccept event handler in Thunderbird 68.5.0 add-on's xul dialog

提问人:Mr. MAX 提问时间:2/18/2020 更新时间:6/1/2020 访问量:30

问:

在我目前正在编写的 Thunderbird 68.5.0 插件中,对话框的事件处理程序 ondialogaccept 和 ondialogcancel 由于未知原因没有被触发。

在此处输入图像描述

单击示例对话框中的“陌生人”按钮时,将显示警报。 但是,单击“接受”按钮或“取消”按钮,任何警报都不会。

刚才写的代码如下:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>

<dialog id="sample" title="event handlers"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        buttons="accept,cancel"
        ondialogaccept="window.alert('Hi!');return true;"
        ondialogcancel="window.alert('Oops!');return true;"        
        >

    <button label="strangers" onclick="window.alert('Yip Yip!');" />

</dialog>
// launcher.js
        window.openDialog(
            "chrome://myaddon/content/sample.xul",
            "sampleDlg",
            "resizable,chrome,modal,titlebar,centerscreen");

先谢谢你。

XUL Thunderbird-插件

评论


答:

0赞 opto 6/1/2020 #1

在 TB68 中,打开...由于 CSP,处理程序不再起作用。 在 javascript 中,您需要为事件加载一个侦听器。请参阅 mozilla TB wiki 中的 TB 60 更新信息和/或 developer.thunderbird.net 上的升级信息

克劳斯