mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 06:55:03 -05:00
DEV: Use performance timings to as a baseline for the splash take 2 (#17284)
We previously relied on CSS animation-delay for the splash. This means that we can get inconsistent results based on device/network conditions.
This PR moves us to a more consistent timing based on {request time + 2 seconds}
Internal topic: /t/65378/65
This commit is contained in:
@@ -665,6 +665,19 @@ RSpec.describe ApplicationController do
|
||||
expect(response.body).to include(nonce)
|
||||
end
|
||||
|
||||
it 'when splash screen is enabled it adds the same nonce to the policy and the inline splash script' do
|
||||
SiteSetting.content_security_policy = true
|
||||
SiteSetting.splash_screen = true
|
||||
|
||||
get '/latest'
|
||||
nonce = ApplicationHelper.splash_screen_nonce
|
||||
expect(response.headers).to include('Content-Security-Policy')
|
||||
|
||||
script_src = parse(response.headers['Content-Security-Policy'])['script-src']
|
||||
expect(script_src.to_s).to include(nonce)
|
||||
expect(response.body).to include(nonce)
|
||||
end
|
||||
|
||||
def parse(csp_string)
|
||||
csp_string.split(';').map do |policy|
|
||||
directive, *sources = policy.split
|
||||
|
||||
Reference in New Issue
Block a user