1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsXBLSerialize.h"
8 #include "jsfriendapi.h"
9 #include "nsXBLPrototypeBinding.h"
10 #include "nsIXPConnect.h"
11 #include "nsContentUtils.h"
13 using namespace mozilla
;
16 XBL_SerializeFunction(nsIObjectOutputStream
* aStream
,
17 JS::Handle
<JSObject
*> aFunction
)
19 AssertInCompilationScope();
21 MOZ_ASSERT(js::GetContextCompartment(cx
) == js::GetObjectCompartment(aFunction
));
22 return nsContentUtils::XPConnect()->WriteFunction(aStream
, cx
, aFunction
);
26 XBL_DeserializeFunction(nsIObjectInputStream
* aStream
,
27 JS::MutableHandle
<JSObject
*> aFunctionObjectp
)
29 AssertInCompilationScope();
31 return nsContentUtils::XPConnect()->ReadFunction(aStream
, cx
,
32 aFunctionObjectp
.address());