diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 70aef650a..80bce6cc2 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -659,7 +659,16 @@ define([ // Put in the following function the RPC queries that should also work in filepicker + var _sframeChan = sframeChan; var addCommonRpc = function (sframeChan, safe) { + // Send UI.log and UI.warn commands from the secureiframe to the normal iframe + sframeChan.on('EV_ALERTIFY_LOG', function (msg) { + _sframeChan.event('EV_ALERTIFY_LOG', msg); + }); + sframeChan.on('EV_ALERTIFY_WARN', function (msg) { + _sframeChan.event('EV_ALERTIFY_WARN', msg); + }); + Cryptpad.universal.onEvent.reg(function (data) { sframeChan.event('EV_UNIVERSAL_EVENT', data); }); diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 9304d9469..c46a0641d 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -851,6 +851,14 @@ define([ Feedback.init(feedback); } catch (e) { Feedback.init(false); } + if (privateData.secureIframe) { + UI.log = function (msg) { ctx.sframeChan.event('EV_ALERTIFY_LOG', msg); }; + UI.warn = function (msg) { ctx.sframeChan.event('EV_ALERTIFY_WARN', msg); }; + } else { + ctx.sframeChan.on('EV_ALERTIFY_LOG', function (msg) { UI.log(msg); }); + ctx.sframeChan.on('EV_ALERTIFY_WARN', function (msg) { UI.warn(msg); }); + } + try { var forbidden = privateData.disabledApp; if (forbidden) { diff --git a/www/secureiframe/main.js b/www/secureiframe/main.js index 62175c5a0..a5d1faed3 100644 --- a/www/secureiframe/main.js +++ b/www/secureiframe/main.js @@ -102,6 +102,7 @@ define([ password: config.data.password, isTemplate: isTemplate, file: config.data.file, + secureIframe: true, }; for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }