diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-03-08 04:17:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 04:17:49 +0100 |
commit | edf9851a7ddcab83c6dd54f2294041613ace24f7 (patch) | |
tree | b556cd553a43ebf25548a3199ed1afd9c062693d /Bugzilla | |
parent | 75d3e3657ab6d4ec915cc8f8e6658ac1df0de06c (diff) | |
download | bugzilla-edf9851a7ddcab83c6dd54f2294041613ace24f7.tar.gz bugzilla-edf9851a7ddcab83c6dd54f2294041613ace24f7.tar.xz |
Bug 1441903 - Cleanup Makefile.PL
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/CGI.pm | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 3906156c4..3737b97e2 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -14,6 +14,7 @@ use warnings; use CGI; use base qw(CGI); +use Bugzilla::CGI::ContentSecurityPolicy; use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Util; @@ -188,36 +189,28 @@ sub target_uri { sub content_security_policy { my ($self, %add_params) = @_; - if (Bugzilla->has_feature('csp')) { - require Bugzilla::CGI::ContentSecurityPolicy; - if (%add_params || !$self->{Bugzilla_csp}) { - my %params = DEFAULT_CSP; - delete $params{report_only} if %add_params && !$add_params{report_only}; - foreach my $key (keys %add_params) { - if (defined $add_params{$key}) { - $params{$key} = $add_params{$key}; - } - else { - delete $params{$key}; - } + if (%add_params || !$self->{Bugzilla_csp}) { + my %params = DEFAULT_CSP; + delete $params{report_only} if %add_params && !$add_params{report_only}; + foreach my $key (keys %add_params) { + if (defined $add_params{$key}) { + $params{$key} = $add_params{$key}; + } + else { + delete $params{$key}; } - $self->{Bugzilla_csp} = Bugzilla::CGI::ContentSecurityPolicy->new(%params); } - - return $self->{Bugzilla_csp}; + $self->{Bugzilla_csp} = Bugzilla::CGI::ContentSecurityPolicy->new(%params); } - return undef; + + return $self->{Bugzilla_csp}; } sub csp_nonce { my ($self) = @_; - if (Bugzilla->has_feature('csp')) { - my $csp = $self->content_security_policy; - return $csp->nonce if $csp->has_nonce; - } - - return ''; + my $csp = $self->content_security_policy; + return $csp->has_nonce ? $csp->nonce : ''; } # We want this sorted plus the ability to exclude certain params |