Changeset 1131
- Timestamp:
- 2008-11-04 23:47:54 (2 months 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
r1129 r1131 94 94 // check for some popular bad links :p 95 95 if (['http', 'https', 'ftp'].indexOf(url.scheme) == -1 || url.host.indexOf('.') == -1) { 96 throw new Exception("bad link!"); 97 } 98 if (allowed instanceof Array && allowed.indexOf(url.scheme) == -1) { 99 throw new Exception("not allowed"); 96 if (!(allowed instanceof Array)) { 97 throw new Exception("bad link!"); 98 } 99 if (allowed.indexOf(url.scheme) == -1) { 100 throw new Exception("not allowed"); 101 } 100 102 } 101 103 return url.spec; … … 254 256 'size': size, 255 257 'version': this._getSingle(file, 'version'), 256 'logo': this._checkURL(this._getSingle(file, 'logo' )),258 'logo': this._checkURL(this._getSingle(file, 'logo', ['data'])), 257 259 'lang': this._getSingle(file, 'language'), 258 260 'sys': this._getSingle(file, 'os'), … … 269 271 'identity': this._getSingle(root, 'identity'), 270 272 'description': this._getSingle(root, 'description'), 271 'logo': this._checkURL(this._getSingle(root, 'logo' )),273 'logo': this._checkURL(this._getSingle(root, 'logo', ['data'])), 272 274 'license': this._getLinkRes(root, "license"), 273 275 'publisher': this._getLinkRes(root, "publisher"), … … 347 349 let w = logo.naturalWidth; 348 350 let h = logo.naturalHeight; 349 let d = Math.max( w, h);351 let d = Math.max(canvas.width, w, h); 350 352 351 ctx.scale(canvas.width / d, canvas.height / d); 353 if (d != canvas.width) { 354 ctx.scale(canvas.width / d, canvas.height / d); 355 } 352 356 353 357 ctx.drawImage(logo, (d - w) /2, (d - h) / 2);
