1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsAlertsUtils.h"
8 #include "nsContentUtils.h"
13 bool nsAlertsUtils::IsActionablePrincipal(nsIPrincipal
* aPrincipal
) {
15 !nsContentUtils::IsSystemOrExpandedPrincipal(aPrincipal
) &&
16 !aPrincipal
->GetIsNullPrincipal();
20 void nsAlertsUtils::GetSourceHostPort(nsIPrincipal
* aPrincipal
,
21 nsAString
& aHostPort
) {
22 if (!IsActionablePrincipal(aPrincipal
)) {
25 nsAutoCString hostPort
;
26 if (NS_WARN_IF(NS_FAILED(aPrincipal
->GetHostPort(hostPort
)))) {
29 CopyUTF8toUTF16(hostPort
, aHostPort
);