Bug 1445854 - Part 2: Remove extra code to cope with prior bad behavior of GenericCreatePrototype. r=jwalden

Depends on D7666

Differential Revision: https://phabricator.services.mozilla.com/D7667

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jason Orendorff 2018-10-09 15:13:48 +00:00
Родитель adc7298478
Коммит 1d30ac7baa
5 изменённых файлов: 10 добавлений и 24 удалений

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

@ -11056,7 +11056,7 @@ Debugger::getObjectAllocationSite(JSObject& obj)
}
MOZ_ASSERT(!metadata->is<WrapperObject>());
return SavedFrame::isSavedFrameAndNotProto(*metadata)
return metadata->is<SavedFrame>()
? &metadata->as<SavedFrame>()
: nullptr;
}

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

@ -97,17 +97,12 @@ class SavedFrame : public NativeObject {
RootedIterator end() { return RootedIterator(); }
};
static bool isSavedFrameAndNotProto(JSObject& obj) {
return obj.is<SavedFrame>() &&
!obj.as<SavedFrame>().getReservedSlot(JSSLOT_SOURCE).isNull();
}
static bool isSavedFrameOrWrapperAndNotProto(JSObject& obj) {
static bool isSavedFrameOrWrapper(JSObject& obj) {
auto unwrapped = CheckedUnwrap(&obj);
if (!unwrapped) {
return false;
}
return isSavedFrameAndNotProto(*unwrapped);
return unwrapped->is<SavedFrame>();
}
struct Lookup;

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

@ -23,7 +23,7 @@ inline void
js::AssertObjectIsSavedFrameOrWrapper(JSContext* cx, HandleObject stack)
{
if (stack) {
MOZ_RELEASE_ASSERT(js::SavedFrame::isSavedFrameOrWrapperAndNotProto(*stack));
MOZ_RELEASE_ASSERT(js::SavedFrame::isSavedFrameOrWrapper(*stack));
}
}

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

@ -742,15 +742,6 @@ SavedFrame_checkThis(JSContext* cx, CallArgs& args, const char* fnName,
return false;
}
// Check for SavedFrame.prototype, which has the same class as SavedFrame
// instances, however doesn't actually represent a captured stack frame. It
// is the only object that is<SavedFrame>() but doesn't have a source.
if (!SavedFrame::isSavedFrameAndNotProto(*thisObject)) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
SavedFrame::class_.name, fnName, "prototype object");
return false;
}
// Now set "frame" to the actual object we were invoked in (which may be a
// wrapper), not the unwrapped version. Consumers will need to know what
// that original object was, and will do principal checks as needed.
@ -792,7 +783,7 @@ UnwrapSavedFrame(JSContext* cx, JSPrincipals* principals, HandleObject obj,
return nullptr;
}
MOZ_RELEASE_ASSERT(js::SavedFrame::isSavedFrameAndNotProto(*savedFrameObj));
MOZ_RELEASE_ASSERT(savedFrameObj->is<js::SavedFrame>());
js::RootedSavedFrame frame(cx, &savedFrameObj->as<js::SavedFrame>());
return GetFirstSubsumedFrame(cx, principals, frame, selfHosted, skippedAsync);
}
@ -1141,14 +1132,14 @@ JS_PUBLIC_API(bool)
IsMaybeWrappedSavedFrame(JSObject* obj)
{
MOZ_ASSERT(obj);
return js::SavedFrame::isSavedFrameOrWrapperAndNotProto(*obj);
return js::SavedFrame::isSavedFrameOrWrapper(*obj);
}
JS_PUBLIC_API(bool)
IsUnwrappedSavedFrame(JSObject* obj)
{
MOZ_ASSERT(obj);
return js::SavedFrame::isSavedFrameAndNotProto(*obj);
return obj->is<js::SavedFrame>();
}
} /* namespace JS */
@ -1313,7 +1304,7 @@ SavedStacks::copyAsyncStack(JSContext* cx, HandleObject asyncStack, HandleString
RootedObject asyncStackObj(cx, CheckedUnwrap(asyncStack));
MOZ_RELEASE_ASSERT(asyncStackObj);
MOZ_RELEASE_ASSERT(js::SavedFrame::isSavedFrameAndNotProto(*asyncStackObj));
MOZ_RELEASE_ASSERT(asyncStackObj->is<js::SavedFrame>());
adoptedStack.set(&asyncStackObj->as<js::SavedFrame>());
if (!adoptAsyncStack(cx, adoptedStack, asyncCauseAtom, maxFrameCount)) {

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

@ -1849,7 +1849,7 @@ JSStructuredCloneWriter::startWrite(HandleValue v)
if (wasm::IsSharedWasmMemoryObject(obj)) {
return writeSharedWasmMemory(obj);
}
if (SavedFrame::isSavedFrameOrWrapperAndNotProto(*obj)) {
if (SavedFrame::isSavedFrameOrWrapper(*obj)) {
return traverseSavedFrame(obj);
}
break;
@ -2085,7 +2085,7 @@ JSStructuredCloneWriter::write(HandleValue v)
if (!startWrite(key) || !startWrite(val)) {
return false;
}
} else if (cls == ESClass::Set || SavedFrame::isSavedFrameOrWrapperAndNotProto(*obj)) {
} else if (cls == ESClass::Set || SavedFrame::isSavedFrameOrWrapper(*obj)) {
key = otherEntries.popCopy();
checkStack();