mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1194426 - Add sourceLength and functionDisplayNameLength to JS::ubi::StackFrame. r=sfink
This commit is contained in:
parent
9b02ae2e52
commit
e1c1277c38
@ -363,6 +363,10 @@ class StackFrame : public JS::Traceable {
|
||||
// terminated. Returns how many characters were written into the buffer.
|
||||
size_t functionDisplayName(RangedPtr<char16_t> destination, size_t length) const;
|
||||
|
||||
// Get the size of the respective strings. 0 is returned for null strings.
|
||||
size_t sourceLength();
|
||||
size_t functionDisplayNameLength();
|
||||
|
||||
// JS::Traceable implementation just forwards to our virtual trace method.
|
||||
static void trace(StackFrame* frame, JSTracer* trc) {
|
||||
if (frame)
|
||||
|
@ -112,6 +112,37 @@ StackFrame::functionDisplayName(RangedPtr<char16_t> destination, size_t length)
|
||||
return functionDisplayName().match(m);
|
||||
}
|
||||
|
||||
struct LengthMatcher
|
||||
{
|
||||
using ReturnType = size_t;
|
||||
|
||||
size_t
|
||||
match(JSAtom* atom)
|
||||
{
|
||||
return atom ? atom->length() : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
match(const char16_t* chars)
|
||||
{
|
||||
return chars ? js_strlen(chars) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
size_t
|
||||
StackFrame::sourceLength()
|
||||
{
|
||||
LengthMatcher m;
|
||||
return source().match(m);
|
||||
}
|
||||
|
||||
size_t
|
||||
StackFrame::functionDisplayNameLength()
|
||||
{
|
||||
LengthMatcher m;
|
||||
return functionDisplayName().match(m);
|
||||
}
|
||||
|
||||
// All operations on null ubi::Nodes crash.
|
||||
const char16_t* Concrete<void>::typeName() const { MOZ_CRASH("null ubi::Node"); }
|
||||
JS::Zone* Concrete<void>::zone() const { MOZ_CRASH("null ubi::Node"); }
|
||||
|
Loading…
Reference in New Issue
Block a user