mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1140428 - Warn when __noSuchMethod__ is used. r=jorendorff
This commit is contained in:
parent
a36bc65522
commit
90e561ba19
@ -45,6 +45,7 @@ JSCompartment::JSCompartment(Zone *zone, const JS::CompartmentOptions &options =
|
||||
isSystem(false),
|
||||
isSelfHosting(false),
|
||||
marked(true),
|
||||
warnedAboutNoSuchMethod(false),
|
||||
addonId(options.addonIdOrNull()),
|
||||
#ifdef DEBUG
|
||||
firedOnNewGlobalObject(false),
|
||||
|
@ -149,6 +149,7 @@ struct JSCompartment
|
||||
bool isSystem;
|
||||
bool isSelfHosting;
|
||||
bool marked;
|
||||
bool warnedAboutNoSuchMethod;
|
||||
|
||||
// A null add-on ID means that the compartment is not associated with an
|
||||
// add-on.
|
||||
|
@ -180,6 +180,17 @@ js::OnUnknownMethod(JSContext *cx, HandleObject obj, Value idval_, MutableHandle
|
||||
static bool
|
||||
NoSuchMethod(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
if (JSScript *script = cx->currentScript()) {
|
||||
const char *filename = script->filename();
|
||||
cx->compartment()->addTelemetry(filename, JSCompartment::DeprecatedNoSuchMethod);
|
||||
}
|
||||
|
||||
if (!cx->compartment()->warnedAboutNoSuchMethod) {
|
||||
if (!JS_ReportWarning(cx, "__noSuchMethod__ is deprecated"))
|
||||
return false;
|
||||
cx->compartment()->warnedAboutNoSuchMethod = true;
|
||||
}
|
||||
|
||||
InvokeArgs args(cx);
|
||||
if (!args.init(2))
|
||||
return false;
|
||||
@ -198,12 +209,6 @@ NoSuchMethod(JSContext *cx, unsigned argc, Value *vp)
|
||||
args[1].setObject(*argsobj);
|
||||
bool ok = Invoke(cx, args);
|
||||
vp[0] = args.rval();
|
||||
|
||||
if (JSScript *script = cx->currentScript()) {
|
||||
const char *filename = script->filename();
|
||||
cx->compartment()->addTelemetry(filename, JSCompartment::DeprecatedNoSuchMethod);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user