зеркало из https://github.com/mozilla/gecko-dev.git
Bug 688691. Warn when LenientThis actually causes us to not throw. r=ms2ger
This commit is contained in:
Родитель
e5eec0dbd7
Коммит
0fb62d62f7
|
@ -29,3 +29,4 @@ DEPRECATED_OPERATION(Components)
|
|||
DEPRECATED_OPERATION(PrefixedVisibilityAPI)
|
||||
DEPRECATED_OPERATION(NodeIteratorDetach)
|
||||
DEPRECATED_OPERATION(MozAudioData)
|
||||
DEPRECATED_OPERATION(LenientThis)
|
||||
|
|
|
@ -1688,5 +1688,15 @@ InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
|||
return InterfaceHasInstance(cx, obj, &vp.toObject(), bp);
|
||||
}
|
||||
|
||||
void
|
||||
ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
GlobalObject global(cx, obj);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(global.Get());
|
||||
if (window && window->GetDoc()) {
|
||||
window->GetDoc()->WarnOnceAbout(nsIDocument::eLenientThis);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -1695,6 +1695,10 @@ JSBool
|
|||
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
||||
JSBool* bp);
|
||||
|
||||
// Helper for lenient getters/setters to report to console
|
||||
void
|
||||
ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -4586,6 +4586,7 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
|||
name = "genericLenientGetter"
|
||||
unwrapFailureCode = (
|
||||
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
||||
"ReportLenientThisUnwrappingFailure(cx, obj);\n"
|
||||
"JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n"
|
||||
"return true;")
|
||||
else:
|
||||
|
@ -4662,6 +4663,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||
name = "genericLenientSetter"
|
||||
unwrapFailureCode = (
|
||||
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
||||
"ReportLenientThisUnwrappingFailure(cx, obj);\n"
|
||||
"return true;")
|
||||
else:
|
||||
name = "genericSetter"
|
||||
|
|
|
@ -136,3 +136,5 @@ BothCSPHeadersPresent=This site specified both an X-Content-Security-Policy/Repo
|
|||
NodeIteratorDetachWarning=Calling detach() on a NodeIterator no longer has an effect.
|
||||
# LOCALIZATION NOTE: Do not translate "Mozilla Audio Data API" and "Web Audio API".
|
||||
MozAudioDataWarning=The Mozilla Audio Data API is deprecated. Please use the Web Audio API instead.
|
||||
# LOCALIZATION NOTE: Do not translate "LenientThis" and "this"
|
||||
LenientThisWarning=Ignoring get or set of property that has [LenientThis] because the "this" object is incorrect.
|
||||
|
|
Загрузка…
Ссылка в новой задаче