mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 10:43:24 +00:00
Bug 688691. Warn when LenientThis actually causes us to not throw. r=ms2ger
This commit is contained in:
parent
e5eec0dbd7
commit
0fb62d62f7
@ -29,3 +29,4 @@ DEPRECATED_OPERATION(Components)
|
|||||||
DEPRECATED_OPERATION(PrefixedVisibilityAPI)
|
DEPRECATED_OPERATION(PrefixedVisibilityAPI)
|
||||||
DEPRECATED_OPERATION(NodeIteratorDetach)
|
DEPRECATED_OPERATION(NodeIteratorDetach)
|
||||||
DEPRECATED_OPERATION(MozAudioData)
|
DEPRECATED_OPERATION(MozAudioData)
|
||||||
|
DEPRECATED_OPERATION(LenientThis)
|
||||||
|
@ -1688,5 +1688,15 @@ InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
|||||||
return InterfaceHasInstance(cx, obj, &vp.toObject(), bp);
|
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 dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -1695,6 +1695,10 @@ JSBool
|
|||||||
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
||||||
JSBool* bp);
|
JSBool* bp);
|
||||||
|
|
||||||
|
// Helper for lenient getters/setters to report to console
|
||||||
|
void
|
||||||
|
ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj);
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
@ -4586,6 +4586,7 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
|||||||
name = "genericLenientGetter"
|
name = "genericLenientGetter"
|
||||||
unwrapFailureCode = (
|
unwrapFailureCode = (
|
||||||
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
||||||
|
"ReportLenientThisUnwrappingFailure(cx, obj);\n"
|
||||||
"JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n"
|
"JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n"
|
||||||
"return true;")
|
"return true;")
|
||||||
else:
|
else:
|
||||||
@ -4662,6 +4663,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||||||
name = "genericLenientSetter"
|
name = "genericLenientSetter"
|
||||||
unwrapFailureCode = (
|
unwrapFailureCode = (
|
||||||
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
||||||
|
"ReportLenientThisUnwrappingFailure(cx, obj);\n"
|
||||||
"return true;")
|
"return true;")
|
||||||
else:
|
else:
|
||||||
name = "genericSetter"
|
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.
|
NodeIteratorDetachWarning=Calling detach() on a NodeIterator no longer has an effect.
|
||||||
# LOCALIZATION NOTE: Do not translate "Mozilla Audio Data API" and "Web Audio API".
|
# 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.
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user