Skip to content

Conversation

@ikreymer
Copy link
Member

@ikreymer ikreymer commented Feb 5, 2026

Removes our custom evaluateWithCLI() call in favor of using standard frame.evaluate().
The custom method became more tricky to use, and doesn't work for all iframes.
The main benefit of it was to inject getEventListeners(), which is now only used in Autoscroll to potentially skip scrolling, and not needed for any other behaviors.

We could potentially use this workaround: https://stackoverflow.com/questions/75517220/geteventlistener-function-support-for-latest-puppeteer-versions/75581410#75581410 to bring back getEventListeners or, adding a custom callback, like hasEventListener() would suffice for that check.

This simplifies the codebase and ensures that running behaviors is more reliable.
Also, adds a callback for new frames that may get added to page, such as during scrolling, an ensures behaviors are called on those iframes as well.

@ikreymer ikreymer requested a review from tw4l February 5, 2026 00:31
@tw4l
Copy link
Member

tw4l commented Feb 9, 2026

Tested with autoscroll and https://raw.githubusercontent.com/webrecorder/custom-behaviors/refs/heads/main/behaviors/timeline.js. I can see log messages indicating that behavior scripts are run and finished, but the actual behaviors themselves don't seem to happen - in the screencast I don't see any scrolling happening on pages where it should, and for the custom behavior I don't see the behavior running in the screenshare or any log lines from the custom behavior as expected.

custom function not always working, only needed to inject getEventListeners() which is used minimally (only in autoscroll to potentially skip scrolling)
fix logging, only log warning if interrupting top-page behavior
@ikreymer
Copy link
Member Author

Tested with autoscroll and https://raw.githubusercontent.com/webrecorder/custom-behaviors/refs/heads/main/behaviors/timeline.js. I can see log messages indicating that behavior scripts are run and finished, but the actual behaviors themselves don't seem to happen - in the screencast I don't see any scrolling happening on pages where it should, and for the custom behavior I don't see the behavior running in the screenshare or any log lines from the custom behavior as expected.

Good catch, fixed, removing unnecessary function wrapping which didn't actually await the promise..

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedbrowsertrix-behaviors@​0.9.7 ⏵ 0.9.878100100 +191 -370

View full report

Copy link
Member

@tw4l tw4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-tested and working now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants