Bumping manifests a=b2g-bump
[gecko.git] / dom / xbl / nsXBLSerialize.cpp
blob8dcb7c346cb0d0e120a5348bcba4c0b3fd5a63c3
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;
15 nsresult
16 XBL_SerializeFunction(nsIObjectOutputStream* aStream,
17 JS::Handle<JSObject*> aFunction)
19 AssertInCompilationScope();
20 AutoJSContext cx;
21 MOZ_ASSERT(js::GetContextCompartment(cx) == js::GetObjectCompartment(aFunction));
22 return nsContentUtils::XPConnect()->WriteFunction(aStream, cx, aFunction);
25 nsresult
26 XBL_DeserializeFunction(nsIObjectInputStream* aStream,
27 JS::MutableHandle<JSObject*> aFunctionObjectp)
29 AssertInCompilationScope();
30 AutoJSContext cx;
31 return nsContentUtils::XPConnect()->ReadFunction(aStream, cx,
32 aFunctionObjectp.address());