actionview 6.0.0.beta2 → 6.0.2.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -3
  3. data/README.rdoc +3 -1
  4. data/lib/action_view.rb +2 -1
  5. data/lib/action_view/base.rb +5 -5
  6. data/lib/action_view/cache_expiry.rb +54 -0
  7. data/lib/action_view/digestor.rb +5 -10
  8. data/lib/action_view/gem_version.rb +2 -2
  9. data/lib/action_view/helpers/form_helper.rb +2 -2
  10. data/lib/action_view/helpers/form_options_helper.rb +4 -3
  11. data/lib/action_view/helpers/form_tag_helper.rb +5 -2
  12. data/lib/action_view/helpers/output_safety_helper.rb +1 -1
  13. data/lib/action_view/helpers/sanitize_helper.rb +10 -16
  14. data/lib/action_view/helpers/tag_helper.rb +1 -1
  15. data/lib/action_view/helpers/tags/base.rb +1 -1
  16. data/lib/action_view/helpers/translation_helper.rb +3 -3
  17. data/lib/action_view/helpers/url_helper.rb +2 -2
  18. data/lib/action_view/layouts.rb +5 -1
  19. data/lib/action_view/lookup_context.rb +11 -4
  20. data/lib/action_view/path_set.rb +5 -10
  21. data/lib/action_view/railtie.rb +1 -1
  22. data/lib/action_view/renderer/partial_renderer.rb +0 -3
  23. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +20 -13
  24. data/lib/action_view/renderer/streaming_template_renderer.rb +1 -1
  25. data/lib/action_view/renderer/template_renderer.rb +9 -3
  26. data/lib/action_view/rendering.rb +3 -2
  27. data/lib/action_view/template.rb +43 -50
  28. data/lib/action_view/template/error.rb +21 -1
  29. data/lib/action_view/template/handlers.rb +3 -3
  30. data/lib/action_view/template/handlers/erb/erubi.rb +2 -2
  31. data/lib/action_view/template/raw_file.rb +28 -0
  32. data/lib/action_view/template/resolver.rb +73 -117
  33. data/lib/action_view/template/sources.rb +13 -0
  34. data/lib/action_view/template/sources/file.rb +17 -0
  35. data/lib/action_view/testing/resolvers.rb +32 -21
  36. data/lib/action_view/unbound_template.rb +32 -0
  37. data/lib/assets/compiled/rails-ujs.js +21 -12
  38. metadata +24 -17
  39. data/lib/action_view/file_template.rb +0 -33
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "concurrent/map"
4
+
5
+ module ActionView
6
+ class UnboundTemplate
7
+ def initialize(source, identifer, handler, options)
8
+ @source = source
9
+ @identifer = identifer
10
+ @handler = handler
11
+ @options = options
12
+
13
+ @templates = Concurrent::Map.new(initial_capacity: 2)
14
+ end
15
+
16
+ def bind_locals(locals)
17
+ @templates[locals] ||= build_template(locals)
18
+ end
19
+
20
+ private
21
+
22
+ def build_template(locals)
23
+ options = @options.merge(locals: locals)
24
+ Template.new(
25
+ @source,
26
+ @identifer,
27
+ @handler,
28
+ options
29
+ )
30
+ end
31
+ end
32
+ end
@@ -2,7 +2,7 @@
2
2
  Unobtrusive JavaScript
3
3
  https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
4
4
  Released under the MIT license
5
- */
5
+ */;
6
6
 
