1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/ProcessActor.h"
9 #include "nsContentUtils.h"
10 #include "mozilla/ContentBlockingAllowList.h"
11 #include "mozilla/Logging.h"
12 #include "mozilla/dom/JSActorService.h"
13 #include "mozilla/dom/JSProcessActorParent.h"
14 #include "mozilla/dom/JSProcessActorChild.h"
15 #include "mozilla/dom/JSProcessActorProtocol.h"
17 namespace mozilla::dom
{
19 already_AddRefed
<JSActorProtocol
> ProcessActor::MatchingJSActorProtocol(
20 JSActorService
* aActorSvc
, const nsACString
& aName
, ErrorResult
& aRv
) {
21 RefPtr
<JSProcessActorProtocol
> proto
=
22 aActorSvc
->GetJSProcessActorProtocol(aName
);
24 aRv
.ThrowNotFoundError(nsPrintfCString("No such JSProcessActor '%s'",
25 PromiseFlatCString(aName
).get()));
29 if (!proto
->Matches(GetRemoteType(), aRv
)) {
30 MOZ_ASSERT(aRv
.Failed());
33 MOZ_ASSERT(!aRv
.Failed());
34 return proto
.forget();
37 } // namespace mozilla::dom