Bug 1949604 - Linkify moz-url:///. r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D240771
This commit is contained in:
Tooru Fujisawa
2025-03-08 21:19:33 +00:00
parent 72c262b4df
commit db4aa12cb6

View File

@@ -2734,8 +2734,11 @@ public:
StringRef sref = E->getString(); StringRef sref = E->getString();
std::string s = sref.str(); std::string s = sref.str();
bool isMozSrc = stringStartsWith(s, "moz-src:///");
if (!stringStartsWith(s, "chrome://") && if (!stringStartsWith(s, "chrome://") &&
!stringStartsWith(s, "resource://")) { !stringStartsWith(s, "resource://") &&
!isMozSrc) {
return true; return true;
} }
@@ -2746,7 +2749,13 @@ public:
SourceLocation Loc = E->getStrTokenLoc(0); SourceLocation Loc = E->getStrTokenLoc(0);
normalizeLocation(&Loc); normalizeLocation(&Loc);
std::string symbol = std::string("URL_") + mangleURL(s); std::string symbol;
if (isMozSrc) {
symbol = std::string("FILE_") + mangleFile(s.substr(11), FileType::Source);
} else {
symbol = std::string("URL_") + mangleURL(s);
}
visitIdentifier("use", "file", StringRef(s), Loc, symbol, QualType(), visitIdentifier("use", "file", StringRef(s), Loc, symbol, QualType(),
Context(), NotIdentifierToken | LocRangeEndValid); Context(), NotIdentifierToken | LocRangeEndValid);