7
7
  (function() {
8
8
  var context = this;
@@ -32,12 +32,17 @@ Released under the MIT license
32
32
 
33
33
  (function() {
34
34
  (function() {
35
- var cspNonce;
35
+ var nonce;
36
36
 
37
- cspNonce = Rails.cspNonce = function() {
38
- var meta;
39
- meta = document.querySelector('meta[name=csp-nonce]');
40
- return meta && meta.content;
37
+ nonce = null;
38
+
39
+ Rails.loadCSPNonce = function() {
40
+ var ref;
41
+ return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
42
+ };
43
+
44
+ Rails.cspNonce = function() {
45
+ return nonce != null ? nonce : Rails.loadCSPNonce();
41
46
  };
42
47
 
43
48
  }).call(this);
@@ -265,7 +270,7 @@ Released under the MIT license
265
270
  script.setAttribute('nonce', cspNonce());
266
271
  script.text = response;
267
272
  document.head.appendChild(script).parentNode.removeChild(script);
268
- } else if (type.match(/\bxml\b/)) {
273
+ } else if (type.match(/\b(xml|html|svg)\b/)) {
269
274
  parser = new DOMParser();
270
275
  type = type.replace(/;.+/, '');
271
276
  try {
@@ -315,6 +320,9 @@ Released under the MIT license
315
320
  if (!input.name || input.disabled) {
316
321
  return;
317
322
  }
323
+ if (matches(input, 'fieldset[disabled] *')) {
324
+ return;
325
+ }
318
326
  if (matches(input, 'select')) {
319
327
  return toArray(input.options).forEach(function(option) {
320
328
  if (option.selected) {
@@ -640,23 +648,23 @@ Released under the MIT license
640
648
  };
641
649
 
642
650
  Rails.preventInsignificantClick = function(e) {
643
- var data, insignificantMetaClick, link, metaClick, method, primaryMouseKey;
651
+ var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
644
652
  link = this;
645
653
  method = (link.getAttribute('data-method') || 'GET').toUpperCase();
646
654
  data = link.getAttribute('data-params');
647
655
  metaClick = e.metaKey || e.ctrlKey;
648
656
  insignificantMetaClick = metaClick && method === 'GET' && !data;
649
- primaryMouseKey = e.button === 0;
650
- if (!primaryMouseKey || insignificantMetaClick) {
657
+ nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
658
+ if (nonPrimaryMouseClick || insignificantMetaClick) {
651
659
  return e.stopImmediatePropagation();
652
660
  }
653
661
  };
654
662
 
655
663
  }).call(this);
656
664
  (function() {
657
- var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, preventInsignificantClick, refreshCSRFTokens;
665
+ var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
658
666
 
659
- fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
667
+ fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
660
668
 
661
669
  if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
662
670
  if (jQuery.rails) {
@@ -719,6 +727,7 @@ Released under the MIT license
719
727
  delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
720
728
  delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
721
729
  document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
730
+ document.addEventListener('DOMContentLoaded', loadCSPNonce);
722
731
  return window._rails_loaded = true;
723
732
  };
724
733
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.beta2
4
+ version: 6.0.2.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.0.beta2
19
+ version: 6.0.2.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.0.beta2
26
+ version: 6.0.2.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +58,20 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '1.1'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 1.0.3
64
+ version: 1.2.0
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: '1.0'
71
+ version: '1.1'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.0.3
74
+ version: 1.2.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rails-dom-testing
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 6.0.0.beta2
95
+ version: 6.0.2.rc1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 6.0.0.beta2
102
+ version: 6.0.2.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 6.0.0.beta2
109
+ version: 6.0.2.rc1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 6.0.0.beta2
116
+ version: 6.0.2.rc1
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -126,10 +126,10 @@ files:
126
126
  - lib/action_view.rb
127
127
  - lib/action_view/base.rb
128
128
  - lib/action_view/buffers.rb
129
+ - lib/action_view/cache_expiry.rb
129
130
  - lib/action_view/context.rb
130
131
  - lib/action_view/dependency_tracker.rb
131
132
  - lib/action_view/digestor.rb
132
- - lib/action_view/file_template.rb
133
133
  - lib/action_view/flows.rb
134
134
  - lib/action_view/gem_version.rb
135
135
  - lib/action_view/helpers.rb
@@ -219,20 +219,27 @@ files:
219
219
  - lib/action_view/template/handlers/raw.rb
220
220
  - lib/action_view/template/html.rb
221
221
  - lib/action_view/template/inline.rb
222
+ - lib/action_view/template/raw_file.rb
222
223
  - lib/action_view/template/resolver.rb
224
+ - lib/action_view/template/sources.rb
225
+ - lib/action_view/template/sources/file.rb
223
226
  - lib/action_view/template/text.rb
224
227
  - lib/action_view/template/types.rb
225
228
  - lib/action_view/test_case.rb
226
229
  - lib/action_view/testing/resolvers.rb
230
+ - lib/action_view/unbound_template.rb
227
231
  - lib/action_view/version.rb
228
232
  - lib/action_view/view_paths.rb
229
233
  - lib/assets/compiled/rails-ujs.js
230
- homepage: http://rubyonrails.org
234
+ homepage: https://rubyonrails.org
231
235
  licenses:
232
236
  - MIT
233
237
  metadata:
234
- source_code_uri: https://github.com/rails/rails/tree/v6.0.0.beta2/actionview
235
- changelog_uri: https://github.com/rails/rails/blob/v6.0.0.beta2/actionview/CHANGELOG.md
238
+ bug_tracker_uri: https://github.com/rails/rails/issues
239
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.2.rc1/actionview/CHANGELOG.md
240
+ documentation_uri: https://api.rubyonrails.org/v6.0.2.rc1/
241
+ mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
242
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.2.rc1/actionview
236
243
  post_install_message:
237
244
  rdoc_options: []
238
245
  require_paths:
@@ -249,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
256
  version: 1.3.1
250
257
  requirements:
251
258
  - none
252
- rubygems_version: 3.0.1
259
+ rubygems_version: 3.0.3
253
260
  signing_key:
254
261
  specification_version: 4
255
262
  summary: Rendering framework putting the V in MVC (part of Rails).
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "action_view/template"
4
-
5
- module ActionView
6
- class FileTemplate < Template
7
- def initialize(filename, handler, details)
8
- @filename = filename
9
-
10
- super(nil, filename, handler, details)
11
- end
12
-
13
- def source
14
- File.binread @filename
15
- end
16
-
17
- def refresh(_)
18
- self
19
- end
20
-
21
- # Exceptions are marshalled when using the parallel test runner with DRb, so we need
22
- # to ensure that references to the template object can be marshalled as well. This means forgoing
23
- # the marshalling of the compiler mutex and instantiating that again on unmarshalling.
24
- def marshal_dump # :nodoc:
25
- [ @identifier, @handler, @compiled, @original_encoding, @locals, @virtual_path, @updated_at, @format, @variants ]
26
- end
27
-
28
- def marshal_load(array) # :nodoc:
29
- @identifier, @handler, @compiled, @original_encoding, @locals, @virtual_path, @updated_at, @format, @variants = *array
30
- @compile_mutex = Mutex.new
31
- end
32
- end
33
- end