summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-11 10:13:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-04-11 16:33:53 +0200
commitdde90d1d06ab5f660d8f2cc729587698361e6748 (patch)
treea3d542f17ad2ae89e49cd52523c4fcb1eb6fb521 /sfx2/source
parent34331280c89e51331303fd6f7d5b39aadf88b638 (diff)
set Referer on loading IFrames
so tools, options, security, options, "block any links from document not..." applies to their contents. Change-Id: I04839aea6b07a4a76ac147a85045939ccd9c3c79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150221 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/doc/iframe.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index b30063ee382e..3502a116c299 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -39,6 +39,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <officecfg/Office/Common.hxx>
#include <svl/itemprop.hxx>
+#include <sfx2/docfile.hxx>
#include <sfx2/frmdescr.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/sfxdlg.hxx>
@@ -167,10 +168,11 @@ sal_Bool SAL_CALL IFrameObject::load(
uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( mxContext ) );
xTrans->parseStrict( aTargetURL );
+ uno::Reference<frame::XFramesSupplier> xParentFrame = xFrame->getCreator();
+ SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
+
if (INetURLObject(aTargetURL.Complete).GetProtocol() == INetProtocol::Macro)
{
- uno::Reference<frame::XFramesSupplier> xParentFrame = xFrame->getCreator();
- SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
if (pDoc && !pDoc->AdjustMacroMode())
return false;
}
@@ -178,6 +180,10 @@ sal_Bool SAL_CALL IFrameObject::load(
if (!SfxEvents_Impl::isScriptURLAllowed(aTargetURL.Complete))
return false;
+ OUString sReferer;
+ if (pDoc && pDoc->HasName())
+ sReferer = pDoc->GetMedium()->GetName();
+
DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() );
@@ -204,7 +210,8 @@ sal_Bool SAL_CALL IFrameObject::load(
uno::Sequence < beans::PropertyValue > aProps{
comphelper::makePropertyValue("PluginMode", sal_Int16(2)),
comphelper::makePropertyValue("ReadOnly", true),
- comphelper::makePropertyValue("InteractionHandler", xInteractionHandler)
+ comphelper::makePropertyValue("InteractionHandler", xInteractionHandler),
+ comphelper::makePropertyValue("Referer", sReferer)
};
uno::Reference < frame::XDispatch > xDisp = mxFrame->queryDispatch( aTargetURL, "_self", 0 );
if ( xDisp.is() )