зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472170- Added description as a property for Symbol and updated tests262. r=anba
This commit is contained in:
Родитель
f57e976987
Коммит
14f9c628c9
|
@ -31,6 +31,7 @@ SymbolObject::create(JSContext* cx, JS::HandleSymbol symbol)
|
|||
}
|
||||
|
||||
const JSPropertySpec SymbolObject::properties[] = {
|
||||
JS_PSG("description", descriptionGetter, 0),
|
||||
JS_PS_END
|
||||
};
|
||||
|
||||
|
@ -231,6 +232,31 @@ SymbolObject::toPrimitive(JSContext* cx, unsigned argc, Value* vp)
|
|||
return CallNonGenericMethod<IsSymbol, valueOf_impl>(cx, args);
|
||||
}
|
||||
|
||||
bool
|
||||
SymbolObject::descriptionGetter_impl(JSContext* cx, const CallArgs& args)
|
||||
{
|
||||
// Get symbol object pointer.
|
||||
HandleValue thisv = args.thisv();
|
||||
MOZ_ASSERT(IsSymbol(thisv));
|
||||
Rooted<Symbol*> sym(cx, thisv.isSymbol()
|
||||
? thisv.toSymbol()
|
||||
: thisv.toObject().as<SymbolObject>().unbox());
|
||||
|
||||
// Return the symbol's description if present, otherwise return undefined.
|
||||
if (JSString* str = sym->description())
|
||||
args.rval().setString(str);
|
||||
else
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SymbolObject::descriptionGetter(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return CallNonGenericMethod<IsSymbol, descriptionGetter_impl>(cx, args);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
js::InitSymbolClass(JSContext* cx, Handle<GlobalObject*> global)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,10 @@ class SymbolObject : public NativeObject
|
|||
static MOZ_MUST_USE bool valueOf(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool toPrimitive(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// Properties defined on Symbol.prototype.
|
||||
static MOZ_MUST_USE bool descriptionGetter_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool descriptionGetter(JSContext* cx, unsigned argc, Value *vp);
|
||||
|
||||
static const JSPropertySpec properties[];
|
||||
static const JSFunctionSpec methods[];
|
||||
static const JSFunctionSpec staticMethods[];
|
||||
|
|
|
@ -30,7 +30,6 @@ UNSUPPORTED_FEATURES = set([
|
|||
"Intl.Locale",
|
||||
"String.prototype.matchAll",
|
||||
"Symbol.matchAll",
|
||||
"Symbol.prototype.description",
|
||||
"global",
|
||||
"export-star-as-namespace-from-module",
|
||||
])
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// Copyright (C) 2018 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// |reftest| skip -- Symbol.prototype.description is not supported
|
||||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче