mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1244442 - Warn about Proxy.create and Proxy.createFunction. r=Waldo
This commit is contained in:
parent
c6000dca8a
commit
6f7efe6bbf
@ -396,6 +396,7 @@ MSG_DEF(JSMSG_PROXY_EXTENSIBILITY, 0, JSEXN_TYPEERR, "proxy must report same
|
||||
MSG_DEF(JSMSG_PROXY_GETOWN_OBJORUNDEF, 0, JSEXN_TYPEERR, "proxy [[GetOwnProperty]] must return an object or undefined")
|
||||
MSG_DEF(JSMSG_PROXY_REVOKED, 0, JSEXN_TYPEERR, "illegal operation attempted on a revoked proxy")
|
||||
MSG_DEF(JSMSG_PROXY_ARG_REVOKED, 1, JSEXN_TYPEERR, "argument {0} cannot be a revoked proxy")
|
||||
MSG_DEF(JSMSG_DEPRECATED_PROXY_CREATE, 0, JSEXN_NONE, "Proxy.create and Proxy.createFunction are deprecated, use new Proxy instead")
|
||||
|
||||
// Structured cloning
|
||||
MSG_DEF(JSMSG_SC_BAD_CLONE_VERSION, 0, JSEXN_ERR, "unsupported structured clone version")
|
||||
|
@ -526,6 +526,11 @@ bool
|
||||
js::proxy_create(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
RootedObject create(cx, &args.callee());
|
||||
if (!GlobalObject::warnOnceAboutProxyCreate(cx, create))
|
||||
return false;
|
||||
|
||||
if (args.length() < 1) {
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
"create", "0", "s");
|
||||
@ -555,6 +560,11 @@ bool
|
||||
js::proxy_createFunction(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
RootedObject createFunction(cx, &args.callee());
|
||||
if (!GlobalObject::warnOnceAboutProxyCreate(cx, createFunction))
|
||||
return false;
|
||||
|
||||
if (args.length() < 2) {
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
"createFunction", "1", "");
|
||||
|
@ -133,9 +133,10 @@ class GlobalObject : public NativeObject
|
||||
"global object slot counts are inconsistent");
|
||||
|
||||
enum WarnOnceFlag : int32_t {
|
||||
WARN_WATCH_DEPRECATED = 0x00000001,
|
||||
WARN_PROTO_SETTING_SLOW = 0x00000002,
|
||||
WARN_STRING_CONTAINS_DEPRECATED = 0x00000004
|
||||
WARN_WATCH_DEPRECATED = 1 << 0,
|
||||
WARN_PROTO_SETTING_SLOW = 1 << 1,
|
||||
WARN_STRING_CONTAINS_DEPRECATED = 1 << 2,
|
||||
WARN_PROXY_CREATE_DEPRECATED = 1 << 3,
|
||||
};
|
||||
|
||||
// Emit the specified warning if the given slot in |obj|'s global isn't
|
||||
@ -687,11 +688,17 @@ class GlobalObject : public NativeObject
|
||||
}
|
||||
|
||||
// Warn about use of the deprecated String.prototype.contains method
|
||||
static bool warnOnceAboutStringContains(JSContext *cx, HandleObject strContains) {
|
||||
static bool warnOnceAboutStringContains(JSContext* cx, HandleObject strContains) {
|
||||
return warnOnceAbout(cx, strContains, WARN_STRING_CONTAINS_DEPRECATED,
|
||||
JSMSG_DEPRECATED_STRING_CONTAINS);
|
||||
}
|
||||
|
||||
// Warn about uses of Proxy.create and Proxy.createFunction
|
||||
static bool warnOnceAboutProxyCreate(JSContext* cx, HandleObject create) {
|
||||
return warnOnceAbout(cx, create, WARN_PROXY_CREATE_DEPRECATED,
|
||||
JSMSG_DEPRECATED_PROXY_CREATE);
|
||||
}
|
||||
|
||||
static bool getOrCreateEval(JSContext* cx, Handle<GlobalObject*> global,
|
||||
MutableHandleObject eval);
|
||||
|
||||
|
@ -29,11 +29,11 @@ namespace js {
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/Bytecode
|
||||
*/
|
||||
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 342;
|
||||
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 343;
|
||||
static const uint32_t XDR_BYTECODE_VERSION =
|
||||
uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND);
|
||||
|
||||
static_assert(JSErr_Limit == 441,
|
||||
static_assert(JSErr_Limit == 442,
|
||||
"GREETINGS, POTENTIAL SUBTRAHEND INCREMENTER! If you added or "
|
||||
"removed MSG_DEFs from js.msg, you should increment "
|
||||
"XDR_BYTECODE_VERSION_SUBTRAHEND and update this assertion's "
|
||||
|
Loading…
Reference in New Issue
Block a user