зеркало из https://github.com/mozilla/gecko-dev.git
Bug 870442 - Fix some shell rooting hazards and false positives r=terrence
This commit is contained in:
Родитель
08265d8719
Коммит
658d9d4b98
|
@ -2185,7 +2185,7 @@ bool CanConvertTypedArrayItemTo(JSObject *baseType, JSObject *valObj, JSContext
|
|||
// caller; 'freePointer' will be set to indicate this.
|
||||
JSBool
|
||||
ImplicitConvert(JSContext* cx,
|
||||
jsval val,
|
||||
HandleValue val,
|
||||
JSObject* targetType_,
|
||||
void* buffer,
|
||||
bool isArgument,
|
||||
|
@ -4792,16 +4792,12 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
|||
return JS_FALSE;
|
||||
fieldRootsArray[i] = OBJECT_TO_JSVAL(fieldType);
|
||||
|
||||
// Make sure each field name is unique, and add it to the hash.
|
||||
// Make sure each field name is unique
|
||||
FieldInfoHash::AddPtr entryPtr = fields->lookupForAdd(name);
|
||||
if (entryPtr) {
|
||||
JS_ReportError(cx, "struct fields must have unique names");
|
||||
return JS_FALSE;
|
||||
}
|
||||
ASSERT_OK(fields->add(entryPtr, name, FieldInfo()));
|
||||
FieldInfo& info = entryPtr->value;
|
||||
info.mType = fieldType;
|
||||
info.mIndex = i;
|
||||
|
||||
// Add the field to the StructType's 'prototype' property.
|
||||
if (!JS_DefineUCProperty(cx, prototype,
|
||||
|
@ -4820,7 +4816,14 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
|||
JS_ReportError(cx, "size overflow");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
// Add field name to the hash
|
||||
FieldInfo info;
|
||||
info.mType = fieldType;
|
||||
info.mIndex = i;
|
||||
info.mOffset = fieldOffset;
|
||||
ASSERT_OK(fields->add(entryPtr, name, info));
|
||||
|
||||
structSize = fieldOffset + fieldSize;
|
||||
|
||||
if (fieldAlign > structAlign)
|
||||
|
@ -5032,7 +5035,7 @@ StructType::ConstructData(JSContext* cx,
|
|||
for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) {
|
||||
const FieldInfo& field = r.front().value;
|
||||
STATIC_ASSUME(field.mIndex < fields->count()); /* Quantified invariant */
|
||||
if (!ImplicitConvert(cx, args[field.mIndex], field.mType,
|
||||
if (!ImplicitConvert(cx, args.handleAt(field.mIndex), field.mType,
|
||||
buffer + field.mOffset,
|
||||
false, NULL))
|
||||
return JS_FALSE;
|
||||
|
@ -5670,7 +5673,7 @@ typedef Array<AutoValue, 16> AutoValueAutoArray;
|
|||
|
||||
static JSBool
|
||||
ConvertArgument(JSContext* cx,
|
||||
jsval arg,
|
||||
HandleValue arg,
|
||||
JSObject* type,
|
||||
AutoValue* value,
|
||||
AutoValueAutoArray* strings)
|
||||
|
@ -5750,7 +5753,7 @@ FunctionType::Call(JSContext* cx,
|
|||
}
|
||||
|
||||
for (unsigned i = 0; i < argcFixed; ++i)
|
||||
if (!ConvertArgument(cx, args[i], fninfo->mArgTypes[i], &values[i], &strings))
|
||||
if (!ConvertArgument(cx, args.handleAt(i), fninfo->mArgTypes[i], &values[i], &strings))
|
||||
return false;
|
||||
|
||||
if (fninfo->mIsVariadic) {
|
||||
|
@ -5775,7 +5778,7 @@ FunctionType::Call(JSContext* cx,
|
|||
!(type = PrepareType(cx, OBJECT_TO_JSVAL(type))) ||
|
||||
// Relying on ImplicitConvert only for the limited purpose of
|
||||
// converting one CType to another (e.g., T[] to T*).
|
||||
!ConvertArgument(cx, args[i], type, &values[i], &strings) ||
|
||||
!ConvertArgument(cx, args.handleAt(i), type, &values[i], &strings) ||
|
||||
!(fninfo->mFFITypes[i] = CType::GetFFIType(cx, type))) {
|
||||
// These functions report their own errors.
|
||||
return false;
|
||||
|
|
|
@ -316,7 +316,7 @@ JSBool InitTypeClasses(JSContext* cx, JSHandleObject parent);
|
|||
JSBool ConvertToJS(JSContext* cx, JSHandleObject typeObj, JSHandleObject dataObj,
|
||||
void* data, bool wantPrimitive, bool ownResult, jsval* result);
|
||||
|
||||
JSBool ImplicitConvert(JSContext* cx, jsval val, JSObject* targetType,
|
||||
JSBool ImplicitConvert(JSContext* cx, JSHandleValue val, JSObject* targetType,
|
||||
void* buffer, bool isArgument, bool* freePointer);
|
||||
|
||||
JSBool ExplicitConvert(JSContext* cx, JSHandleValue val, JSHandleObject targetType,
|
||||
|
|
|
@ -370,7 +370,7 @@ DispatchIonCache::updateBaseAddress(IonCode *code, MacroAssembler &masm)
|
|||
}
|
||||
|
||||
void
|
||||
IonCache::attachStub(MacroAssembler &masm, StubAttacher &attacher, IonCode *code)
|
||||
IonCache::attachStub(MacroAssembler &masm, StubAttacher &attacher, Handle<IonCode *> code)
|
||||
{
|
||||
JS_ASSERT(canAttachStub());
|
||||
incrementStubCount();
|
||||
|
@ -391,8 +391,8 @@ bool
|
|||
IonCache::linkAndAttachStub(JSContext *cx, MacroAssembler &masm, StubAttacher &attacher,
|
||||
IonScript *ion, const char *attachKind)
|
||||
{
|
||||
IonCode *code = NULL;
|
||||
LinkStatus status = linkCode(cx, masm, ion, &code);
|
||||
Rooted<IonCode *> code(cx);
|
||||
LinkStatus status = linkCode(cx, masm, ion, code.address());
|
||||
if (status != LINK_GOOD)
|
||||
return status != LINK_ERROR;
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ class IonCache
|
|||
LinkStatus linkCode(JSContext *cx, MacroAssembler &masm, IonScript *ion, IonCode **code);
|
||||
// Fixup variables and update jumps in the list of stubs. Increment the
|
||||
// number of attached stubs accordingly.
|
||||
void attachStub(MacroAssembler &masm, StubAttacher &attacher, IonCode *code);
|
||||
void attachStub(MacroAssembler &masm, StubAttacher &attacher, Handle<IonCode *> code);
|
||||
|
||||
// Combine both linkStub and attachStub into one function. In addition, it
|
||||
// produces a spew augmented with the attachKind string.
|
||||
|
|
|
@ -4505,7 +4505,7 @@ DebuggerObject_defineProperties(JSContext *cx, unsigned argc, Value *vp)
|
|||
ac.construct(cx, obj);
|
||||
RootedId id(cx);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
if (!rewrappedIds.append(jsid()) || !rewrappedDescs.append())
|
||||
if (!rewrappedIds.append(JSID_VOID) || !rewrappedDescs.append())
|
||||
return false;
|
||||
id = ids[i];
|
||||
if (!unwrappedDescs[i].wrapInto(cx, obj, id, &rewrappedIds[i], &rewrappedDescs[i]))
|
||||
|
|
|
@ -185,7 +185,7 @@ class ParallelDo
|
|||
|
||||
private:
|
||||
JSContext *cx_;
|
||||
HeapPtrObject fun_;
|
||||
HandleObject fun_;
|
||||
Vector<ParallelBailoutRecord, 16> bailoutRecords;
|
||||
|
||||
inline bool executeSequentially();
|
||||
|
|
Загрузка…
Ссылка в новой задаче