Project

General

Profile

« Previous | Next » 

Revision 53837634

Added by koszko about 2 years ago

enable whitelisting of `file://' protocol\n\nThis commit additionally also changes the semantics of triple asterisk wildcard in URL path.

View differences:

common/misc.js
84 84
    window.open(url, "_blank");
85 85
}
86 86

  
87
/* Check if url corresponds to a browser's special page */
88
function is_privileged_url(url)
89
{
90
    return !!/^(chrome(-extension)?|moz-extension):\/\/|^about:/i.exec(url);
91
}
87
/*
88
 * Check if url corresponds to a browser's special page (or a directory index in
89
 * case of `file://' protocol).
90
 */
91
const privileged_reg =
92
      /^(chrome(-extension)?|moz-extension):\/\/|^about:|^file:\/\/.*\/$/;
93
const is_privileged_url = url => privileged_reg.test(url);
92 94

  
93 95
/* Parse a CSP header */
94 96
function parse_csp(csp) {

Also available in: Unified diff