Type Checking for MutationRecord gives ClassCastException in Chrome
- Dominant language
- Java
- Stars
- 170
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
The follow code gives ClassCastException in Chrome(Version 83.0.4103.61 (Official Build) (64-bit)) and new Edge(Version 83.0.478.37 (Official build) (64-bit)) but not Edge Legacy
``` Java
private void setupMutation(Node target) {
Consumer recordConsumer = mutationRecord -> DomGlobal.console.log("oldValue", mutationRecord.oldValue);
MutationObserverInit mutationObserverInit = MutationObserverInit.create();
mutationObserverInit.setAttributes(true);
mutationObserverInit.setChildList(true);
mutationObserverInit.setSubtree(true);
MutationObserver mutationObserver = new MutationObserver(new MutationObserver.MutationObserverCallbackFn() {
public Object onInvoke(JsArray recordJsArray, MutationObserver observer) {
recordJsArray.forEach((recordConsumer1, ignore, params) -> {
recordConsumer.accept(recordConsumer1);
return null;
});
return null;
}
});
mutationObserver.observe(target, mutationObserverInit);
}
```
Below is the type check that fails for MutationObserver. In the console there is a test againt $wnd and window for the mutationRecord instance

And the generated code where castToNative is used.

Contributor guide
Assessment
This issue has not been assessed yet.