Browser options :pending_connection_allowlist and :pending_connection…#537
Browser options :pending_connection_allowlist and :pending_connection…#537CodeMeister wants to merge 3 commits intorubycdp:mainfrom
Conversation
…_blocklist added - Any pending URL that matches the allowlist will not raise a PendingConnectionsError. - Any pending URL that matches the blocklist will always raise a PendingConnectionsError. This takes precedence on the allowlist! - README.md updated
|
I'll fix the linting |
|
Linting fixed, but Ruby 3.2 failing on: My changes have no impact there and all tests pass in the other versions. Can you please re-run the 3.2 tests to see if it's an anomaly? Triggered tests again with an empty commit - all pass. 🥳 |
|
It should be just turned off by default for Ferrum and on for Cuprite. That was the only idea for this setting. |
UseCase
When I visit
/testit downloadsmain.jswhich is needed for the page, then pre-loadsp1.js,p2.js&p3.jsFrequently there is a
PendingConnectionsErroron one of the pre-load javascript files.This feature will allow me to say: Don't raise a
PendingConnectionsErrorfor any javascript file, exceptmain.jswhich is the important one.Changes
README.md: - browser options info updated.
lib/ferrum/browser.rb:80 - updated @option comments.
lib/ferrum/browser/options.rb:16 - added
attr_readerfor:pending_connection_allowlistand:pending_connection_blocklist.lib/ferrum/browser/options.rb:34 - set the new options from the arguments.
lib/ferrum/page.rb:118 + 539 - added method
:process_timeout_error(url)to compare the lists and raise.spec/browser_spec.rb:245 - added tests for both lists.
Cuprite
If this PR is accepted, I'll do a PR for cuprite to include this feature.
Hope you're happy with it: 🤞