/** * Provides predicates for reasoning about regular expressions * that match URLs and hostname patterns. */ private import HostnameRegexpSpecific /** * Holds if the given constant is unlikely to occur in the origin part of a URL. */ predicate isConstantInvalidInsideOrigin(RegExpConstant term) { // Look for any of these cases: // - A character that can't occur in the origin // - Two dashes in a row // - A colon that is not part of port or scheme separator // - A slash that is not part of scheme separator term.getValue().regexpMatch(".*(?:[^a-zA-Z0-9.:/-]|--|:[^0-9/]|(?