mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Show notifications always on the top window (#2789)
This commit is contained in:
parent
abba71e419
commit
f3e0111acc
2 changed files with 12 additions and 1 deletions
|
|
@ -939,9 +939,14 @@ browser.runtime.onMessage.addListener(async function(req, sender) {
|
|||
kpxcFill.fillAttributeToActiveElementWith(req.args);
|
||||
} else if (req.action === 'frame_message') {
|
||||
if (req.args?.[0] === 'frame_request_to_frames' && window.self !== window.top) {
|
||||
// Handle message from top window in iframe
|
||||
kpxcCustomLoginFieldsBanner.handleParentWindowMessage(req.args);
|
||||
} else if (req.args?.[0] === 'frame_request_to_parent' && window.self === window.top) {
|
||||
// Handle message from iframe in top window
|
||||
kpxcCustomLoginFieldsBanner.handleTopWindowMessage(req.args);
|
||||
} else if (req.args?.[0] === 'notification_from_frame' && window.self === window.top) {
|
||||
// Handle notification from iframe in top window
|
||||
kpxcUI.createNotification(req?.args[1], req?.args[2]);
|
||||
}
|
||||
} else if (req.action === 'ignore_site') {
|
||||
kpxc.ignoreSite(req.args);
|
||||
|
|
|
|||
|
|
@ -330,11 +330,17 @@ kpxcUI.updateFromIntersectionObserver = function(iconClass, entries) {
|
|||
* @param {string} type Notification type: (success, info, warning, error)
|
||||
* @param {string} message The message shown
|
||||
*/
|
||||
kpxcUI.createNotification = function(type, message) {
|
||||
kpxcUI.createNotification = async function(type, message) {
|
||||
if (!kpxc.settings.showNotifications || !type || !message) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send the notification to top window from iframe
|
||||
if (window.self !== window.top) {
|
||||
await sendMessage('frame_message', [ 'notification_from_frame', type, message ]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Removes notification from the body element
|
||||
const removeNotification = function() {
|
||||
// Catch cross-domain exception
|
||||
|
|
|
|||
Loading…
Reference in a new issue