1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/nsXBLSerialize.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsXBLSerialize.h" 1.10 + 1.11 +#include "jsfriendapi.h" 1.12 +#include "js/OldDebugAPI.h" 1.13 +#include "nsXBLPrototypeBinding.h" 1.14 +#include "nsIXPConnect.h" 1.15 +#include "nsContentUtils.h" 1.16 +#include "nsCxPusher.h" 1.17 + 1.18 +using namespace mozilla; 1.19 + 1.20 +nsresult 1.21 +XBL_SerializeFunction(nsIObjectOutputStream* aStream, 1.22 + JS::Handle<JSObject*> aFunction) 1.23 +{ 1.24 + AssertInCompilationScope(); 1.25 + AutoJSContext cx; 1.26 + MOZ_ASSERT(js::GetContextCompartment(cx) == js::GetObjectCompartment(aFunction)); 1.27 + return nsContentUtils::XPConnect()->WriteFunction(aStream, cx, aFunction); 1.28 +} 1.29 + 1.30 +nsresult 1.31 +XBL_DeserializeFunction(nsIObjectInputStream* aStream, 1.32 + JS::MutableHandle<JSObject*> aFunctionObjectp) 1.33 +{ 1.34 + AssertInCompilationScope(); 1.35 + AutoJSContext cx; 1.36 + return nsContentUtils::XPConnect()->ReadFunction(aStream, cx, 1.37 + aFunctionObjectp.address()); 1.38 +}