Skip to content

Commit b1c8d0b

Browse files
authored
feat: remove headless new (#518)
1 parent 21b8a26 commit b1c8d0b

File tree

9 files changed

+6
-21
lines changed

9 files changed

+6
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
- `Ferrum::Network::Exchange#finished?` takes into account that exchange might be in an unknown state after loader changed(next `go_to` call) and considers
1515
such as finished [#426]
16+
- `headless: "new"` mode is removed as it's now default in modern Chrome, just use `headless: true` instead [#518]
1617

1718
### Fixed
1819

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ Ferrum::Browser.new(options)
150150
```
151151

152152
* options `Hash`
153-
* `:headless` (String | Boolean) - Set browser as headless or not, `true` by default. You can set `"new"` to support
154-
[new headless mode](https://developer.chrome.com/articles/new-headless/).
153+
* `:headless` (String | Boolean) - Set browser as headless or not, `true` by default.
155154
* `:xvfb` (Boolean) - Run browser in a virtual framebuffer, `false` by default.
156155
* `:flatten` (Boolean) - Use one websocket connection to the browser and all the pages in flatten mode.
157156
* `:window_size` (Array) - The dimensions of the browser window in which to

lib/ferrum/browser.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ def version
245245
VersionInfo.new(command("Browser.getVersion"))
246246
end
247247

248-
def headless_new?
249-
process&.command&.headless_new?
250-
end
251-
252248
private
253249

254250
def start

lib/ferrum/browser/command.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ def xvfb?
3939
!!options.xvfb
4040
end
4141

42-
def headless_new?
43-
@flags["headless"] == "new"
44-
end
45-
4642
def to_a
4743
[path] + @flags.map { |k, v| v.nil? ? "--#{k}" : "--#{k}=#{v}" }
4844
end

lib/ferrum/browser/options/chrome.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,7 @@ def merge_required(flags, options, user_data_dir)
7676
end
7777

7878
def merge_default(flags, options)
79-
defaults = case options.headless
80-
when false
81-
except("headless", "disable-gpu")
82-
when "new"
83-
except("headless").merge("headless" => "new")
84-
end
85-
79+
defaults = except("headless", "disable-gpu") if options.headless == false
8680
defaults ||= DEFAULT_OPTIONS
8781
# On Windows, the --disable-gpu flag is a temporary work around for a few bugs.
8882
# See https://bugs.chromium.org/p/chromium/issues/detail?id=737678 for more information.

spec/network_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,6 @@
517517
%r{Request to http://.*/with_js failed \(net::ERR_INTERNET_DISCONNECTED\)}
518518
)
519519

520-
expect(page.at_css("body").text).to match("No internet") if browser.headless_new?
520+
expect(page.at_css("body").text).to match("No internet")
521521
end
522522
end

spec/page_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
describe "#position=" do
5757
it "allows the window to be positioned" do
58-
skip if Ferrum::Utils::Platform.mac? && !browser.headless_new?
58+
skip if Ferrum::Utils::Platform.mac?
5959

6060
expect do
6161
page.position = { left: 10, top: 20 }

spec/spec_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
config.before(:all) do
3434
base_url = Ferrum::Server.server.base_url
3535
options = { base_url: base_url }
36-
options.merge!(headless: "new") if ENV["HEADLESS"] == "new"
3736
options.merge!(headless: false) if ENV["HEADLESS"] == "false"
3837
options.merge!(slowmo: ENV["SLOWMO"].to_f) if ENV["SLOWMO"].to_f > 0
3938

spec/support/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def authorized?(login, password)
4949

5050
get "/" do
5151
response.set_cookie("cookie", value: "root cookie", domain: request.host, path: request.path)
52-
%(Hello world! <a href="with_html">Relative</a>)
52+
%(<link rel="icon" href="data:,">Hello world! <a href="with_html">Relative</a>)
5353
end
5454

5555
get "/set_cookie" do

0 commit comments

Comments
 (0)