Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2022-04-10 23:03:50 +08:00
commit be997daa6b
7 changed files with 60 additions and 20 deletions

View file

@ -23,6 +23,19 @@ function enableSourceMaps() {
function _resolveSourceMapURL(source) {
const { url = "", sourceMapURL = "" } = source;
const UNSUPPORTED_PROTOCOLS = ["chrome://", "resource://"];
if (path.isURL(sourceMapURL) && UNSUPPORTED_PROTOCOLS.some(protocol => sourceMapURL.startsWith(protocol))) {
// If it's an internal protocol, don't allow it and return empty.
return "";
}
if (path.isURL(sourceMapURL) && sourceMapURL.startsWith("file://")) {
// Only allow file:// source maps from file:// docs
if (!url.startsWith("file://")) {
return "";
}
}
if (path.isURL(sourceMapURL) || url == "") {
// If it's already a full URL or the source doesn't have a URL,
// don't resolve anything.