cryptpad/www/common/sframe-boot.js

14 lines
735 B
JavaScript
Raw Normal View History

2017-08-07 14:27:57 +00:00
// Stage 0, this gets cached which means we can't change it. boot2-sframe.js is changable.
// Note that this file is meant to be executed only inside of a sandbox iframe.
2017-08-21 08:34:49 +00:00
;(function () {
2017-08-07 14:27:57 +00:00
window.addEventListener('message', function (msg) {
2017-08-07 15:23:28 +00:00
var data = JSON.parse(msg.data);
2017-08-07 14:27:57 +00:00
if (data.q !== 'INIT') { return; }
2017-08-09 12:45:39 +00:00
msg.source.postMessage(JSON.stringify({ txid: data.txid, content: 'OK' }), '*');
2017-08-07 15:23:28 +00:00
if (data.content && data.content.requireConf) { require.config(data.content.requireConf); }
2017-08-07 14:27:57 +00:00
require(['/common/sframe-boot2.js'], function () { });
2017-08-21 08:34:49 +00:00
});
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
if (req.cfg) { require.config(req.cfg); }
if (req.req) { require(req.req, function () { }); }
}());