Ticket #209: addHashSign.patch
| File addHashSign.patch, 1.0 kB (added by Mardak, 2 years ago) |
|---|
-
trunk/chrome/content/common/overlayFunctions.js
old new 736 736 737 737 /** 738 738 * Get a link-fingerprint hash from an url (or just the hash component) 739 739 * @param url. Either String or nsIURI 740 740 * @return Valid hash string or null 741 741 */ 742 742 function DTA_getLinkPrintHash(url) { 743 743 if (url instanceof Components.interfaces.nsIURL) { 744 url = url.ref;744 url = '#' + url.ref; 745 745 } 746 746 else if (url instanceof Components.interfaces.nsIURI) { 747 747 url = url.spec; 748 748 } 749 749 else if (typeof(url) != 'string' && !(url instanceof String)) { 750 750 return null; 751 751 } 752 752 753 var lp = url.match(/#!(md5|sha(?:1|256|384|512) |)!([\da-f]+)$/i);753 var lp = url.match(/#!(md5|sha(?:1|256|384|512))!([\da-f]+)$/i); 754 754 if (lp) { 755 755 try { 756 756 return new DTA_Hash(lp[2], lp[1]); 757 757 } 758 758 catch (ex) { 759 759 // pass down 760 760 } 761 761 }
