Skip to content

Commit 7f8e712

Browse files
authored
fix: wait_for_idle has issue with window.URL.createObjectURL (#516)
1 parent d7e221b commit 7f8e712

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/ferrum/network/exchange.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def blocked?
8383
# @return [Boolean]
8484
#
8585
def finished?
86-
blocked? || response&.loaded? || !error.nil? || ping?
86+
blocked? || response&.loaded? || !error.nil? || ping? || !!url&.start_with?("blob:")
8787
end
8888

8989
#

spec/network/exchange_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,21 @@
136136
exchange.request = Ferrum::Network::Request.new({ "type" => "Ping" })
137137
expect(exchange.finished?).to be true
138138
end
139+
140+
it "returns true for blob requests" do
141+
exchange = Ferrum::Network::Exchange.new(page, "1")
142+
expect(exchange.finished?).to be false
143+
144+
exchange.request = Ferrum::Network::Request.new(
145+
{
146+
"type" => "Document",
147+
"request" => {
148+
"url" => "blob:null/75787aaf-a81f-4237-98d7-0d51fe6cfcba"
149+
}
150+
}
151+
)
152+
expect(exchange.finished?).to be true
153+
end
139154
end
140155

141156
describe "#redirect?" do

0 commit comments

Comments
 (0)