Commit c3e69a4a authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove asset_host_prefetch feature flag

This was added almost 2 years ago and has been enabled on GitLab.com
for a while now.

Removing this saves us a feature check on every HTML page rendered.
parent 13851f12
......@@ -16,7 +16,7 @@
%head{ prefix: "og: http://ogp.me/ns#" }
%meta{ charset: "utf-8" }
- if Feature.enabled?('asset_host_prefetch') && ActionController::Base.asset_host
- if ActionController::Base.asset_host
%link{ rel: 'dns-prefetch', href: ActionController::Base.asset_host }
%link{ rel: 'preconnnect', href: ActionController::Base.asset_host, crossorigin: '' }
......
---
title: Prefetch DNS for asset host
merge_request: 26868
author:
type: performance
......@@ -34,36 +34,23 @@ describe 'layouts/_head' do
expect(rendered).to match(%{content="foo" http-equiv="refresh"})
end
context 'when an asset_host is set and feature is activated in the config it will' do
context 'when an asset_host is set' do
let(:asset_host) { 'http://assets' }
before do
stub_feature_flags(asset_host_prefetch: true)
allow(ActionController::Base).to receive(:asset_host).and_return(asset_host)
end
it 'add a link dns-prefetch tag' do
it 'adds a link dns-prefetch tag' do
render
expect(rendered).to match('<link href="http://assets" rel="dns-prefetch">')
end
it 'add a link preconnect tag' do
render
expect(rendered).to match('<link crossorigin="" href="http://assets" rel="preconnnect">')
end
end
context 'when an asset_host is set and feature is not activated in the config it will' do
let(:asset_host) { 'http://assets' }
before do
stub_feature_flags(asset_host_prefetch: false)
allow(ActionController::Base).to receive(:asset_host).and_return(asset_host)
expect(rendered).to match(%Q(<link href="#{asset_host}" rel="dns-prefetch">))
end
it 'not add a link dns-prefetch tag' do
it 'adds a link preconnect tag' do
render
expect(rendered).not_to match('<link href="http://assets" rel="dns-prefetch">')
expect(rendered).to match(%Q(<link crossorigin="" href="#{asset_host}" rel="preconnnect">))
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment