(Hidden by Administrator)
Bug 1980081 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Steps to reproduce:
If we create an object of type XMLDocument with custom property to it, then call evaluate and store its result as global variable, after some time the custom property becomes 'undefined' when accessed via ownerDocument on that global variable. The ownerDocument is accessible, but the custom property no longer exists. Most likely due to garbage collection? This issue appers in version 140+. Works fine in version 139.
Simple test code:
```html
<html>
<script>
var node;
function init() {
var xmlStr = (new window.DOMParser()).parseFromString("<foo><bar>stuff</bar></foo>", "text/xml");
xmlStr._testParam = true;
node=xmlStr.evaluate("foo/bar", xmlStr , null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function checkObj() {
alert(node.ownerDocument._testParam);
}
</script>
<body onload="init();">
<button onClick="checkObj();">Click ME!</button>
</body>
</html>
```
Actual results:
When you click on "Click ME!" button an alert appears showing "true". After some random amount of time, it displays "undefined".
Expected results:
It should always display "true".