mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Issue #2534 - Part 1: window.postMessage should provide a trusted MessageEvent
This commit is contained in:
parent
22f745761b
commit
fb16b1b4ae
3 changed files with 11 additions and 16 deletions
|
|
@ -32,16 +32,14 @@ PostMessageEvent::PostMessageEvent(nsGlobalWindow* aSource,
|
|||
const nsAString& aCallerOrigin,
|
||||
nsGlobalWindow* aTargetWindow,
|
||||
nsIPrincipal* aProvidedPrincipal,
|
||||
nsIDocument* aSourceDocument,
|
||||
bool aTrustedCaller)
|
||||
: StructuredCloneHolder(CloningSupported, TransferringSupported,
|
||||
StructuredCloneScope::SameProcessSameThread),
|
||||
mSource(aSource),
|
||||
mCallerOrigin(aCallerOrigin),
|
||||
mTargetWindow(aTargetWindow),
|
||||
mProvidedPrincipal(aProvidedPrincipal),
|
||||
mSourceDocument(aSourceDocument),
|
||||
mTrustedCaller(aTrustedCaller)
|
||||
nsIDocument* aSourceDocument)
|
||||
: StructuredCloneHolder(CloningSupported, TransferringSupported,
|
||||
StructuredCloneScope::SameProcessSameThread)
|
||||
, mSource(aSource)
|
||||
, mCallerOrigin(aCallerOrigin)
|
||||
, mTargetWindow(aTargetWindow)
|
||||
, mProvidedPrincipal(aProvidedPrincipal)
|
||||
, mSourceDocument(aSourceDocument)
|
||||
{
|
||||
MOZ_COUNT_CTOR(PostMessageEvent);
|
||||
}
|
||||
|
|
@ -169,7 +167,7 @@ PostMessageEvent::Run()
|
|||
if (shell)
|
||||
presContext = shell->GetPresContext();
|
||||
|
||||
event->SetTrusted(mTrustedCaller);
|
||||
event->SetTrusted(true);
|
||||
WidgetEvent* internalEvent = event->WidgetEventPtr();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ public:
|
|||
const nsAString& aCallerOrigin,
|
||||
nsGlobalWindow* aTargetWindow,
|
||||
nsIPrincipal* aProvidedPrincipal,
|
||||
nsIDocument* aSourceDocument,
|
||||
bool aTrustedCaller);
|
||||
nsIDocument* aSourceDocument);
|
||||
|
||||
private:
|
||||
~PostMessageEvent();
|
||||
|
|
@ -44,7 +43,6 @@ private:
|
|||
RefPtr<nsGlobalWindow> mTargetWindow;
|
||||
nsCOMPtr<nsIPrincipal> mProvidedPrincipal;
|
||||
nsCOMPtr<nsIDocument> mSourceDocument;
|
||||
bool mTrustedCaller;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
|||
|
|
@ -8885,8 +8885,7 @@ nsGlobalWindow::PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessa
|
|||
providedPrincipal,
|
||||
callerInnerWin
|
||||
? callerInnerWin->GetDoc()
|
||||
: nullptr,
|
||||
nsContentUtils::IsCallerChrome());
|
||||
: nullptr);
|
||||
|
||||
JS::Rooted<JS::Value> message(aCx, aMessage);
|
||||
JS::Rooted<JS::Value> transfer(aCx, aTransfer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue