зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1532661 - Part 1: Perform basic validation on CanonicalBrowsingContext, r=farre
Depends on D21134 Differential Revision: https://phabricator.services.mozilla.com/D22190 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b388b0df00
Коммит
88e15f606d
|
@ -95,6 +95,15 @@ void CanonicalBrowsingContext::SetCurrentWindowGlobal(
|
|||
mCurrentWindowGlobal = aGlobal;
|
||||
}
|
||||
|
||||
bool CanonicalBrowsingContext::ValidateTransaction(
|
||||
const Transaction& aTransaction, ContentParent* aProcess) {
|
||||
if (NS_WARN_IF(aProcess && mProcessId != aProcess->ChildID())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject* CanonicalBrowsingContext::WrapObject(
|
||||
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
|
||||
return CanonicalBrowsingContext_Binding::Wrap(aCx, this, aGivenProto);
|
||||
|
|
|
@ -60,6 +60,11 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||
// function)
|
||||
void NotifySetUserGestureActivationFromIPC(bool aIsUserGestureActivation);
|
||||
|
||||
// Validate that the given process is allowed to perform the given
|
||||
// transaction. aSource is |nullptr| if set in the parent process.
|
||||
bool ValidateTransaction(const Transaction& aTransaction,
|
||||
ContentParent* aSource);
|
||||
|
||||
protected:
|
||||
void Traverse(nsCycleCollectionTraversalCallback& cb);
|
||||
void Unlink();
|
||||
|
|
|
@ -5888,6 +5888,13 @@ mozilla::ipc::IPCResult ContentParent::RecvCommitBrowsingContextTransaction(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
// Check if the transaction is valid.
|
||||
if (!aContext->Canonical()->ValidateTransaction(aTransaction, this)) {
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Error,
|
||||
("ParentIPC: Trying to run invalid transaction."));
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
||||
for (auto iter = aContext->Group()->ContentParentsIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
auto* entry = iter.Get();
|
||||
|
|
Загрузка…
Ссылка в новой задаче