Ticket #6638: ajax-auth-6658.diff
| File ajax-auth-6658.diff, 3.4 kB (added by madrobby, 2 years ago) |
|---|
-
test/unit/ajax.html
old new 29 29 <script type="text/javascript" language="javascript" charset="utf-8"> 30 30 // <![CDATA[ 31 31 var responderCounter = 0; 32 var auth = ''; 32 33 33 34 new Test.Unit.Runner({ 34 35 35 36 setup: function(){ 37 auth = ''; 36 38 $('content').update(''); 37 39 $('content2').update(''); 38 40 }, … … 71 73 }); 72 74 }}, 73 75 76 testAuthorization: function() {with(this) { 77 new Ajax.Request("/auth", { 78 asynchronous: true, 79 requestHeaders: {'Authorization': 'Basic Zm9vOmJhcg=='}, 80 onComplete: function(response) { eval(response.responseText) } 81 }); 82 wait(1000,function(){ 83 assertEqual('Basic Zm9vOmJhcg==', auth); // foo:bar 84 }); 85 }}, 86 74 87 testUpdater: function() {with(this) { 75 88 assertEqual("", $("content").innerHTML); 76 89 -
test/lib/jstest.rb
old new 125 125 end 126 126 end 127 127 128 class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler 129 def do_GET(req, res) 130 super 131 res['etag'] = nil 132 res['last-modified'] = Time.now + 1000 133 res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0"' 134 res['Pragma'] = 'no-cache' 135 res['Expires'] = Time.now - 1000 136 end 137 end 138 128 139 class JavaScriptTestTask < ::Rake::TaskLib 129 140 130 141 def initialize(name=:test) … … 141 152 @queue.push(req.query['result']) 142 153 res.body = "OK" 143 154 end 155 156 # return for HTTP authorization test 157 @server.mount_proc("/auth") do |req, res| 158 res.body = "auth = '#{req["Authorization"]}'" 159 end 160 144 161 yield self if block_given? 145 162 define 146 163 end … … 174 191 def mount(path, dir=nil) 175 192 dir = Dir.pwd + path unless dir 176 193 177 @server.mount(path, WEBrick::HTTPServlet::FileHandler, dir) 194 # i said: don't cache 195 @server.mount(path, NonCachingFileHandler, dir) 178 196 end 179 197 180 198 # test should be specified as a url -
src/ajax.js
old new 98 98 99 99 try { 100 100 Ajax.Responders.dispatch('onCreate', this, this.transport); 101 102 this.transport.open(this.options.method.toUpperCase(), this.url, 103 this.options.asynchronous, this.options.username, 104 this.options.password); 101 102 this.transport.open(this.options.method.toUpperCase(), this.url, 103 this.options.asynchronous); 105 104 106 105 if (this.options.asynchronous) 107 106 setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); … … 117 116 /* Force Firefox to handle ready state 4 for synchronous requests */ 118 117 if (!this.options.asynchronous && this.transport.overrideMimeType) 119 118 this.onStateChange(); 120 121 119 } 122 120 catch (e) { 123 121 this.dispatchException(e); -
CHANGELOG
old new 1 *SVN* 2 1 3 * Add $w() to easily create arrays from strings like Ruby's %w, fixes #5682 [glazedginger, brendon.aaron] 2 4 3 5 * Add Element.toggleClassName() to toggle CSS classes on elements, fixes #6759 [Tobie]