mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1055206 - Handle null frames in Debugger::onLogAllocationSite. r=jimb
This commit is contained in:
parent
56d1e0110b
commit
0f5ad49b12
@ -63,6 +63,7 @@ UNIFIED_SOURCES += [
|
||||
'testResolveRecursion.cpp',
|
||||
'tests.cpp',
|
||||
'testSameValue.cpp',
|
||||
'testSavedStacks.cpp',
|
||||
'testScriptInfo.cpp',
|
||||
'testScriptObject.cpp',
|
||||
'testSetProperty.cpp',
|
||||
|
24
js/src/jsapi-tests/testSavedStacks.cpp
Normal file
24
js/src/jsapi-tests/testSavedStacks.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "jscompartment.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsstr.h"
|
||||
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
#include "vm/ArrayObject.h"
|
||||
#include "vm/SavedStacks.h"
|
||||
|
||||
BEGIN_TEST(testSavedStacks_withNoStack)
|
||||
{
|
||||
JSCompartment *compartment = js::GetContextCompartment(cx);
|
||||
compartment->setObjectMetadataCallback(js::SavedStacksMetadataCallback);
|
||||
JS::RootedObject obj(cx, js::NewDenseEmptyArray(cx));
|
||||
compartment->setObjectMetadataCallback(nullptr);
|
||||
return true;
|
||||
}
|
||||
END_TEST(testSavedStacks_withNoStack)
|
@ -202,7 +202,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
||||
struct AllocationSite : public mozilla::LinkedListElement<AllocationSite>
|
||||
{
|
||||
AllocationSite(HandleObject frame) : frame(frame) {
|
||||
JS_ASSERT(UncheckedUnwrap(frame)->is<SavedFrame>());
|
||||
JS_ASSERT_IF(frame, UncheckedUnwrap(frame)->is<SavedFrame>());
|
||||
};
|
||||
RelocatablePtrObject frame;
|
||||
};
|
||||
@ -790,7 +790,7 @@ Debugger::onNewGlobalObject(JSContext *cx, Handle<GlobalObject *> global)
|
||||
bool
|
||||
Debugger::onLogAllocationSite(JSContext *cx, HandleSavedFrame frame)
|
||||
{
|
||||
GlobalObject::DebuggerVector *dbgs = frame->global().getDebuggers();
|
||||
GlobalObject::DebuggerVector *dbgs = cx->global()->getDebuggers();
|
||||
if (!dbgs || dbgs->empty())
|
||||
return true;
|
||||
return Debugger::slowPathOnLogAllocationSite(cx, frame, *dbgs);
|
||||
|
@ -198,7 +198,7 @@ DebuggerMemory::drainAllocationsLog(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
Debugger::AllocationSite *allocSite = dbg->allocationsLog.popFirst();
|
||||
result->setDenseElement(i, ObjectValue(*allocSite->frame));
|
||||
result->setDenseElement(i, ObjectOrNullValue(allocSite->frame));
|
||||
js_delete(allocSite);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user