mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Fix JS exception when malformed URL is passed to isSameOrigin()
This commit is contained in:
parent
8644227a03
commit
dacddd5d44
1 changed files with 8 additions and 4 deletions
|
|
@ -42,10 +42,14 @@
|
|||
if (url1.match(/^(https?:)?\/\/[^\/]*[^a-z0-9\/.:_-]/i) || url2.match(/^(https?:)?\/\/[^\/]*[^a-z0-9\/.:_-]/i)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
url1 = window.XE.URI(url1).normalizePort().normalizeHostname().normalizePathname().origin();
|
||||
url2 = window.XE.URI(url2).normalizePort().normalizeHostname().normalizePathname().origin();
|
||||
return (url1 === url2) ? true : false;
|
||||
|
||||
try {
|
||||
url1 = window.XE.URI(url1).normalizePort().normalizeHostname().normalizePathname().origin();
|
||||
url2 = window.XE.URI(url2).normalizePort().normalizeHostname().normalizePathname().origin();
|
||||
return (url1 === url2) ? true : false;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue