Bug 1899140 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

This happens most likely because of the test [`AriaQueryHandler queryAllArray $$eval should handle many elements (ariaqueryhandler.spec.js)`](https://searchfox.org/mozilla-central/source/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts#199-221). 

Here 10.000 elements of type `button` are getting created within a single evaluate call, then retrieved via `browsingContext.locateNodes` as `sharedId`, evaluated individually to get a handle,  evaluated once to call `reduce`, and finally the handles are disowned individually.

```
 0:05.23 pid:22179 1716817055602	RemoteAgent	DEBUG	WebDriverBiDiConnection 7afd76bf-0fcd-4335-a43e-55b729ebe1de -> {"id":156,"method":"script.callFunction","params":{"functionDeclaration":"node => {\n            return node;\n        }\n//# sourceURL=pptr:internal\n","awaitPromise":true,"target":{"context":"0a3ff222-04e6-43df-aec1-8476cd80f724"},"arguments":[{"type":"node","sharedId":"ea2b5108-5e80-4095-a950-bdf65e7def14","value":{"nodeType":1,"localName":"button","namespaceURI":"http://www.w3.org/1999/xhtml","childNodeCount":1,"attributes":{},"shadowRoot":null}}],"resultOwnership":"root","userActivation":true,"serializationOptions":{"maxObjectDepth":0,"maxDomDepth":0}}}
 0:06.41 pid:22179 1716817056164	RemoteAgent	DEBUG	WebDriverBiDiConnection 7afd76bf-0fcd-4335-a43e-55b729ebe1de <- {"type":"success","id":156,"result":{"realm":"c1657cae-c1a6-4ad8-a140-bb45bace99c3","type":"success","result":{"type":"node","handle":"ced784db-2d5f-429c-a087-7e048ce332f5","sharedId":"ea2b5108-5e80-4095-a950-bdf65e7def14","value":{"nodeType":1,"localName":"button","namespaceURI":"http://www.w3.org/1999/xhtml","childNodeCount":1,"attributes":{},"shadowRoot":null}}}}
[..]
 0:06.79 pid:22179 1716817056972	RemoteAgent	DEBUG	WebDriverBiDiConnection 7afd76bf-0fcd-4335-a43e-55b729ebe1de -> {"id":10158,"method":"script.disown","params":{"target":{"context":"0a3ff222-04e6-43df-aec1-8476cd80f724"},"handles":["ced784db-2d5f-429c-a087-7e048ce332f5"]}}```

Given that we have trace logs enabled this is causing quite a lot of output. So I've two questions:

1. Are that many elements really needed?
2. Evaluating nodes in Puppeteer always requires a handle?
3. Why cannot all buttons dismissed at once by calling `script.disown` a single time?

If we cannot reduce the output we will have to most likely reduce the log output from `trace` to `debug` or even `info`, or starting to chunk the tests.

Alex, mind to give some feedback? Thanks.
This happens most likely because of the test [`AriaQueryHandler queryAllArray $$eval should handle many elements (ariaqueryhandler.spec.js)`](https://searchfox.org/mozilla-central/source/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts#199-221). 

Here 10.000 elements of type `button` are getting created within a single evaluate call, then retrieved via `browsingContext.locateNodes` as `sharedId`, evaluated individually to get a handle,  evaluated once to call `reduce`, and finally the handles are disowned individually.

```
 0:05.23 pid:22179 1716817055602	RemoteAgent	DEBUG	WebDriverBiDiConnection 7afd76bf-0fcd-4335-a43e-55b729ebe1de -> {"id":156,"method":"script.callFunction","params":{"functionDeclaration":"node => {\n            return node;\n        }\n//# sourceURL=pptr:internal\n","awaitPromise":true,"target":{"context":"0a3ff222-04e6-43df-aec1-8476cd80f724"},"arguments":[{"type":"node","sharedId":"ea2b5108-5e80-4095-a950-bdf65e7def14","value":{"nodeType":1,"localName":"button","namespaceURI":"http://www.w3.org/1999/xhtml","childNodeCount":1,"attributes":{},"shadowRoot":null}}],"resultOwnership":"root","userActivation":true,"serializationOptions":{"maxObjectDepth":0,"maxDomDepth":0}}}
 0:06.41 pid:22179 1716817056164	RemoteAgent	DEBUG	WebDriverBiDiConnection 7afd76bf-0fcd-4335-a43e-55b729ebe1de <- {"type":"success","id":156,"result":{"realm":"c1657cae-c1a6-4ad8-a140-bb45bace99c3","type":"success","result":{"type":"node","handle":"ced784db-2d5f-429c-a087-7e048ce332f5","sharedId":"ea2b5108-5e80-4095-a950-bdf65e7def14","value":{"nodeType":1,"localName":"button","namespaceURI":"http://www.w3.org/1999/xhtml","childNodeCount":1,"attributes":{},"shadowRoot":null}}}}
[..]
 0:06.79 pid:22179 1716817056972	RemoteAgent	DEBUG	WebDriverBiDiConnection 7afd76bf-0fcd-4335-a43e-55b729ebe1de -> {"id":10158,"method":"script.disown","params":{"target":{"context":"0a3ff222-04e6-43df-aec1-8476cd80f724"},"handles":["ced784db-2d5f-429c-a087-7e048ce332f5"]}}
```

Given that we have trace logs enabled this is causing quite a lot of output. So I've two questions:

1. Are that many elements really needed?
2. Evaluating nodes in Puppeteer always requires a handle?
3. Why cannot all buttons dismissed at once by calling `script.disown` a single time?

If we cannot reduce the output we will have to most likely reduce the log output from `trace` to `debug` or even `info`, or starting to chunk the tests.

Alex, mind to give some feedback? Thanks.

Back to Bug 1899140 Comment 3