Bug 899976 - GC: Fix unsafe references related to ToInt* functions - browser changes r=bholley

This commit is contained in:
Jon Coppeard 2013-08-02 13:15:38 +01:00
parent 938093c13e
commit 83e7e190e6
2 changed files with 9 additions and 8 deletions

View File

@ -523,7 +523,8 @@ LockedFile::SetLocation(JSContext* aCx,
}
uint64_t location;
if (!JS::ToUint64(aCx, aLocation, &location)) {
JS::Rooted<JS::Value> value(aCx, aLocation);
if (!JS::ToUint64(aCx, value, &location)) {
return NS_ERROR_TYPE_ERR;
}

View File

@ -497,23 +497,23 @@ def writeArgumentUnboxing(f, i, name, type, optional, rvdeclared,
isSetter = (i is None)
if isSetter:
argPtr = "argv"
argPtr = "argv[0].address()"
argVal = "argv[0]"
elif optional:
if typeName == "[jsval]":
val = "JSVAL_VOID"
val = "JS::UndefinedHandleValue"
else:
val = "JSVAL_NULL"
val = "JS::NullHandleValue"
argVal = "(%d < argc ? argv[%d] : %s)" % (i, i, val)
if typeName == "[jsval]":
# This should use the rooted argument,
# however we probably won't ever need to support that.
argPtr = None
else:
argPtr = "(%d < argc ? &argv[%d] : NULL)" % (i, i)
argPtr = "(%d < argc ? argv[%d].address() : NULL)" % (i, i)
else:
argVal = "argv[%d]" % i
argPtr = "&" + argVal
argPtr = argVal + ".address()"
params = {
'name': name,
@ -879,7 +879,7 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName,
rvdeclared = False
if isMethod:
if len(member.params) > 0:
f.write(" jsval *argv = JS_ARGV(cx, vp);\n")
f.write(" JS::CallArgs argv = JS::CallArgsFromVp(argc, vp);\n")
for i, param in enumerate(member.params):
argName = 'arg%d' % i
argTypeKey = argName + 'Type'
@ -897,7 +897,7 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName,
nullBehavior=param.null,
undefinedBehavior=param.undefined)
elif isSetter:
f.write(" jsval *argv = JS_ARGV(cx, vp);\n")
f.write(" JS::CallArgs argv = JS::CallArgsFromVp(argc, vp);\n")
rvdeclared = writeArgumentUnboxing(f, None, 'arg0', member.realtype,
optional=False,
rvdeclared=rvdeclared,