1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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/CSPMessageUtils.h"
8 #include "mozilla/ipc/PBackgroundSharedTypes.h"
9 #include "nsSerializationHelper.h"
10 #include "mozilla/ipc/BackgroundUtils.h"
14 using namespace mozilla::ipc
;
16 void ParamTraits
<nsIContentSecurityPolicy
*>::Write(
17 MessageWriter
* aWriter
, nsIContentSecurityPolicy
* aParam
) {
18 bool isNull
= !aParam
;
19 WriteParam(aWriter
, isNull
);
25 mozilla::Unused
<< NS_WARN_IF(NS_FAILED(CSPToCSPInfo(aParam
, &csp
)));
26 WriteParam(aWriter
, csp
);
29 bool ParamTraits
<nsIContentSecurityPolicy
*>::Read(
30 MessageReader
* aReader
, RefPtr
<nsIContentSecurityPolicy
>* aResult
) {
32 if (!ReadParam(aReader
, &isNull
)) {
42 if (!ReadParam(aReader
, &csp
)) {
46 *aResult
= CSPInfoToCSP(csp
, nullptr, nullptr);