User "Aaron Schulz" changed the status of MediaWiki.r94381.

Old Status: new
New Status: ok

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94381#c0
Commit summary:

Fix bug in jquery.byteLimit.js for Safari 4
* Browsers should ignore the maxLength when the .value is set manually through 
JavaScript, but for some reason Safari 4 (not 5 and later) is enforcing the 
limit even when the value property is set from JavaScript. Usually this bug 
doesn't become visible in this module because the byteLength can't be lower 
than the number of characters, so we'd never see the bug. However since r94066 
we're supporting callbacks, and callbacks could do anything to the calculation, 
including but not limited to making the string that is being checked shorter 
(ie. suppose maxLength/byteLimit is 8, value is 'User:Sam', and callback 
filters like "return new mw.Title(val).getName()". If we set it to 'User:Samp' 
(+p) then Safari 4 would chop the value, because the total string is longer 
than 8. Whereas all other browsers ignore maxLength (like they should) and let 
it be and would allow our callback to happen and instead give byteLimit 'Samp' 
which is length 4 and we still have 4 more characters to go until we reach 8.

The fix is easy, simply do not set the maxLength property if there's a callback.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to