Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
### Fixed
- `set_viewport` and `resize` turned touch emulation off on every desktop viewport, which reset hover and pointer and
undid `--blink-settings` overrides. `mobile:` defaults to `nil` and leaves touch as is, `false` turns it off [#664]
- A click or navigation timed out when the last loading iframe moved to another process, e.g. submitting a form that
opens an inline PDF in Chrome 145+, where the PDF viewer runs out of process [#672]

### Removed

Expand Down
1 change: 1 addition & 0 deletions lib/ferrum/page/frames.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def subscribe_frame_detached
frame.execution_id = nil
else
@frames.delete(params["frameId"])
@event.set if @main_frame.idle? && frame&.idle? == false && frames.size == 1
end
end
end
Expand Down
23 changes: 23 additions & 0 deletions spec/frame_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,29 @@
end
end

it "finishes a form submission that opens an inline PDF" do
page.go_to("/inline_pdf")
page.at_css("button").click

expect(page.current_url).to eq(base_url("/inline.pdf"))
expect(page.network.response.content_type).to eq("application/pdf")
end

it "keeps waiting for a loading frame when another one is removed" do
page.go_to("/removed_iframe")
page.at_css("button").click

expect(page.evaluate("document.querySelector('iframe').contentWindow.location.pathname"))
.to eq("/show_cookies/set_cookie_slow")
end

it "waits for a navigation a click starts after removing a loaded frame" do
page.go_to("/remove_iframe_and_navigate")
page.at_css("button").click

expect(page.evaluate("location.pathname")).to eq("/slow")
end

context "with lazy loading iframes" do
it "does not block visit on lazy iframe" do
expect { page.go_to("/lazy_iframe") }.not_to raise_error
Expand Down
6 changes: 6 additions & 0 deletions spec/support/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def authorized?(login, password)
filename: "attachment.pdf"
end

post "/inline.pdf" do
send_file File.join(FERRUM_APP, "static", "attachment.pdf"),
disposition: :inline,
filename: "inline.pdf"
end

get "/foo" do
"Another World"
end
Expand Down
8 changes: 8 additions & 0 deletions spec/support/views/inline_pdf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<form action="/inline.pdf" method="post">
<button type="submit">Open PDF</button>
</form>
</body>
</html>
14 changes: 14 additions & 0 deletions spec/support/views/remove_iframe_and_navigate.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<body>
<iframe src="/slow"></iframe>
<button>Remove iframe and navigate</button>

<script>
document.querySelector("button").addEventListener("click", function () {
document.querySelector("iframe").remove();
setTimeout(function () { location.href = "/slow"; }, 20);
});
</script>
</body>
</html>
15 changes: 15 additions & 0 deletions spec/support/views/removed_iframe.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<body>
<button onclick="addFrame('/really_slow', 300); addFrame('/show_cookies/set_cookie_slow')">Add iframes</button>

<script>
function addFrame(src, removeAfter) {
var frame = document.createElement("iframe");
frame.src = src;
document.body.appendChild(frame);
if (removeAfter) setTimeout(function () { frame.remove(); }, removeAfter);
}
</script>
</body>
</html>
Loading