/src/mozilla-central/dom/xbl/nsXBLSerialize.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #include "nsXBLSerialize.h" |
8 | | |
9 | | #include "jsfriendapi.h" |
10 | | #include "nsXBLPrototypeBinding.h" |
11 | | #include "nsIXPConnect.h" |
12 | | #include "nsContentUtils.h" |
13 | | |
14 | | using namespace mozilla; |
15 | | |
16 | | nsresult |
17 | | XBL_SerializeFunction(nsIObjectOutputStream* aStream, |
18 | | JS::Handle<JSObject*> aFunction) |
19 | 0 | { |
20 | 0 | AssertInCompilationScope(); |
21 | 0 | AutoJSContext cx; |
22 | 0 | MOZ_ASSERT(js::GetContextCompartment(cx) == js::GetObjectCompartment(aFunction)); |
23 | 0 | return nsContentUtils::XPConnect()->WriteFunction(aStream, cx, aFunction); |
24 | 0 | } |
25 | | |
26 | | nsresult |
27 | | XBL_DeserializeFunction(nsIObjectInputStream* aStream, |
28 | | JS::MutableHandle<JSObject*> aFunctionObjectp) |
29 | 0 | { |
30 | 0 | AssertInCompilationScope(); |
31 | 0 | AutoJSContext cx; |
32 | 0 | return nsContentUtils::XPConnect()->ReadFunction(aStream, cx, |
33 | 0 | aFunctionObjectp.address()); |
34 | 0 | } |