public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fix remote_function to escape apostrophes inside the remote url passed to 
Ajax.Update. [#180 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
indirect (author)
Mon May 12 23:54:21 -0700 2008
lifo (committer)
Tue May 13 10:33:33 -0700 2008
commit  d16fbe53b202d52b5ef12526941ed50da2daf38f
tree    ff6233fa6cdef47d53d6b2cb6a4c4addf6c4e8ad
parent  3fee2378edd45188e41a7d14d4ca0a88280b541e
...
458
459
460
461
 
462
463
464
...
458
459
460
 
461
462
463
464
0
@@ -458,7 +458,7 @@
0
 
0
         url_options = options[:url]
0
         url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash)
0
- function << "'#{url_for(url_options)}'"
0
+ function << "'#{escape_javascript(url_for(url_options))}'"
0
         function << ", #{javascript_options})"
0
 
0
         function = "#{options[:before]}; #{function}" if options[:before]
...
86
87
88
 
 
 
 
 
89
90
91
...
86
87
88
89
90
91
92
93
94
95
96
0
@@ -86,6 +86,11 @@
0
       link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }, :html => { :class => "fine" } })
0
   end
0
   
0
+ def test_link_to_remote_url_quote_escaping
0
+ assert_dom_equal %(<a href="#" onclick="new Ajax.Request('http://www.example.com/whatnot\\\'s', {asynchronous:true, evalScripts:true}); return false;">Remote</a>),
0
+ link_to_remote("Remote", { :url => { :action => "whatnot's" } })
0
+ end
0
+
0
   def test_periodically_call_remote
0
     assert_dom_equal %(<script type="text/javascript">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)\n//]]>\n</script>),
0
       periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })

Comments

  • technomancy Tue May 13 11:12:46 -0700 2008

    Yay, now you can come to CabooseConf. =)