2020-04-30 19:49:50 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "mozilla/dom/ProcessActor.h"
|
|
|
|
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "mozilla/ContentBlockingAllowList.h"
|
|
|
|
#include "mozilla/Logging.h"
|
|
|
|
#include "mozilla/dom/JSActorService.h"
|
|
|
|
#include "mozilla/dom/JSProcessActorParent.h"
|
|
|
|
#include "mozilla/dom/JSProcessActorChild.h"
|
2020-07-08 17:22:22 +03:00
|
|
|
#include "mozilla/dom/JSProcessActorProtocol.h"
|
2020-04-30 19:49:50 +03:00
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
namespace mozilla::dom {
|
2020-04-30 19:49:50 +03:00
|
|
|
|
2020-07-08 17:22:22 +03:00
|
|
|
already_AddRefed<JSActorProtocol> ProcessActor::MatchingJSActorProtocol(
|
|
|
|
JSActorService* aActorSvc, const nsACString& aName, ErrorResult& aRv) {
|
2020-04-30 19:49:50 +03:00
|
|
|
RefPtr<JSProcessActorProtocol> proto =
|
2020-07-08 17:22:22 +03:00
|
|
|
aActorSvc->GetJSProcessActorProtocol(aName);
|
2020-04-30 19:49:50 +03:00
|
|
|
if (!proto) {
|
|
|
|
aRv.ThrowNotFoundError(nsPrintfCString("No such JSProcessActor '%s'",
|
|
|
|
PromiseFlatCString(aName).get()));
|
2020-07-08 17:22:22 +03:00
|
|
|
return nullptr;
|
2020-04-30 19:49:50 +03:00
|
|
|
}
|
|
|
|
|
2020-11-17 00:18:49 +03:00
|
|
|
if (!proto->Matches(GetRemoteType(), aRv)) {
|
|
|
|
MOZ_ASSERT(aRv.Failed());
|
2020-07-08 17:22:22 +03:00
|
|
|
return nullptr;
|
2020-04-30 19:49:50 +03:00
|
|
|
}
|
2020-11-17 00:18:49 +03:00
|
|
|
MOZ_ASSERT(!aRv.Failed());
|
2020-07-08 17:22:22 +03:00
|
|
|
return proto.forget();
|
2020-04-30 19:49:50 +03:00
|
|
|
}
|
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
} // namespace mozilla::dom
|