mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1239601 - improve the UniquePtr situation (r=jandem)
This commit is contained in:
parent
cc7dac4e7d
commit
35647071dd
@ -467,7 +467,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
|
||||
unsigned lineNum = 0;
|
||||
NS_NAMED_LITERAL_STRING(scriptSample, "call to eval() or related function blocked by CSP");
|
||||
|
||||
JS::AutoFilename scriptFilename;
|
||||
JS::UniqueChars scriptFilename;
|
||||
if (JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNum)) {
|
||||
if (const char *file = scriptFilename.get()) {
|
||||
CopyUTF8toUTF16(nsDependentCString(file), fileName);
|
||||
|
@ -1256,7 +1256,7 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
unsigned lineno, column;
|
||||
JS::AutoFilename file;
|
||||
JS::UniqueChars file;
|
||||
if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno,
|
||||
&column)) {
|
||||
NS_WARNING("Failed to get line number and filename in workers.");
|
||||
@ -1491,7 +1491,7 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||
MOZ_ASSERT(aCx);
|
||||
|
||||
unsigned lineno, column;
|
||||
JS::AutoFilename file;
|
||||
JS::UniqueChars file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno, &column)) {
|
||||
mScriptFile = file.get();
|
||||
mScriptLine = lineno;
|
||||
|
@ -10552,7 +10552,7 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
}
|
||||
|
||||
// Check if we should offer the option to debug
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
unsigned lineno;
|
||||
bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
|
||||
|
@ -37,7 +37,7 @@ bool
|
||||
nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||
uint32_t* aLineno, uint32_t* aColumn)
|
||||
{
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||
return false;
|
||||
}
|
||||
@ -50,7 +50,7 @@ bool
|
||||
nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
||||
uint32_t* aLineno, uint32_t* aColumn)
|
||||
{
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ ContentSecurityPolicyAllows(JSContext* aCx)
|
||||
nsString fileName;
|
||||
uint32_t lineNum = 0;
|
||||
|
||||
JS::AutoFilename file;
|
||||
JS::UniqueChars file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineNum) && file.get()) {
|
||||
fileName = NS_ConvertUTF8toUTF16(file.get());
|
||||
} else {
|
||||
|
@ -4298,7 +4298,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow,
|
||||
|
||||
// We're being created outside of a window. Need to figure out the script
|
||||
// that is creating us in order for us to use relative URIs later on.
|
||||
JS::AutoFilename fileName;
|
||||
JS::UniqueChars fileName;
|
||||
if (JS::DescribeScriptedCaller(aCx, &fileName)) {
|
||||
// In most cases, fileName is URI. In a few other cases
|
||||
// (e.g. xpcshell), fileName is a file path. Ideally, we would
|
||||
|
@ -899,10 +899,10 @@ void
|
||||
WorkerDebuggerGlobalScope::ReportError(JSContext* aCx,
|
||||
const nsAString& aMessage)
|
||||
{
|
||||
JS::AutoFilename afn;
|
||||
JS::UniqueChars chars;
|
||||
uint32_t lineno = 0;
|
||||
JS::DescribeScriptedCaller(aCx, &afn, &lineno);
|
||||
nsString filename(NS_ConvertUTF8toUTF16(afn.get()));
|
||||
JS::DescribeScriptedCaller(aCx, &chars, &lineno);
|
||||
nsString filename(NS_ConvertUTF8toUTF16(chars.get()));
|
||||
mWorkerPrivate->ReportErrorToDebugger(filename, lineno, aMessage);
|
||||
}
|
||||
|
||||
|
@ -622,8 +622,7 @@ class Base {
|
||||
// Otherwise, place nullptr in the out parameter. Caller maintains ownership
|
||||
// of the out parameter. True is returned on success, false is returned on
|
||||
// OOM.
|
||||
virtual bool jsObjectConstructorName(JSContext* cx,
|
||||
js::UniquePtr<char16_t[], JS::FreePolicy>& outName) const {
|
||||
virtual bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const {
|
||||
outName.reset(nullptr);
|
||||
return true;
|
||||
}
|
||||
@ -769,8 +768,7 @@ class Node {
|
||||
JS::Zone* zone() const { return base()->zone(); }
|
||||
JSCompartment* compartment() const { return base()->compartment(); }
|
||||
const char* jsObjectClassName() const { return base()->jsObjectClassName(); }
|
||||
bool jsObjectConstructorName(JSContext* cx,
|
||||
js::UniquePtr<char16_t[], JS::FreePolicy>& outName) const {
|
||||
bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const {
|
||||
return base()->jsObjectConstructorName(cx, outName);
|
||||
}
|
||||
|
||||
@ -819,7 +817,7 @@ class Node {
|
||||
|
||||
/*** Edge and EdgeRange ***************************************************************************/
|
||||
|
||||
using EdgeName = js::UniquePtr<const char16_t[], JS::FreePolicy>;
|
||||
using EdgeName = UniqueTwoByteChars;
|
||||
|
||||
// An outgoing edge to a referent node.
|
||||
class Edge {
|
||||
@ -1066,8 +1064,7 @@ template<> struct Concrete<JSScript> : TracerConcreteWithCompartment<JSScript> {
|
||||
template<>
|
||||
class Concrete<JSObject> : public TracerConcreteWithCompartment<JSObject> {
|
||||
const char* jsObjectClassName() const override;
|
||||
bool jsObjectConstructorName(JSContext* cx,
|
||||
js::UniquePtr<char16_t[], JS::FreePolicy>& outName) const override;
|
||||
bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const override;
|
||||
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
|
||||
bool hasAllocationStack() const override;
|
||||
|
@ -480,6 +480,9 @@ struct FreePolicy
|
||||
}
|
||||
};
|
||||
|
||||
typedef mozilla::UniquePtr<char[], JS::FreePolicy> UniqueChars;
|
||||
typedef mozilla::UniquePtr<char16_t[], JS::FreePolicy> UniqueTwoByteChars;
|
||||
|
||||
} // namespace JS
|
||||
|
||||
namespace js {
|
||||
@ -488,13 +491,6 @@ namespace js {
|
||||
typedef uint32_t HashNumber;
|
||||
const unsigned HashNumberSizeBits = 32;
|
||||
|
||||
typedef mozilla::UniquePtr<char, JS::FreePolicy> UniqueChars;
|
||||
|
||||
static inline UniqueChars make_string_copy(const char* str)
|
||||
{
|
||||
return UniqueChars(js_strdup(str));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
/*
|
||||
|
@ -77,6 +77,8 @@ using JS::TwoByteChars;
|
||||
using JS::TwoByteCharsZ;
|
||||
using JS::UTF8Chars;
|
||||
using JS::UTF8CharsZ;
|
||||
using JS::UniqueChars;
|
||||
using JS::UniqueTwoByteChars;
|
||||
|
||||
using JS::AutoVectorRooter;
|
||||
typedef AutoVectorRooter<Value> AutoValueVector;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "jsmath.h"
|
||||
#include "jsprf.h"
|
||||
#include "jsstr.h"
|
||||
#include "jsutil.h"
|
||||
|
||||
#include "jswrapper.h"
|
||||
@ -1960,7 +1961,7 @@ class MOZ_STACK_CLASS ModuleValidator
|
||||
if (maybeFieldName)
|
||||
fieldName = StringToNewUTF8CharsZ(cx_, *maybeFieldName);
|
||||
else
|
||||
fieldName = make_string_copy("");
|
||||
fieldName = DuplicateString("");
|
||||
if (!fieldName || !module_->exportMap.fieldNames.append(Move(fieldName)))
|
||||
return false;
|
||||
|
||||
@ -2081,7 +2082,7 @@ class MOZ_STACK_CLASS ModuleValidator
|
||||
MOZ_ASSERT(errorOffset_ == UINT32_MAX);
|
||||
MOZ_ASSERT(str);
|
||||
errorOffset_ = offset;
|
||||
errorString_ = make_string_copy(str);
|
||||
errorString_ = DuplicateString(str);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2205,18 +2206,16 @@ class MOZ_STACK_CLASS ModuleValidator
|
||||
|
||||
CacheableChars filename;
|
||||
if (parser_.ss->filename()) {
|
||||
filename = make_string_copy(parser_.ss->filename());
|
||||
filename = DuplicateString(parser_.ss->filename());
|
||||
if (!filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheableTwoByteChars displayURL;
|
||||
if (parser_.ss->hasDisplayURL()) {
|
||||
uint32_t length = js_strlen(parser_.ss->displayURL());
|
||||
displayURL.reset(js_pod_calloc<char16_t>(length + 1));
|
||||
displayURL = DuplicateString(parser_.ss->displayURL());
|
||||
if (!displayURL)
|
||||
return false;
|
||||
PodCopy(displayURL.get(), parser_.ss->displayURL(), length);
|
||||
}
|
||||
|
||||
uint32_t endBeforeCurly = tokenStream().currentToken().pos.end;
|
||||
@ -8448,7 +8447,7 @@ BuildConsoleMessage(ExclusiveContext* cx, AsmJSModule& module, unsigned time,
|
||||
return UniqueChars(JS_smprintf("total compilation time %dms; %s%s",
|
||||
time, cacheString, slowText ? slowText.get() : ""));
|
||||
#else
|
||||
return make_string_copy("");
|
||||
return DuplicateString("");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -293,9 +293,9 @@ typedef Vector<CodeRange, 0, SystemAllocPolicy> CodeRangeVector;
|
||||
// A CacheableUniquePtr is used to cacheably store strings in Module.
|
||||
|
||||
template <class CharT>
|
||||
struct CacheableUniquePtr : public UniquePtr<CharT, JS::FreePolicy>
|
||||
struct CacheableUniquePtr : public UniquePtr<CharT[], JS::FreePolicy>
|
||||
{
|
||||
typedef UniquePtr<CharT, JS::FreePolicy> UPtr;
|
||||
typedef UniquePtr<CharT[], JS::FreePolicy> UPtr;
|
||||
explicit CacheableUniquePtr(CharT* ptr) : UPtr(ptr) {}
|
||||
MOZ_IMPLICIT CacheableUniquePtr(UPtr&& rhs) : UPtr(Move(rhs)) {}
|
||||
CacheableUniquePtr() = default;
|
||||
|
@ -629,8 +629,7 @@ js::obj_create(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
||||
if (!args[0].isObjectOrNull()) {
|
||||
RootedValue v(cx, args[0]);
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||
|
@ -2333,7 +2333,7 @@ ReportLargeAllocationFailure(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
||||
namespace heaptools {
|
||||
|
||||
typedef UniquePtr<char16_t[], JS::FreePolicy> EdgeName;
|
||||
typedef UniqueTwoByteChars EdgeName;
|
||||
|
||||
// An edge to a node from its predecessor in a path through the graph.
|
||||
class BackEdge {
|
||||
@ -2576,7 +2576,7 @@ EvalReturningScope(JSContext* cx, unsigned argc, Value* vp)
|
||||
size_t srclen = chars.length();
|
||||
const char16_t* src = chars.start().get();
|
||||
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
unsigned lineno;
|
||||
|
||||
JS::DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
@ -2662,7 +2662,7 @@ ShellCloneAndExecuteScript(JSContext* cx, unsigned argc, Value* vp)
|
||||
size_t srclen = chars.length();
|
||||
const char16_t* src = chars.start().get();
|
||||
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
unsigned lineno;
|
||||
|
||||
JS::DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
|
@ -168,8 +168,7 @@ WeakMap_set_impl(JSContext* cx, const CallArgs& args)
|
||||
MOZ_ASSERT(IsWeakMap(args.thisv()));
|
||||
|
||||
if (!args.get(0).isObject()) {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, args.get(0), nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, args.get(0), nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
|
||||
@ -354,7 +353,7 @@ WeakMap_construct(JSContext* cx, unsigned argc, Value* vp)
|
||||
// Steps 12k-l.
|
||||
if (isOriginalAdder) {
|
||||
if (keyVal.isPrimitive()) {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
UniqueChars bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
|
@ -124,7 +124,7 @@ WeakSetObject::construct(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
||||
if (isOriginalAdder) {
|
||||
if (keyVal.isPrimitive()) {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
UniqueChars bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
|
@ -856,7 +856,7 @@ bool
|
||||
TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated,
|
||||
const char* directive, int directiveLength,
|
||||
const char* errorMsgPragma,
|
||||
UniquePtr<char16_t[], JS::FreePolicy>* destination)
|
||||
UniqueTwoByteChars* destination)
|
||||
{
|
||||
MOZ_ASSERT(directiveLength <= 18);
|
||||
char16_t peeked[18];
|
||||
|
@ -1025,8 +1025,8 @@ class MOZ_STACK_CLASS TokenStream
|
||||
size_t prevLinebase; // start of previous line; size_t(-1) if on the first line
|
||||
TokenBuf userbuf; // user input buffer
|
||||
const char* filename; // input filename or null
|
||||
UniquePtr<char16_t[], JS::FreePolicy> displayURL_; // the user's requested source URL or null
|
||||
UniquePtr<char16_t[], JS::FreePolicy> sourceMapURL_; // source map's filename or null
|
||||
UniqueTwoByteChars displayURL_; // the user's requested source URL or null
|
||||
UniqueTwoByteChars sourceMapURL_; // source map's filename or null
|
||||
CharBuffer tokenbuf; // current token string buffer
|
||||
uint8_t isExprEnding[TOK_LIMIT];// which tokens definitely terminate exprs?
|
||||
ExclusiveContext* const cx;
|
||||
|
@ -345,7 +345,7 @@ Statistics::formatCompactSliceMessage() const
|
||||
slice.resetReason ? "yes - " : "no", slice.resetReason ? slice.resetReason : "");
|
||||
|
||||
FragmentVector fragments;
|
||||
if (!fragments.append(make_string_copy(buffer)) ||
|
||||
if (!fragments.append(DuplicateString(buffer)) ||
|
||||
!fragments.append(formatCompactSlicePhaseTimes(slices[index].phaseTimes)))
|
||||
{
|
||||
return UniqueChars(nullptr);
|
||||
@ -359,7 +359,7 @@ Statistics::formatCompactSummaryMessage() const
|
||||
const double bytesPerMiB = 1024 * 1024;
|
||||
|
||||
FragmentVector fragments;
|
||||
if (!fragments.append(make_string_copy("Summary - ")))
|
||||
if (!fragments.append(DuplicateString("Summary - ")))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
int64_t total, longest;
|
||||
@ -377,7 +377,7 @@ Statistics::formatCompactSummaryMessage() const
|
||||
JS_snprintf(buffer, sizeof(buffer), "Non-Incremental: %.3fms (%s); ",
|
||||
t(total), nonincrementalReason_);
|
||||
}
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
JS_snprintf(buffer, sizeof(buffer),
|
||||
@ -388,7 +388,7 @@ Statistics::formatCompactSummaryMessage() const
|
||||
double(preBytes) / bytesPerMiB,
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK],
|
||||
counts[STAT_NEW_CHUNK] + counts[STAT_DESTROY_CHUNK]);
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
MOZ_ASSERT_IF(counts[STAT_ARENA_RELOCATED], gckind == GC_SHRINK);
|
||||
@ -397,7 +397,7 @@ Statistics::formatCompactSummaryMessage() const
|
||||
"Kind: %s; Relocated: %.3f MiB; ",
|
||||
ExplainInvocationKind(gckind),
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
|
||||
@ -422,13 +422,13 @@ Statistics::formatCompactSlicePhaseTimes(const PhaseTimeTable phaseTimes) const
|
||||
int64_t childTime = SumChildTimes(dagSlot, phase, phaseTimes);
|
||||
if (ownTime > MaxUnaccountedTimeUS) {
|
||||
JS_snprintf(buffer, sizeof(buffer), "%s: %.3fms", phases[phase].name, t(ownTime));
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
if (childTime && (ownTime - childTime) > MaxUnaccountedTimeUS) {
|
||||
MOZ_ASSERT(level < 3);
|
||||
JS_snprintf(buffer, sizeof(buffer), "%s: %.3fms", "Other", t(ownTime - childTime));
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
}
|
||||
@ -503,7 +503,7 @@ Statistics::formatDetailedDescription()
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK], counts[STAT_NEW_CHUNK] +
|
||||
counts[STAT_DESTROY_CHUNK],
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
return make_string_copy(buffer);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
UniqueChars
|
||||
@ -527,7 +527,7 @@ Statistics::formatDetailedSliceDescription(unsigned i, const SliceData& slice)
|
||||
slice.resetReason ? "yes - " : "no", slice.resetReason ? slice.resetReason : "",
|
||||
uint64_t(slice.endFaults - slice.startFaults),
|
||||
t(slice.duration()), budgetDescription, t(slice.start - slices[0].start));
|
||||
return make_string_copy(buffer);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
UniqueChars
|
||||
@ -550,14 +550,14 @@ Statistics::formatDetailedPhaseTimes(const PhaseTimeTable phaseTimes)
|
||||
if (ownTime > 0) {
|
||||
JS_snprintf(buffer, sizeof(buffer), " %s%s: %.3fms\n",
|
||||
LevelToIndent[level], phases[phase].name, t(ownTime));
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
if (childTime && (ownTime - childTime) > MaxUnaccountedChildTimeUS) {
|
||||
MOZ_ASSERT(level < 3);
|
||||
JS_snprintf(buffer, sizeof(buffer), " %s%s: %.3fms\n",
|
||||
LevelToIndent[level + 1], "Other", t(ownTime - childTime));
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
}
|
||||
@ -580,7 +580,7 @@ Statistics::formatDetailedTotals()
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format, t(total), t(longest));
|
||||
return make_string_copy(buffer);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
UniqueChars
|
||||
@ -590,28 +590,28 @@ Statistics::formatJsonMessage(uint64_t timestamp)
|
||||
|
||||
FragmentVector fragments;
|
||||
|
||||
if (!fragments.append(make_string_copy("{")) ||
|
||||
if (!fragments.append(DuplicateString("{")) ||
|
||||
!fragments.append(formatJsonDescription(timestamp)) ||
|
||||
!fragments.append(make_string_copy("\"slices\":[")))
|
||||
!fragments.append(DuplicateString("\"slices\":[")))
|
||||
{
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < slices.length(); i++) {
|
||||
if (!fragments.append(make_string_copy("{")) ||
|
||||
if (!fragments.append(DuplicateString("{")) ||
|
||||
!fragments.append(formatJsonSliceDescription(i, slices[i])) ||
|
||||
!fragments.append(make_string_copy("\"times\":{")) ||
|
||||
!fragments.append(DuplicateString("\"times\":{")) ||
|
||||
!fragments.append(formatJsonPhaseTimes(slices[i].phaseTimes)) ||
|
||||
!fragments.append(make_string_copy("}}")) ||
|
||||
(i < (slices.length() - 1) && !fragments.append(make_string_copy(","))))
|
||||
!fragments.append(DuplicateString("}}")) ||
|
||||
(i < (slices.length() - 1) && !fragments.append(DuplicateString(","))))
|
||||
{
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fragments.append(make_string_copy("],\"totals\":{")) ||
|
||||
if (!fragments.append(DuplicateString("],\"totals\":{")) ||
|
||||
!fragments.append(formatJsonPhaseTimes(phaseTimes)) ||
|
||||
!fragments.append(make_string_copy("}}")))
|
||||
!fragments.append(DuplicateString("}}")))
|
||||
{
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
@ -667,7 +667,7 @@ Statistics::formatJsonDescription(uint64_t timestamp)
|
||||
unsigned(preBytes / 1024 / 1024),
|
||||
counts[STAT_NEW_CHUNK],
|
||||
counts[STAT_DESTROY_CHUNK]);
|
||||
return make_string_copy(buffer);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
UniqueChars
|
||||
@ -699,7 +699,7 @@ Statistics::formatJsonSliceDescription(unsigned i, const SliceData& slice)
|
||||
pageFaults,
|
||||
slices[i].start,
|
||||
slices[i].end);
|
||||
return make_string_copy(buffer);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
UniqueChars
|
||||
@ -732,7 +732,7 @@ Statistics::formatJsonPhaseTimes(const PhaseTimeTable phaseTimes)
|
||||
JS_snprintf(buffer, sizeof(buffer), "\"%s\":%llu.%03llu",
|
||||
name.get(), ownTime / 1000, ownTime % 1000);
|
||||
|
||||
if (!fragments.append(make_string_copy(buffer)))
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
return Join(fragments, ",");
|
||||
|
@ -143,7 +143,7 @@ BEGIN_TEST(test_ubiNodeJSObjectConstructorName)
|
||||
EVAL("this.Ctor = function Ctor() {}; new Ctor", &val);
|
||||
CHECK(val.isObject());
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy> ctorName;
|
||||
UniqueTwoByteChars ctorName;
|
||||
CHECK(JS::ubi::Node(&val.toObject()).jsObjectConstructorName(cx, ctorName));
|
||||
CHECK(ctorName);
|
||||
CHECK(js_strcmp(ctorName.get(), MOZ_UTF16("Ctor")) == 0);
|
||||
|
@ -130,7 +130,7 @@ BEGIN_TEST(testXDR_sourceMap)
|
||||
CHECK(script);
|
||||
|
||||
size_t len = strlen(*sm);
|
||||
UniquePtr<char16_t,JS::FreePolicy> expected_wrapper(js::InflateString(cx, *sm, &len));
|
||||
UniqueTwoByteChars expected_wrapper(js::InflateString(cx, *sm, &len));
|
||||
char16_t *expected = expected_wrapper.get();
|
||||
CHECK(expected);
|
||||
|
||||
|
@ -3904,7 +3904,7 @@ JS::OwningCompileOptions::setFileAndLine(JSContext* cx, const char* f, unsigned
|
||||
bool
|
||||
JS::OwningCompileOptions::setSourceMapURL(JSContext* cx, const char16_t* s)
|
||||
{
|
||||
UniquePtr<char16_t[], JS::FreePolicy> copy;
|
||||
UniqueTwoByteChars copy;
|
||||
if (s) {
|
||||
copy = DuplicateString(cx, s);
|
||||
if (!copy)
|
||||
@ -3989,7 +3989,7 @@ static bool
|
||||
Compile(JSContext* cx, const ReadOnlyCompileOptions& options, SyntacticScopeOption scopeOption,
|
||||
const char* bytes, size_t length, MutableHandleScript script)
|
||||
{
|
||||
UniquePtr<char16_t, JS::FreePolicy> chars;
|
||||
UniqueTwoByteChars chars;
|
||||
if (options.utf8)
|
||||
chars.reset(UTF8CharsToNewTwoByteCharsZ(cx, UTF8Chars(bytes, length), &length).get());
|
||||
else
|
||||
@ -4318,7 +4318,7 @@ JS::CompileFunction(JSContext* cx, AutoObjectVector& scopeChain,
|
||||
const char* name, unsigned nargs, const char* const* argnames,
|
||||
const char* bytes, size_t length, MutableHandleFunction fun)
|
||||
{
|
||||
UniquePtr<char16_t, JS::FreePolicy> chars;
|
||||
UniqueTwoByteChars chars;
|
||||
if (options.utf8)
|
||||
chars.reset(UTF8CharsToNewTwoByteCharsZ(cx, UTF8Chars(bytes, length), &length).get());
|
||||
else
|
||||
@ -5980,7 +5980,7 @@ DescribeScriptedCaller(JSContext* cx, UniqueChars* filename, unsigned* lineno,
|
||||
return false;
|
||||
|
||||
if (filename && i.filename()) {
|
||||
UniqueChars copy = make_string_copy(i.filename());
|
||||
UniqueChars copy = DuplicateString(i.filename());
|
||||
if (!copy)
|
||||
return false;
|
||||
*filename = Move(copy);
|
||||
|
@ -5312,8 +5312,6 @@ JS_IsIdentifier(const char16_t* chars, size_t length);
|
||||
|
||||
namespace JS {
|
||||
|
||||
typedef js::UniqueChars AutoFilename;
|
||||
|
||||
/**
|
||||
* Return the current filename, line number and column number of the most
|
||||
* currently running frame. Returns true if a scripted frame was found, false
|
||||
@ -5323,7 +5321,7 @@ typedef js::UniqueChars AutoFilename;
|
||||
* record, this will also return false.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
DescribeScriptedCaller(JSContext* cx, AutoFilename* filename = nullptr,
|
||||
DescribeScriptedCaller(JSContext* cx, UniqueChars* filename = nullptr,
|
||||
unsigned* lineno = nullptr, unsigned* column = nullptr);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject*)
|
||||
|
@ -3655,8 +3655,7 @@ js::ArrayInfo(JSContext* cx, unsigned argc, Value* vp)
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
RootedValue arg(cx, args[i]);
|
||||
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
if (arg.isPrimitive() ||
|
||||
|
@ -842,8 +842,7 @@ js::ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
|
||||
{
|
||||
bool ok;
|
||||
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, spindex, v, fallback);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, spindex, v, fallback);
|
||||
if (!bytes)
|
||||
return false;
|
||||
|
||||
@ -873,7 +872,7 @@ void
|
||||
js::ReportMissingArg(JSContext* cx, HandleValue v, unsigned arg)
|
||||
{
|
||||
char argbuf[11];
|
||||
UniquePtr<char[], JS::FreePolicy> bytes;
|
||||
UniqueChars bytes;
|
||||
RootedAtom atom(cx);
|
||||
|
||||
JS_snprintf(argbuf, sizeof argbuf, "%u", arg);
|
||||
@ -893,7 +892,7 @@ js::ReportValueErrorFlags(JSContext* cx, unsigned flags, const unsigned errorNum
|
||||
int spindex, HandleValue v, HandleString fallback,
|
||||
const char* arg1, const char* arg2)
|
||||
{
|
||||
UniquePtr<char[], JS::FreePolicy> bytes;
|
||||
UniqueChars bytes;
|
||||
bool ok;
|
||||
|
||||
MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount >= 1);
|
||||
|
@ -7437,7 +7437,7 @@ JS::GCDescription::formatSliceMessage(JSRuntime* rt) const
|
||||
UniqueChars cstr = rt->gc.stats.formatCompactSliceMessage();
|
||||
|
||||
size_t nchars = strlen(cstr.get());
|
||||
UniquePtr<char16_t, JS::FreePolicy> out(js_pod_malloc<char16_t>(nchars + 1));
|
||||
UniqueTwoByteChars out(js_pod_malloc<char16_t>(nchars + 1));
|
||||
if (!out)
|
||||
return nullptr;
|
||||
out.get()[nchars] = 0;
|
||||
@ -7452,7 +7452,7 @@ JS::GCDescription::formatSummaryMessage(JSRuntime* rt) const
|
||||
UniqueChars cstr = rt->gc.stats.formatCompactSummaryMessage();
|
||||
|
||||
size_t nchars = strlen(cstr.get());
|
||||
UniquePtr<char16_t, JS::FreePolicy> out(js_pod_malloc<char16_t>(nchars + 1));
|
||||
UniqueTwoByteChars out(js_pod_malloc<char16_t>(nchars + 1));
|
||||
if (!out)
|
||||
return nullptr;
|
||||
out.get()[nchars] = 0;
|
||||
@ -7473,7 +7473,7 @@ JS::GCDescription::formatJSON(JSRuntime* rt, uint64_t timestamp) const
|
||||
UniqueChars cstr = rt->gc.stats.formatJsonMessage(timestamp);
|
||||
|
||||
size_t nchars = strlen(cstr.get());
|
||||
UniquePtr<char16_t, JS::FreePolicy> out(js_pod_malloc<char16_t>(nchars + 1));
|
||||
UniqueTwoByteChars out(js_pod_malloc<char16_t>(nchars + 1));
|
||||
if (!out)
|
||||
return nullptr;
|
||||
out.get()[nchars] = 0;
|
||||
|
@ -81,8 +81,7 @@ js::ReportNotObject(JSContext* cx, const Value& v)
|
||||
MOZ_ASSERT(!v.isObject());
|
||||
|
||||
RootedValue value(cx, v);
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
|
||||
if (bytes)
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
|
||||
}
|
||||
@ -195,8 +194,7 @@ js::GetFirstArgumentAsObject(JSContext* cx, const CallArgs& args, const char* me
|
||||
|
||||
HandleValue v = args[0];
|
||||
if (!v.isObject()) {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||
|
@ -1403,9 +1403,7 @@ DecompileExpressionFromStack(JSContext* cx, int spindex, int skipStackHits, Hand
|
||||
return ed.getOutput(res);
|
||||
}
|
||||
|
||||
typedef UniquePtr<char[], JS::FreePolicy> UniquePtrChars;
|
||||
|
||||
UniquePtrChars
|
||||
UniqueChars
|
||||
js::DecompileValueGenerator(JSContext* cx, int spindex, HandleValue v,
|
||||
HandleString fallbackArg, int skipStackHits)
|
||||
{
|
||||
@ -1416,19 +1414,19 @@ js::DecompileValueGenerator(JSContext* cx, int spindex, HandleValue v,
|
||||
return nullptr;
|
||||
if (result) {
|
||||
if (strcmp(result, "(intermediate value)"))
|
||||
return UniquePtrChars(result);
|
||||
return UniqueChars(result);
|
||||
js_free(result);
|
||||
}
|
||||
}
|
||||
if (!fallback) {
|
||||
if (v.isUndefined())
|
||||
return UniquePtrChars(JS_strdup(cx, js_undefined_str)); // Prevent users from seeing "(void 0)"
|
||||
return UniqueChars(JS_strdup(cx, js_undefined_str)); // Prevent users from seeing "(void 0)"
|
||||
fallback = ValueToSource(cx, v);
|
||||
if (!fallback)
|
||||
return UniquePtrChars(nullptr);
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
|
||||
return UniquePtrChars(JS_EncodeString(cx, fallback));
|
||||
return UniqueChars(JS_EncodeString(cx, fallback));
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -557,7 +557,7 @@ GetVariableBytecodeLength(jsbytecode* pc);
|
||||
*
|
||||
* The caller must call JS_free on the result after a successful call.
|
||||
*/
|
||||
UniquePtr<char[], JS::FreePolicy>
|
||||
UniqueChars
|
||||
DecompileValueGenerator(JSContext* cx, int spindex, HandleValue v,
|
||||
HandleString fallback, int skipStackHits = 0);
|
||||
|
||||
|
@ -630,10 +630,10 @@ class ScriptSource
|
||||
uint32_t length_;
|
||||
|
||||
// The filename of this script.
|
||||
UniquePtr<char[], JS::FreePolicy> filename_;
|
||||
UniqueChars filename_;
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy> displayURL_;
|
||||
UniquePtr<char16_t[], JS::FreePolicy> sourceMapURL_;
|
||||
UniqueTwoByteChars displayURL_;
|
||||
UniqueTwoByteChars sourceMapURL_;
|
||||
bool mutedErrors_;
|
||||
|
||||
// bytecode offset in caller script that generated this code.
|
||||
@ -651,7 +651,7 @@ class ScriptSource
|
||||
//
|
||||
// In the case described above, this field will be non-null and will be the
|
||||
// original raw filename from above. Otherwise this field will be null.
|
||||
UniquePtr<char[], JS::FreePolicy> introducerFilename_;
|
||||
UniqueChars introducerFilename_;
|
||||
|
||||
// A string indicating how this source code was introduced into the system.
|
||||
// This accessor returns one of the following values:
|
||||
|
@ -4709,7 +4709,7 @@ js_strcmp(const char16_t* lhs, const char16_t* rhs)
|
||||
}
|
||||
}
|
||||
|
||||
UniquePtr<char[], JS::FreePolicy>
|
||||
UniqueChars
|
||||
js::DuplicateString(js::ExclusiveContext* cx, const char* s)
|
||||
{
|
||||
size_t n = strlen(s) + 1;
|
||||
@ -4720,7 +4720,7 @@ js::DuplicateString(js::ExclusiveContext* cx, const char* s)
|
||||
return ret;
|
||||
}
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy>
|
||||
UniqueTwoByteChars
|
||||
js::DuplicateString(js::ExclusiveContext* cx, const char16_t* s)
|
||||
{
|
||||
size_t n = js_strlen(s) + 1;
|
||||
@ -4731,11 +4731,17 @@ js::DuplicateString(js::ExclusiveContext* cx, const char16_t* s)
|
||||
return ret;
|
||||
}
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy>
|
||||
UniqueChars
|
||||
js::DuplicateString(const char* s)
|
||||
{
|
||||
return UniqueChars(js_strdup(s));
|
||||
}
|
||||
|
||||
UniqueTwoByteChars
|
||||
js::DuplicateString(const char16_t* s)
|
||||
{
|
||||
size_t n = js_strlen(s) + 1;
|
||||
UniquePtr<char16_t[], JS::FreePolicy> ret(js_pod_malloc<char16_t>(n));
|
||||
UniqueTwoByteChars ret(js_pod_malloc<char16_t>(n));
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
PodCopy(ret.get(), s, n);
|
||||
|
@ -123,15 +123,20 @@ InitStringClass(JSContext* cx, HandleObject obj);
|
||||
extern const char*
|
||||
ValueToPrintable(JSContext* cx, const Value&, JSAutoByteString* bytes, bool asSource = false);
|
||||
|
||||
extern UniquePtr<char[], JS::FreePolicy>
|
||||
extern UniqueChars
|
||||
DuplicateString(ExclusiveContext* cx, const char* s);
|
||||
|
||||
extern UniquePtr<char16_t[], JS::FreePolicy>
|
||||
extern UniqueTwoByteChars
|
||||
DuplicateString(ExclusiveContext* cx, const char16_t* s);
|
||||
|
||||
// This variant does not report OOMs, you must arrange for OOMs to be reported
|
||||
// yourself.
|
||||
extern UniquePtr<char16_t[], JS::FreePolicy>
|
||||
/*
|
||||
* These variants do not report OOMs, you must arrange for OOMs to be reported
|
||||
* yourself.
|
||||
*/
|
||||
extern UniqueChars
|
||||
DuplicateString(const char* s);
|
||||
|
||||
extern UniqueTwoByteChars
|
||||
DuplicateString(const char16_t* s);
|
||||
|
||||
/*
|
||||
|
@ -210,8 +210,7 @@ static PerfMeasurement*
|
||||
GetPM(JSContext* cx, JS::HandleValue value, const char* fname)
|
||||
{
|
||||
if (!value.isObject()) {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
|
||||
if (!bytes)
|
||||
return nullptr;
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, 0, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
|
||||
|
@ -108,7 +108,7 @@ ResolvePath(JSContext* cx, HandleString filenameStr, PathResolutionMode resolveM
|
||||
return filenameStr;
|
||||
|
||||
/* Get the currently executing script's name. */
|
||||
JS::AutoFilename scriptFilename;
|
||||
JS::UniqueChars scriptFilename;
|
||||
if (!DescribeScriptedCaller(cx, &scriptFilename))
|
||||
return nullptr;
|
||||
|
||||
|
@ -2696,7 +2696,7 @@ EvalInContext(JSContext* cx, unsigned argc, Value* vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
unsigned lineno;
|
||||
|
||||
DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
@ -3354,7 +3354,7 @@ ParseModule(JSContext* cx, unsigned argc, Value* vp)
|
||||
if (!scriptContents)
|
||||
return false;
|
||||
|
||||
UniquePtr<char, JS::FreePolicy> filename;
|
||||
UniqueChars filename;
|
||||
CompileOptions options(cx);
|
||||
if (args.length() > 1) {
|
||||
if (!args[1].isString()) {
|
||||
@ -3951,7 +3951,7 @@ ThisFilename(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
if (!DescribeScriptedCaller(cx, &filename) || !filename.get()) {
|
||||
args.rval().setString(cx->runtime()->emptyString);
|
||||
return true;
|
||||
@ -4642,7 +4642,7 @@ class ShellAutoEntryMonitor : JS::dbg::AutoEntryMonitor {
|
||||
return;
|
||||
}
|
||||
|
||||
oom = !log.append(make_string_copy("anonymous"));
|
||||
oom = !log.append(DuplicateString("anonymous"));
|
||||
}
|
||||
|
||||
void Entry(JSContext* cx, JSScript* script, JS::HandleValue asyncStack,
|
||||
@ -5509,7 +5509,7 @@ PrintStackTrace(JSContext* cx, HandleValue exn)
|
||||
if (!BuildStackString(cx, stackObj, &stackStr, 2))
|
||||
return false;
|
||||
|
||||
UniquePtr<char[], JS::FreePolicy> stack(JS_EncodeStringToUTF8(cx, stackStr));
|
||||
UniqueChars stack(JS_EncodeStringToUTF8(cx, stackStr));
|
||||
if (!stack)
|
||||
return false;
|
||||
|
||||
|
@ -69,8 +69,7 @@ ForOfIterator::init(HandleValue iterable, NonIterableBehavior nonIterableBehavio
|
||||
// throw an inscrutable error message about |method| rather than this nice
|
||||
// one about |obj|.
|
||||
if (!callee.isObject() || !callee.toObject().isCallable()) {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK,
|
||||
iterable, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, iterable, nullptr);
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_ITERABLE, bytes.get());
|
||||
|
@ -234,8 +234,7 @@ ThrowErrorWithType(JSContext* cx, JSExnType type, const CallArgs& args)
|
||||
} else if (val.isString()) {
|
||||
errorArgs[i - 1].encodeLatin1(cx, val.toString());
|
||||
} else {
|
||||
UniquePtr<char[], JS::FreePolicy> bytes =
|
||||
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, val, nullptr);
|
||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, val, nullptr);
|
||||
if (!bytes)
|
||||
return;
|
||||
errorArgs[i - 1].initBytes(bytes.release());
|
||||
|
@ -122,7 +122,7 @@ class TraceLoggerEvent {
|
||||
*/
|
||||
class TraceLoggerEventPayload {
|
||||
uint32_t textId_;
|
||||
UniquePtr<char, JS::FreePolicy> string_;
|
||||
UniqueChars string_;
|
||||
uint32_t uses_;
|
||||
|
||||
public:
|
||||
|
@ -348,8 +348,7 @@ Concrete<JSObject>::jsObjectClassName() const
|
||||
}
|
||||
|
||||
bool
|
||||
Concrete<JSObject>::jsObjectConstructorName(JSContext* cx,
|
||||
UniquePtr<char16_t[], JS::FreePolicy>& outName) const
|
||||
Concrete<JSObject>::jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const
|
||||
{
|
||||
JSAtom* name = Concrete::get().maybeConstructorDisplayAtom();
|
||||
if (!name) {
|
||||
@ -488,7 +487,7 @@ RootList::addRoot(Node node, const char16_t* edgeName)
|
||||
MOZ_ASSERT(noGC.isSome());
|
||||
MOZ_ASSERT_IF(wantNames, edgeName);
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy> name;
|
||||
UniqueTwoByteChars name;
|
||||
if (edgeName) {
|
||||
name = js::DuplicateString(edgeName);
|
||||
if (!name)
|
||||
|
@ -49,12 +49,12 @@ class SimpleCount : public CountType {
|
||||
{ }
|
||||
};
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy> label;
|
||||
UniqueTwoByteChars label;
|
||||
bool reportCount : 1;
|
||||
bool reportBytes : 1;
|
||||
|
||||
public:
|
||||
explicit SimpleCount(UniquePtr<char16_t[], JS::FreePolicy>& label,
|
||||
explicit SimpleCount(UniqueTwoByteChars& label,
|
||||
bool reportCount=true,
|
||||
bool reportBytes=true)
|
||||
: CountType(),
|
||||
@ -929,7 +929,7 @@ ParseBreakdown(JSContext* cx, HandleValue breakdownValue)
|
||||
if (!GetProperty(cx, breakdown, breakdown, cx->names().label, &label))
|
||||
return nullptr;
|
||||
|
||||
UniquePtr<char16_t[], JS::FreePolicy> labelUnique(nullptr);
|
||||
UniqueTwoByteChars labelUnique(nullptr);
|
||||
if (!label.isUndefined()) {
|
||||
RootedString labelString(cx, ToString(cx, label));
|
||||
if (!labelString)
|
||||
|
@ -600,7 +600,7 @@ mozJSSubScriptLoader::DoLoadSubScriptWithOptions(const nsAString& url,
|
||||
nsAutoCString scheme;
|
||||
|
||||
// Figure out who's calling us
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
if (!JS::DescribeScriptedCaller(cx, &filename)) {
|
||||
// No scripted frame means we don't know who's calling, bail.
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -127,7 +127,7 @@ GetLocationProperty(JSContext* cx, unsigned argc, Value* vp)
|
||||
//XXX: your platform should really implement this
|
||||
return false;
|
||||
#else
|
||||
JS::AutoFilename filename;
|
||||
JS::UniqueChars filename;
|
||||
if (JS::DescribeScriptedCaller(cx, &filename) && filename.get()) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXPConnect> xpc =
|
||||
|
@ -205,7 +205,7 @@ ReportWrapperDenial(JSContext* cx, HandleId id, WrapperDenialType type, const ch
|
||||
return false;
|
||||
if (!propertyName.init(cx, str))
|
||||
return false;
|
||||
AutoFilename filename;
|
||||
UniqueChars filename;
|
||||
unsigned line = 0, column = 0;
|
||||
DescribeScriptedCaller(cx, &filename, &line, &column);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user