[dartdevc] Warning and shorting when trying to improperly modify JS Object's prototype chain.

See bugs:
* https://github.com/dart-lang/webdev/issues/1133
* https://github.com/dart-lang/sdk/issues/43750

Change-Id: I0daa13ab56be5a2967241a5fcea63a32c0a5cde4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This commit is contained in:
Mark Zhou 2020-10-13 01:23:53 +00:00 committed by commit-bot@chromium.org
parent 626c865a3e
commit 34b485c0c4

View file

@ -435,6 +435,13 @@ void _applyExtension(jsType, dartExtType) {
return;
}
if (JS('!', '# === #.Object', jsType, global_)) {
var extName = JS<String>('!', '#.name', dartExtType);
_warn(
"Attempting to install properties from non-Object type '$extName' onto the native JS Object.");
return;
}
_installProperties(
jsProto, dartExtType, JS('', '#[#]', jsProto, _extensionType));