зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1754405 part 1 - Remove JSID_IS_STRING/JSID_TO_STRING. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D138272
This commit is contained in:
Родитель
34ef2c6677
Коммит
32fccb425b
|
@ -116,9 +116,9 @@ bool RemoteOuterWindowProxy::getOwnPropertyDescriptor(
|
|||
// that are same-origin with their original principal and won't reach this
|
||||
// code in the cases when "print" should be accessible.
|
||||
|
||||
if (JSID_IS_STRING(aId)) {
|
||||
if (aId.isString()) {
|
||||
nsAutoJSString str;
|
||||
if (!str.init(aCx, JSID_TO_STRING(aId))) {
|
||||
if (!str.init(aCx, aId.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3079,7 +3079,7 @@ bool nsGlobalWindowInner::DoResolve(
|
|||
// Note: Keep this in sync with MayResolve.
|
||||
|
||||
// Note: The infallibleInit call in GlobalResolve depends on this check.
|
||||
if (!JSID_IS_STRING(aId)) {
|
||||
if (!aId.isString()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3143,7 +3143,7 @@ bool nsGlobalWindowInner::DoResolve(
|
|||
bool nsGlobalWindowInner::MayResolve(jsid aId) {
|
||||
// Note: This function does not fail and may not have any side-effects.
|
||||
// Note: Keep this in sync with DoResolve.
|
||||
if (!JSID_IS_STRING(aId)) {
|
||||
if (!aId.isString()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -691,9 +691,9 @@ bool nsOuterWindowProxy::getOwnPropertyDescriptor(
|
|||
}
|
||||
|
||||
// Step 6 -- check for named subframes.
|
||||
if (JSID_IS_STRING(id)) {
|
||||
if (id.isString()) {
|
||||
nsAutoJSString name;
|
||||
if (!name.init(cx, JSID_TO_STRING(id))) {
|
||||
if (!name.init(cx, id.toString())) {
|
||||
return false;
|
||||
}
|
||||
nsGlobalWindowOuter* win = GetOuterWindow(proxy);
|
||||
|
|
|
@ -1435,7 +1435,7 @@ static JSObject* XrayCreateFunction(JSContext* cx,
|
|||
JSNativeWrapper native, unsigned nargs,
|
||||
JS::Handle<jsid> id) {
|
||||
JSFunction* fun;
|
||||
if (JSID_IS_STRING(id)) {
|
||||
if (id.isString()) {
|
||||
fun = js::NewFunctionByIdWithReserved(cx, native.op, nargs, 0, id);
|
||||
} else {
|
||||
// Can't pass this id (probably a symbol) to NewFunctionByIdWithReserved;
|
||||
|
|
|
@ -22,7 +22,7 @@ bool CallbackInterface::GetCallableProperty(
|
|||
return false;
|
||||
}
|
||||
if (!aCallable.isObject() || !JS::IsCallable(&aCallable.toObject())) {
|
||||
JS::RootedString propId(cx, JSID_TO_STRING(aPropId));
|
||||
JS::RootedString propId(cx, aPropId.toString());
|
||||
JS::UniqueChars propName = JS_EncodeStringToUTF8(cx, propId);
|
||||
nsPrintfCString description("Property '%s'", propName.get());
|
||||
cx.ThrowErrorMessage<MSG_NOT_CALLABLE>(description.get());
|
||||
|
|
|
@ -44,8 +44,7 @@ static JSObject* FindNamedConstructorForXray(
|
|||
slot < JSCLASS_RESERVED_SLOTS(JS::GetClass(interfaceObject)); ++slot) {
|
||||
JSObject* constructor =
|
||||
&JS::GetReservedSlot(interfaceObject, slot).toObject();
|
||||
if (JS_GetFunctionId(JS_GetObjectFunction(constructor)) ==
|
||||
JSID_TO_STRING(aId)) {
|
||||
if (JS_GetFunctionId(JS_GetObjectFunction(constructor)) == aId.toString()) {
|
||||
return constructor;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +59,7 @@ bool WebIDLGlobalNameHash::DefineIfEnabled(
|
|||
JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId,
|
||||
JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> aDesc,
|
||||
bool* aFound) {
|
||||
MOZ_ASSERT(JSID_IS_STRING(aId), "Check for string id before calling this!");
|
||||
MOZ_ASSERT(aId.isString(), "Check for string id before calling this!");
|
||||
|
||||
const WebIDLNameTableEntry* entry = GetEntry(JSID_TO_LINEAR_STRING(aId));
|
||||
if (!entry) {
|
||||
|
@ -217,7 +216,7 @@ bool WebIDLGlobalNameHash::ResolveForSystemGlobal(JSContext* aCx,
|
|||
}
|
||||
|
||||
// We don't resolve any non-string entries.
|
||||
if (!JSID_IS_STRING(aId)) {
|
||||
if (!aId.isString()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -181,12 +181,6 @@ using jsid = JS::PropertyKey;
|
|||
|
||||
#define JSID_BITS(id) (id.asBits)
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool JSID_IS_STRING(jsid id) { return id.isString(); }
|
||||
|
||||
static MOZ_ALWAYS_INLINE JSString* JSID_TO_STRING(jsid id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool JSID_IS_INT(jsid id) { return id.isInt(); }
|
||||
|
||||
static MOZ_ALWAYS_INLINE int32_t JSID_TO_INT(jsid id) { return id.toInt(); }
|
||||
|
@ -264,8 +258,7 @@ struct BarrierMethods<jsid> {
|
|||
return nullptr;
|
||||
}
|
||||
static void postWriteBarrier(jsid* idp, jsid prev, jsid next) {
|
||||
MOZ_ASSERT_IF(JSID_IS_STRING(next),
|
||||
!gc::IsInsideNursery(JSID_TO_STRING(next)));
|
||||
MOZ_ASSERT_IF(next.isString(), !gc::IsInsideNursery(next.toString()));
|
||||
}
|
||||
static void exposeToJS(jsid id) {
|
||||
if (id.isGCThing()) {
|
||||
|
|
|
@ -204,8 +204,8 @@ extern JS_PUBLIC_API JSLinearString* JS_EnsureLinearString(JSContext* cx,
|
|||
JSString* str);
|
||||
|
||||
static MOZ_ALWAYS_INLINE JSLinearString* JSID_TO_LINEAR_STRING(jsid id) {
|
||||
MOZ_ASSERT(JSID_IS_STRING(id));
|
||||
return reinterpret_cast<JSLinearString*>(JSID_TO_STRING(id));
|
||||
MOZ_ASSERT(id.isString());
|
||||
return reinterpret_cast<JSLinearString*>(id.toString());
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE JSLinearString* JS_ASSERT_STRING_IS_LINEAR(
|
||||
|
|
|
@ -1651,11 +1651,11 @@ static bool TryEnumerableOwnPropertiesNative(JSContext* cx, HandleObject obj,
|
|||
|
||||
if constexpr (kind == EnumerableOwnPropertiesKind::Keys ||
|
||||
kind == EnumerableOwnPropertiesKind::Names) {
|
||||
value.setString(JSID_TO_STRING(id));
|
||||
value.setString(id.toString());
|
||||
} else if constexpr (kind == EnumerableOwnPropertiesKind::Values) {
|
||||
value.set(nobj->getSlot(iter->slot()));
|
||||
} else {
|
||||
key.setString(JSID_TO_STRING(id));
|
||||
key.setString(id.toString());
|
||||
value.set(nobj->getSlot(iter->slot()));
|
||||
if (!NewValuePair(cx, key, value, &value)) {
|
||||
return false;
|
||||
|
@ -1722,7 +1722,7 @@ static bool TryEnumerableOwnPropertiesNative(JSContext* cx, HandleObject obj,
|
|||
}
|
||||
|
||||
if (kind == EnumerableOwnPropertiesKind::KeysAndValues) {
|
||||
key.setString(JSID_TO_STRING(id));
|
||||
key.setString(id.toString());
|
||||
if (!NewValuePair(cx, key, value, &value)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2960,13 +2960,13 @@ static bool jsidToBigInteger(JSContext* cx, jsid val, bool allowString,
|
|||
int32_t i = JSID_TO_INT(val);
|
||||
return ConvertExact(i, result);
|
||||
}
|
||||
if (allowString && JSID_IS_STRING(val)) {
|
||||
if (allowString && val.isString()) {
|
||||
// Allow conversion from base-10 or base-16 strings, provided the result
|
||||
// fits in IntegerType. (This allows an Int64 or UInt64 object to be passed
|
||||
// to the JS array element operator, which will automatically call
|
||||
// toString() on the object for us.)
|
||||
bool dummy;
|
||||
return StringToInteger(cx, JSID_TO_STRING(val), result, &dummy);
|
||||
return StringToInteger(cx, val.toString(), result, &dummy);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3734,7 +3734,7 @@ static bool ImplicitConvert(JSContext* cx, HandleValue val,
|
|||
for (size_t i = 0; i < props.length(); ++i) {
|
||||
id = props[i];
|
||||
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
return PropNameNonStringError(cx, id, val, convType, funObj,
|
||||
argIndex);
|
||||
}
|
||||
|
@ -5666,8 +5666,8 @@ bool ArrayType::Getter(JSContext* cx, HandleObject obj, HandleId idval,
|
|||
return true;
|
||||
}
|
||||
bool dummy2;
|
||||
if (!ok && JSID_IS_STRING(idval) &&
|
||||
!StringToInteger(cx, JSID_TO_STRING(idval), &dummy, &dummy2)) {
|
||||
if (!ok && idval.isString() &&
|
||||
!StringToInteger(cx, idval.toString(), &dummy, &dummy2)) {
|
||||
// String either isn't a number, or doesn't fit in size_t.
|
||||
// Chances are it's a regular property lookup, so return.
|
||||
return true;
|
||||
|
@ -5713,8 +5713,8 @@ bool ArrayType::Setter(JSContext* cx, HandleObject obj, HandleId idval,
|
|||
return true;
|
||||
}
|
||||
bool dummy2;
|
||||
if (!ok && JSID_IS_STRING(idval) &&
|
||||
!StringToInteger(cx, JSID_TO_STRING(idval), &dummy, &dummy2)) {
|
||||
if (!ok && idval.isString() &&
|
||||
!StringToInteger(cx, idval.toString(), &dummy, &dummy2)) {
|
||||
// String either isn't a number, or doesn't fit in size_t.
|
||||
// Chances are it's a regular property lookup, so return.
|
||||
return result.succeed();
|
||||
|
@ -5818,7 +5818,7 @@ static JSLinearString* ExtractStructField(JSContext* cx, HandleValue val,
|
|||
}
|
||||
|
||||
RootedId nameid(cx, props[0]);
|
||||
if (!JSID_IS_STRING(nameid)) {
|
||||
if (!nameid.isString()) {
|
||||
FieldDescriptorNameError(cx, nameid);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -2349,7 +2349,7 @@ Maybe<Completion> DebuggerObject::call(JSContext* cx,
|
|||
/* static */
|
||||
bool DebuggerObject::forceLexicalInitializationByName(
|
||||
JSContext* cx, HandleDebuggerObject object, HandleId id, bool& result) {
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
JS_ReportErrorNumberASCII(
|
||||
cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
"Debugger.Object.prototype.forceLexicalInitializationByName", "string",
|
||||
|
|
|
@ -378,8 +378,7 @@ BEGIN_TEST(testGCRootedVector) {
|
|||
char letter = 'a' + i;
|
||||
bool match;
|
||||
ShapePropertyIter<NoGC> iter(shapes[i]);
|
||||
CHECK(JS_StringEqualsAscii(cx, JSID_TO_STRING(iter->key()), &letter, 1,
|
||||
&match));
|
||||
CHECK(JS_StringEqualsAscii(cx, iter->key().toString(), &letter, 1, &match));
|
||||
CHECK(match);
|
||||
}
|
||||
|
||||
|
@ -450,8 +449,7 @@ BEGIN_TEST(testTraceableFifo) {
|
|||
char letter = 'a' + i;
|
||||
bool match;
|
||||
ShapePropertyIter<NoGC> iter(shapes.front());
|
||||
CHECK(JS_StringEqualsAscii(cx, JSID_TO_STRING(iter->key()), &letter, 1,
|
||||
&match));
|
||||
CHECK(JS_StringEqualsAscii(cx, iter->key().toString(), &letter, 1, &match));
|
||||
CHECK(match);
|
||||
shapes.popFront();
|
||||
}
|
||||
|
@ -496,8 +494,7 @@ static bool CheckVector(JSContext* cx, Handle<ShapeVec> shapes) {
|
|||
char letter = 'a' + i;
|
||||
bool match;
|
||||
ShapePropertyIter<NoGC> iter(shapes[i]);
|
||||
if (!JS_StringEqualsAscii(cx, JSID_TO_STRING(iter->key()), &letter, 1,
|
||||
&match)) {
|
||||
if (!JS_StringEqualsAscii(cx, iter->key().toString(), &letter, 1, &match)) {
|
||||
return false;
|
||||
}
|
||||
if (!match) {
|
||||
|
|
|
@ -80,9 +80,9 @@ bool doResolve(JS::HandleObject obj, JS::HandleId id, bool* resolvedp) {
|
|||
AutoIncrCounters incr(this);
|
||||
CHECK(obj == obj1 || obj == obj2);
|
||||
|
||||
CHECK(JSID_IS_STRING(id));
|
||||
CHECK(id.isString());
|
||||
|
||||
JSLinearString* str = JS_EnsureLinearString(cx, JSID_TO_STRING(id));
|
||||
JSLinearString* str = JS_EnsureLinearString(cx, id.toString());
|
||||
CHECK(str);
|
||||
JS::RootedValue v(cx);
|
||||
if (JS_LinearStringEqualsLiteral(str, "x")) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class CustomProxyHandler : public Wrapper {
|
|||
bool getOwnPropertyDescriptor(
|
||||
JSContext* cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<mozilla::Maybe<PropertyDescriptor>> desc) const override {
|
||||
if (JSID_IS_STRING(id) &&
|
||||
if (id.isString() &&
|
||||
JS_LinearStringEqualsLiteral(JSID_TO_LINEAR_STRING(id), "phantom")) {
|
||||
desc.set(mozilla::Some(PropertyDescriptor::Data(
|
||||
Int32Value(42),
|
||||
|
|
|
@ -2181,7 +2181,7 @@ JS_PUBLIC_API JSFunction* JS::NewFunctionFromSpec(JSContext* cx,
|
|||
MOZ_ASSERT(SYMBOL_TO_JSID(cx->wellKnownSymbols().get(fs->name.symbol())) ==
|
||||
id);
|
||||
} else {
|
||||
MOZ_ASSERT(JSID_IS_STRING(id) &&
|
||||
MOZ_ASSERT(id.isString() &&
|
||||
StringEqualsAscii(JSID_TO_LINEAR_STRING(id), fs->name.string()));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -5664,7 +5664,7 @@ static bool GetModuleEnvironmentNames(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
array->setDenseInitializedLength(length);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
array->initDenseElement(i, StringValue(JSID_TO_STRING(ids[i])));
|
||||
array->initDenseElement(i, StringValue(ids[i].toString()));
|
||||
}
|
||||
|
||||
args.rval().setObject(*array);
|
||||
|
|
|
@ -73,7 +73,7 @@ bool GenerateInterfaceHelp(JSContext* cx, HandleObject obj, const char* name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!buf.append(usage.isString() ? usage.toString() : JSID_TO_STRING(id))) {
|
||||
if (!buf.append(usage.isString() ? usage.toString() : id.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ inline bool IndexToId(JSContext* cx, uint32_t index, MutableHandleId idp) {
|
|||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE JSLinearString* IdToString(JSContext* cx, jsid id) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
if (id.isString()) {
|
||||
return id.toAtom();
|
||||
}
|
||||
|
||||
|
|
|
@ -1455,7 +1455,7 @@ static bool TryAppendNativeProperties(JSContext* cx, HandleObject obj,
|
|||
continue;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(JSID_IS_STRING(id));
|
||||
MOZ_ASSERT(id.isString());
|
||||
if (!entries.append(id)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ bool JSStructuredCloneWriter::traverseObject(HandleObject obj, ESClass cls) {
|
|||
for (size_t i = properties.length(); i > 0; --i) {
|
||||
jsid id = properties[i - 1];
|
||||
|
||||
MOZ_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id));
|
||||
MOZ_ASSERT(id.isString() || id.isInt());
|
||||
if (!objectEntries.append(id)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ inline bool CanStartTypedArrayIndex(CharT ch) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (MOZ_UNLIKELY(!JSID_IS_STRING(id))) {
|
||||
if (MOZ_UNLIKELY(!id.isString())) {
|
||||
MOZ_ASSERT(indexp->isNothing());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1162,7 +1162,7 @@ nsresult mozJSComponentLoader::ExtractExports(
|
|||
symbolHolder = ResolveModuleObjectPropertyById(cx, aMod->obj, symbolId);
|
||||
if (!symbolHolder ||
|
||||
!JS_GetPropertyById(cx, symbolHolder, symbolId, &value)) {
|
||||
RootedString symbolStr(cx, JSID_TO_STRING(symbolId));
|
||||
RootedString symbolStr(cx, symbolId.toString());
|
||||
JS::UniqueChars bytes = JS_EncodeStringToUTF8(cx, symbolStr);
|
||||
if (!bytes) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1174,7 +1174,7 @@ nsresult mozJSComponentLoader::ExtractExports(
|
|||
// It's possible |value| is the uninitialized lexical MagicValue when
|
||||
// there's a cyclic import: const obj = ChromeUtils.import("parent.jsm").
|
||||
if (value.isMagic(JS_UNINITIALIZED_LEXICAL)) {
|
||||
RootedString symbolStr(cx, JSID_TO_STRING(symbolId));
|
||||
RootedString symbolStr(cx, symbolId.toString());
|
||||
JS::UniqueChars bytes = JS_EncodeStringToUTF8(cx, symbolStr);
|
||||
if (!bytes) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1188,7 +1188,7 @@ nsresult mozJSComponentLoader::ExtractExports(
|
|||
}
|
||||
|
||||
if (!JS_SetPropertyById(cx, aExports, symbolId, value)) {
|
||||
RootedString symbolStr(cx, JSID_TO_STRING(symbolId));
|
||||
RootedString symbolStr(cx, symbolId.toString());
|
||||
JS::UniqueChars bytes = JS_EncodeStringToUTF8(cx, symbolStr);
|
||||
if (!bytes) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1200,8 +1200,7 @@ nsresult mozJSComponentLoader::ExtractExports(
|
|||
if (i == 0) {
|
||||
logBuffer.AssignLiteral("Installing symbols [ ");
|
||||
}
|
||||
JS::UniqueChars bytes =
|
||||
JS_EncodeStringToLatin1(cx, JSID_TO_STRING(symbolId));
|
||||
JS::UniqueChars bytes = JS_EncodeStringToLatin1(cx, symbolId.toString());
|
||||
if (!!bytes) {
|
||||
logBuffer.Append(bytes.get());
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ bool ExportFunction(JSContext* cx, HandleValue vfunction, HandleValue vscope,
|
|||
} else {
|
||||
JS_MarkCrossZoneId(cx, id);
|
||||
}
|
||||
MOZ_ASSERT(JSID_IS_STRING(id));
|
||||
MOZ_ASSERT(id.isString());
|
||||
|
||||
// The function forwarder will live in the target compartment. Since
|
||||
// this function will be referenced from its private slot, to avoid a
|
||||
|
|
|
@ -69,7 +69,7 @@ static bool Services_NewEnumerate(JSContext* cx, HandleObject obj,
|
|||
}
|
||||
|
||||
static JSLinearString* GetNameIfLatin1(jsid id) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
if (id.isString()) {
|
||||
JSLinearString* name = JSID_TO_LINEAR_STRING(id);
|
||||
if (JS::LinearStringHasLatin1Chars(name)) {
|
||||
return name;
|
||||
|
|
|
@ -215,11 +215,11 @@ nsXPCComponents_Interfaces::Resolve(nsIXPConnectWrappedNative* wrapper,
|
|||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RootedString str(cx, JSID_TO_STRING(id));
|
||||
RootedString str(cx, id.toString());
|
||||
JS::UniqueChars name = JS_EncodeStringToLatin1(cx, str);
|
||||
|
||||
// we only allow interfaces by name here
|
||||
|
@ -369,8 +369,7 @@ nsXPCComponents_Classes::Resolve(nsIXPConnectWrappedNative* wrapper,
|
|||
RootedObject obj(cx, objArg);
|
||||
|
||||
RootedValue cidv(cx);
|
||||
if (JSID_IS_STRING(id) &&
|
||||
xpc::ContractID2JSValue(cx, JSID_TO_STRING(id), &cidv)) {
|
||||
if (id.isString() && xpc::ContractID2JSValue(cx, id.toString(), &cidv)) {
|
||||
*resolvedp = true;
|
||||
*_retval = JS_DefinePropertyById(cx, obj, id, cidv,
|
||||
JSPROP_ENUMERATE | JSPROP_READONLY |
|
||||
|
@ -498,11 +497,11 @@ nsXPCComponents_Results::Resolve(nsIXPConnectWrappedNative* wrapper,
|
|||
bool* resolvedp, bool* _retval) {
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::UniqueChars name = JS_EncodeStringToLatin1(cx, JSID_TO_STRING(id));
|
||||
JS::UniqueChars name = JS_EncodeStringToLatin1(cx, id.toString());
|
||||
if (name) {
|
||||
const char* rv_name;
|
||||
const void* iter = nullptr;
|
||||
|
|
|
@ -516,7 +516,7 @@ static bool IID_NewEnumerate(JSContext* cx, HandleObject obj,
|
|||
static bool IID_Resolve(JSContext* cx, HandleObject obj, HandleId id,
|
||||
bool* resolvedp) {
|
||||
*resolvedp = false;
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ static bool IID_Resolve(JSContext* cx, HandleObject obj, HandleId id,
|
|||
|
||||
static bool IID_MayResolve(const JSAtomState& names, jsid id,
|
||||
JSObject* maybeObj) {
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ void XPCThrower::Verbosify(XPCCallContext& ccx, char** psz, bool own) {
|
|||
const char* name;
|
||||
JS::UniqueChars bytes;
|
||||
if (!JSID_IS_VOID(id)) {
|
||||
bytes = JS_EncodeStringToLatin1(ccx, JSID_TO_STRING(id));
|
||||
bytes = JS_EncodeStringToLatin1(ccx, id.toString());
|
||||
name = bytes ? bytes.get() : "";
|
||||
} else {
|
||||
name = "Unknown";
|
||||
|
|
|
@ -87,7 +87,7 @@ bool XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
|
|||
JS_MarkCrossZoneId(ccx, name);
|
||||
|
||||
JSFunction* fun;
|
||||
if (JSID_IS_STRING(name)) {
|
||||
if (name.isString()) {
|
||||
fun = js::NewFunctionByIdWithReserved(ccx, callback, argc, 0, name);
|
||||
} else {
|
||||
fun = js::NewFunctionWithReserved(ccx, callback, argc, 0, nullptr);
|
||||
|
|
|
@ -343,11 +343,11 @@ static bool DefinePropertyIfFound(
|
|||
|
||||
bool defineProperty = false;
|
||||
do {
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (!id.isString()) {
|
||||
break;
|
||||
}
|
||||
|
||||
name = JS_EncodeStringToLatin1(ccx, JSID_TO_STRING(id));
|
||||
name = JS_EncodeStringToLatin1(ccx, id.toString());
|
||||
if (!name) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ NS_IMETHODIMP
|
|||
AsyncStatementJSHelper::Resolve(nsIXPConnectWrappedNative* aWrapper,
|
||||
JSContext* aCtx, JSObject* aScopeObj, jsid aId,
|
||||
bool* resolvedp, bool* _retval) {
|
||||
if (!JSID_IS_STRING(aId)) return NS_OK;
|
||||
if (!aId.isString()) return NS_OK;
|
||||
|
||||
// Cast to async via mozI* since direct from nsISupports is ambiguous.
|
||||
JS::RootedObject scope(aCtx, aScopeObj);
|
||||
|
|
|
@ -192,7 +192,7 @@ NS_IMETHODIMP
|
|||
StatementJSHelper::Resolve(nsIXPConnectWrappedNative* aWrapper, JSContext* aCtx,
|
||||
JSObject* aScopeObj, jsid aId, bool* aResolvedp,
|
||||
bool* _retval) {
|
||||
if (!JSID_IS_STRING(aId)) return NS_OK;
|
||||
if (!aId.isString()) return NS_OK;
|
||||
|
||||
JS::Rooted<JSObject*> scope(aCtx, aScopeObj);
|
||||
JS::Rooted<jsid> id(aCtx, aId);
|
||||
|
|
Загрузка…
Ссылка в новой задаче