Bug 94199, part 5, remove line number reading and writing as it isn't necessary, dxr does that for us, r=bz

This commit is contained in:
Neil Deakin 2011-11-03 16:39:08 -04:00
Родитель 16faece69e
Коммит e1b80a4ed5
4 изменённых файлов: 11 добавлений и 27 удалений

Просмотреть файл

@ -273,9 +273,7 @@ nsXBLProtoImplMethod::Read(nsIScriptContext* aContext,
nsIObjectInputStream* aStream)
{
void* methodCode;
PRUint32 lineNumber;
nsresult rv = XBL_DeserializeFunction(aContext, aStream, this,
&lineNumber, &methodCode);
nsresult rv = XBL_DeserializeFunction(aContext, aStream, this, &methodCode);
mJSMethodObject = (JSObject *)methodCode;
if (NS_FAILED(rv)) {
SetUncompiledMethod(nsnull);
@ -299,8 +297,7 @@ nsXBLProtoImplMethod::Write(nsIScriptContext* aContext,
rv = aStream->WriteWStringZ(mName);
NS_ENSURE_SUCCESS(rv, rv);
// XXXndeakin fix line number
return XBL_SerializeFunction(aContext, aStream, mJSMethodObject, 0);
return XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
}
nsresult
@ -394,8 +391,7 @@ nsXBLProtoImplAnonymousMethod::Write(nsIScriptContext* aContext,
nsresult rv = aStream->Write8(aType);
NS_ENSURE_SUCCESS(rv, rv);
// XXXndeakin write out line number
rv = XBL_SerializeFunction(aContext, aStream, mJSMethodObject, 0);
rv = XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -361,12 +361,11 @@ nsXBLProtoImplProperty::Read(nsIScriptContext* aContext,
XBLBindingSerializeDetails aType)
{
nsresult rv;
PRUint32 lineNumber;
void* scriptObject;
if (aType == XBLBinding_Serialize_GetterProperty ||
aType == XBLBinding_Serialize_GetterSetterProperty) {
rv = XBL_DeserializeFunction(aContext, aStream, this, &lineNumber, &scriptObject);
rv = XBL_DeserializeFunction(aContext, aStream, this, &scriptObject);
NS_ENSURE_SUCCESS(rv, rv);
mJSGetterObject = (JSObject *)scriptObject;
@ -375,7 +374,7 @@ nsXBLProtoImplProperty::Read(nsIScriptContext* aContext,
if (aType == XBLBinding_Serialize_SetterProperty ||
aType == XBLBinding_Serialize_GetterSetterProperty) {
rv = XBL_DeserializeFunction(aContext, aStream, this, &lineNumber, &scriptObject);
rv = XBL_DeserializeFunction(aContext, aStream, this, &scriptObject);
NS_ENSURE_SUCCESS(rv, rv);
mJSSetterObject = (JSObject *)scriptObject;
@ -414,14 +413,12 @@ nsXBLProtoImplProperty::Write(nsIScriptContext* aContext,
NS_ENSURE_SUCCESS(rv, rv);
if (mJSAttributes & JSPROP_GETTER) {
// XXXndeakin write out line number
rv = XBL_SerializeFunction(aContext, aStream, mJSGetterObject, 0);
rv = XBL_SerializeFunction(aContext, aStream, mJSGetterObject);
NS_ENSURE_SUCCESS(rv, rv);
}
if (mJSAttributes & JSPROP_SETTER) {
// XXXndeakin write out line number
rv = XBL_SerializeFunction(aContext, aStream, mJSSetterObject, 0);
rv = XBL_SerializeFunction(aContext, aStream, mJSSetterObject);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -43,11 +43,9 @@
nsresult
XBL_SerializeFunction(nsIScriptContext* aContext,
nsIObjectOutputStream* aStream,
JSObject* aFunctionObject,
PRUint32 aLineNumber)
JSObject* aFunctionObject)
{
nsresult rv = aStream->Write32(aLineNumber);
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv;
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSXDRState *xdr = ::JS_XDRNewMem(cx, JSXDR_ENCODE);
@ -81,19 +79,14 @@ nsresult
XBL_DeserializeFunction(nsIScriptContext* aContext,
nsIObjectInputStream* aStream,
void* aHolder,
PRUint32* aLineNumber,
void **aScriptObject)
{
*aScriptObject = nsnull;
nsresult rv = aStream->Read32(aLineNumber);
if (NS_FAILED(rv))
return rv;
JSObject* functionObject = nsnull;
PRUint32 size;
rv = aStream->Read32(&size);
nsresult rv = aStream->Read32(&size);
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -108,14 +108,12 @@ PR_STATIC_ASSERT(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuilti
nsresult
XBL_SerializeFunction(nsIScriptContext* aContext,
nsIObjectOutputStream* aStream,
JSObject* aFunctionObject,
PRUint32 aLineNumber);
JSObject* aFunctionObject);
nsresult
XBL_DeserializeFunction(nsIScriptContext* aContext,
nsIObjectInputStream* aStream,
void* aHolder,
PRUint32* aLineNumber,
void **aScriptObject);
#endif // nsXBLSerialize_h__