mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 14:28:39 +09:00
[devtools] Restrict sourcemap URLs
This commit is contained in:
parent
8751960d9a
commit
168e8bebd0
1 changed files with 13 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue