mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	While we could fix this issue by changing the markdown processor, doing so is not a robust solution, because even a momentary bug in the markdown processor could allow cached messages that do not follow our security policy. This change ensures that even if our markdown processor has bugs that result in rendered content that does not properly follow our policy of using rel="noopener noreferrer" on links, we'll still do something reasonable. Co-authored-by: Tim Abbott <tabbott@zulipchat.com> Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
		
			
				
	
	
		
			13 lines
		
	
	
		
			467 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			467 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/* eslint-env browser */
 | 
						||
 | 
						||
// PhantomJS doesn’t support new DOMParser().parseFromString(…, "text/html").
 | 
						||
var real_parseFromString = DOMParser.prototype.parseFromString;
 | 
						||
DOMParser.prototype.parseFromString = function (string, type) {
 | 
						||
    if (type === "text/html") {
 | 
						||
        var doc = document.implementation.createHTMLDocument("");
 | 
						||
        doc.documentElement.innerHTML = string;
 | 
						||
        return doc;
 | 
						||
    }
 | 
						||
    return real_parseFromString.apply(this, arguments);
 | 
						||
};
 |