small js fixes
closes #3106 - hardening url handling, fixes #2725 - backport from upstream
This commit is contained in:
parent
3621576717
commit
4385027443
2 changed files with 6 additions and 2 deletions
|
|
@ -29,6 +29,8 @@
|
||||||
text = text.replace(linkRegex, function() {
|
text = text.replace(linkRegex, function() {
|
||||||
var unicodeUrl = arguments[3];
|
var unicodeUrl = arguments[3];
|
||||||
var addr = parse_url(unicodeUrl);
|
var addr = parse_url(unicodeUrl);
|
||||||
|
if( !addr.host ) addr.host = ""; // must not be 'undefined'
|
||||||
|
|
||||||
var asciiUrl = // rebuild the url
|
var asciiUrl = // rebuild the url
|
||||||
(!addr.scheme ? '' : addr.scheme +
|
(!addr.scheme ? '' : addr.scheme +
|
||||||
( (addr.scheme.toLowerCase()=="mailto") ? ':' : '://')) +
|
( (addr.scheme.toLowerCase()=="mailto") ? ':' : '://')) +
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInputBoxKeyPress(e) {
|
function onInputBoxKeyPress(e) {
|
||||||
var typedValue = String.fromCharCode(e.which || e.keyCode);
|
if(e.keyCode != KEY.BACKSPACE) {
|
||||||
inputBuffer.push(typedValue);
|
var typedValue = String.fromCharCode(e.which || e.keyCode);
|
||||||
|
inputBuffer.push(typedValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInputBoxKeyDown(e) {
|
function onInputBoxKeyDown(e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue