return false early on 'null' origin

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9cdb26c3d2787beac6e2344d5f768e0fa6993bd8
(cherry picked from commit d1e00dbe1b)
(cherry picked from commit c536e34f4e)
pull/8235/head
Caolán McNamara 2023-10-03 12:29:13 +01:00 committed by Michael Meeks
parent fd34d9c11e
commit 5ce656a34f
1 changed files with 4 additions and 3 deletions

View File

@ -180,13 +180,14 @@ L.Map.WOPI = L.Handler.extend({
// Checking whether a message came from our iframe's parents is
// un-necessarily difficult.
_allowMessageOrigin: function(e) {
// e.origin === 'null' when sandboxed
if (e.origin === 'null')
return false;
// cache - to avoid regexps.
if (this._cachedGoodOrigin && this._cachedGoodOrigin === e.origin)
return true;
// e.origin === 'null' when sandboxed (i.e. when the parent is a file on local filesystem).
if (e.origin === 'null')
return true;
try {
if (e.origin === window.parent.origin)
return true;