actionview 7.1.5.1 → 7.2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ module ActionView
9
9
  extend ActiveSupport::Autoload
10
10
 
11
11
  autoload :ERBTracker
12
- autoload :RipperTracker
12
+ autoload :RubyTracker
13
13
 
14
14
  @trackers = Concurrent::Map.new
15
15
 
@@ -8,8 +8,8 @@ module ActionView
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 7
11
- MINOR = 1
12
- TINY = 5
11
+ MINOR = 2
12
+ TINY = 2
13
13
  PRE = "1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -68,6 +68,8 @@ module ActionView
68
68
  # attribute, which indicates to the browser that the script is meant to
69
69
  # be executed after the document has been parsed. Additionally, prevents
70
70
  # sending the Preload Links header.
71
+ # * <tt>:nopush</tt> - Specify if the use of server push is not desired
72
+ # for the script. Defaults to +true+.
71
73
  #
72
74
  # Any other specified options will be treated as HTML attributes for the
73
75
  # +script+ tag.
@@ -166,6 +168,10 @@ module ActionView
166
168
  # that path.
167
169
  # * <tt>:skip_pipeline</tt> - This option is used to bypass the asset pipeline
168
170
  # when it is set to true.
171
+ # * <tt>:nonce</tt> - When set to true, adds an automatic nonce value if
172
+ # you have Content Security Policy enabled.
173
+ # * <tt>:nopush</tt> - Specify if the use of server push is not desired
174
+ # for the stylesheet. Defaults to +true+.
169
175
  #
170
176
  # ==== Examples
171
177
  #
@@ -190,6 +196,9 @@ module ActionView
190
196
  # stylesheet_link_tag "random.styles", "/css/stylish"
191
197
  # # => <link href="/assets/random.styles" rel="stylesheet" />
192
198
  # # <link href="/css/stylish.css" rel="stylesheet" />
199
+ #
200
+ # stylesheet_link_tag "style", nonce: true
201
+ # # => <link href="/assets/style.css" rel="stylesheet" nonce="..." />
193
202
  def stylesheet_link_tag(*sources)
194
203
  options = sources.extract_options!.stringify_keys
195
204
  path_options = options.extract!("protocol", "extname", "host", "skip_pipeline").symbolize_keys
@@ -214,6 +223,9 @@ module ActionView
214
223
  "crossorigin" => crossorigin,
215
224
  "href" => href
216
225
  }.merge!(options)
226
+ if tag_options["nonce"] == true
227
+ tag_options["nonce"] = content_security_policy_nonce
228
+ end
217
229
 
218
230
  if apply_stylesheet_media_default && tag_options["media"].blank?
219
231
  tag_options["media"] = "screen"
@@ -351,13 +363,13 @@ module ActionView
351
363
  nopush = options.delete(:nopush) || false
352
364
  rel = mime_type == "module" ? "modulepreload" : "preload"
353
365
 
354
- link_tag = tag.link(**{
366
+ link_tag = tag.link(
355
367
  rel: rel,
356
368
  href: href,
357
369
  as: as_type,
358
370
  type: mime_type,
359
- crossorigin: crossorigin
360
- }.merge!(options.symbolize_keys))
371
+ crossorigin: crossorigin,
372
+ **options.symbolize_keys)
361
373
 
362
374
  preload_link = "<#{href}>; rel=#{rel}; as=#{as_type}"
363
375
  preload_link += "; type=#{mime_type}" if mime_type
@@ -17,7 +17,7 @@ module ActionView
17
17
  # You don't need to use these tags for regular forms as they generate their own hidden fields.
18
18
  #
19
19
  # For Ajax requests other than GETs, extract the "csrf-token" from the meta-tag and send as the
20
- # +X-CSRF-Token+ HTTP header. If you are using rails-ujs, this happens automatically.
20
+ # +X-CSRF-Token+ HTTP header.
21
21
  #
22
22
  def csrf_meta_tags
23
23
  if defined?(protect_against_forgery?) && protect_against_forgery?