Skip to content

Commit f19cd75

Browse files
Markzipanathomas
authored andcommitted
[dartdevc] Warning and shorting when trying to improperly modify JS Object's prototype chain.
See bugs: * dart-lang/webdev#1133 * #43750 Change-Id: I0daa13ab56be5a2967241a5fcea63a32c0a5cde4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167220 Reviewed-by: Sigmund Cherem <[email protected]> Reviewed-by: Nicholas Shahan <[email protected]> Reviewed-by: Mark Zhou <[email protected]> Commit-Queue: Mark Zhou <[email protected]>
1 parent 1d923a3 commit f19cd75

File tree

1 file changed

+7
-0
lines changed
  • sdk/lib/_internal/js_dev_runtime/private/ddc_runtime

1 file changed

+7
-0
lines changed

sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart

+7
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,13 @@ void _applyExtension(jsType, dartExtType) {
435435
return;
436436
}
437437

438+
if (JS('!', '# === #.Object', jsType, global_)) {
439+
var extName = JS<String>('!', '#.name', dartExtType);
440+
_warn(
441+
"Attempting to install properties from non-Object type '$extName' onto the native JS Object.");
442+
return;
443+
}
444+
438445
_installProperties(
439446
jsProto, dartExtType, JS('', '#[#]', jsProto, _extensionType));
440447

0 commit comments

Comments
 (0)