Changeset 1108
- Timestamp:
- 2008-10-07 16:12:00 (1 month ago)
- Files:
-
- trunk/chrome/content/dta/manager/metalinker.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/chrome/content/dta/manager/metalinker.js
r1105 r1108 44 44 case 'dta': 45 45 return NS_DTA; 46 default:47 return NS_METALINKER;48 break;49 46 } 47 return NS_METALINKER; 50 48 } 51 49 }; … … 95 93 } 96 94 // check for some popular bad links :p 97 if (['http', 'https', 'ftp'].indexOf(url.scheme) != -1 &&url.host.indexOf('.') == -1) {98 throw new Components.Exception("bad link!");95 if (['http', 'https', 'ftp'].indexOf(url.scheme) == -1 || url.host.indexOf('.') == -1) { 96 throw new Exception("bad link!"); 99 97 } 100 98 if (allowed instanceof Array && allowed.indexOf(url.scheme) == -1) { 101 throw new Components.Exception("not allowed");99 throw new Exception("not allowed"); 102 100 } 103 101 return url.spec; … … 184 182 let urlNodes = this._getNodes(file, 'ml:resources/ml:url'); 185 183 for each (var url in urlNodes) { 186 let type = url.getAttribute('type');187 184 let preference = 1; 188 185 let charset = doc.characterSet; 189 let usable = null; 186 if (url.hasAttributeNS(NS_DTA, 'charset')) { 187 charset = url.getAttributeNS(NS_DTA, 'charset'); 188 } 189 190 let uri = null; 191 try { 192 uri = this._checkURL(url.textContent.trim()); 193 if (!uri) { 194 throw new Exception("Invalid url"); 195 } 196 uri = IOService.newURI(uri, charset, null); 197 } 198 catch (ex) { 199 continue; 200 } 190 201 191 202 if (url.hasAttribute('preference')) { … … 201 212 } 202 213 } 203 if (url.hasAttributeNS(NS_DTA, 'charset')) { 204 charset = url.getAttributeNS(NS_DTA, 'charset'); 205 } 206 if (['http', 'https', 'ftp'].indexOf(type) != -1) { 207 url = this._checkURL(url.textContent.trim()); 208 if (url) { 209 urls.push(new DTA_URL(IOService.newURI(url, charset, null), preference)); 210 } 211 } 214 urls.push(new DTA_URL(uri, preference)); 212 215 } 213 216 if (!urls.length) {
