|
|
@ -574,6 +574,19 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var deferredPostMessage = function (content, _cb) {
|
|
|
|
|
|
|
|
var cb = Util.once(Util.mkAsync(_cb));
|
|
|
|
|
|
|
|
nThen(function (w) {
|
|
|
|
|
|
|
|
sandboxIframeReady.reg(w(function (err) {
|
|
|
|
|
|
|
|
if (!err) { return; }
|
|
|
|
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
cb(err);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
postMessage(content, cb);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('message', function (event) {
|
|
|
|
window.addEventListener('message', function (event) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var msg = JSON.parse(event.data);
|
|
|
|
var msg = JSON.parse(event.data);
|
|
|
@ -638,14 +651,7 @@ define([
|
|
|
|
var url = '/sheet/inner.html';
|
|
|
|
var url = '/sheet/inner.html';
|
|
|
|
var cb = Util.once(Util.mkAsync(_cb));
|
|
|
|
var cb = Util.once(Util.mkAsync(_cb));
|
|
|
|
msg.appendChild(CSP_WARNING(url));
|
|
|
|
msg.appendChild(CSP_WARNING(url));
|
|
|
|
nThen(function (w) {
|
|
|
|
deferredPostMessage({
|
|
|
|
sandboxIframeReady.reg(w(function (err) {
|
|
|
|
|
|
|
|
if (!err) { return; }
|
|
|
|
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
cb(err);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
postMessage({
|
|
|
|
|
|
|
|
command: 'GET_HEADER',
|
|
|
|
command: 'GET_HEADER',
|
|
|
|
content: {
|
|
|
|
content: {
|
|
|
|
url: url,
|
|
|
|
url: url,
|
|
|
@ -656,19 +662,11 @@ define([
|
|
|
|
cb(hasOnlyOfficeHeaders(CSP_headers));
|
|
|
|
cb(hasOnlyOfficeHeaders(CSP_headers));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert(function (cb, msg) {
|
|
|
|
assert(function (cb, msg) {
|
|
|
|
var url = '/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/index.html';
|
|
|
|
var url = '/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/index.html';
|
|
|
|
msg.appendChild(CSP_WARNING(url));
|
|
|
|
msg.appendChild(CSP_WARNING(url));
|
|
|
|
nThen(function (w) {
|
|
|
|
deferredPostMessage({
|
|
|
|
sandboxIframeReady.reg(w(function (err) {
|
|
|
|
|
|
|
|
if (!err) { return; }
|
|
|
|
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
cb(err);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
postMessage({
|
|
|
|
|
|
|
|
command: 'GET_HEADER',
|
|
|
|
command: 'GET_HEADER',
|
|
|
|
content: {
|
|
|
|
content: {
|
|
|
|
url: url,
|
|
|
|
url: url,
|
|
|
@ -679,7 +677,6 @@ define([
|
|
|
|
cb(hasOnlyOfficeHeaders(CSP_headers));
|
|
|
|
cb(hasOnlyOfficeHeaders(CSP_headers));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert(function (cb, msg) {
|
|
|
|
assert(function (cb, msg) {
|
|
|
|
var url = '/sheet/inner.html';
|
|
|
|
var url = '/sheet/inner.html';
|
|
|
@ -689,14 +686,7 @@ define([
|
|
|
|
code("'cross-origin-opener-policy'"),
|
|
|
|
code("'cross-origin-opener-policy'"),
|
|
|
|
' headers set.',
|
|
|
|
' headers set.',
|
|
|
|
]));
|
|
|
|
]));
|
|
|
|
nThen(function (w) {
|
|
|
|
deferredPostMessage({
|
|
|
|
sandboxIframeReady.reg(w(function (err) {
|
|
|
|
|
|
|
|
if (!err) { return; }
|
|
|
|
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
cb(err);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
postMessage({
|
|
|
|
|
|
|
|
command: 'GET_HEADER',
|
|
|
|
command: 'GET_HEADER',
|
|
|
|
content: {
|
|
|
|
content: {
|
|
|
|
url: url,
|
|
|
|
url: url,
|
|
|
@ -706,7 +696,6 @@ define([
|
|
|
|
cb(content === 'same-origin');
|
|
|
|
cb(content === 'same-origin');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (false) {
|
|
|
|
if (false) {
|
|
|
|
assert(function (cb, msg) {
|
|
|
|
assert(function (cb, msg) {
|
|
|
|