This change is a precursor to tackling some more difficult cases where we
need to apply the string manipulations to strings obtained in a more
The function cannonicalize() now becomes a method of XSSAuditor, and
is the main entry point for performing all such operations. Other methods are
renamed to refer to canconicalized strings.
In order to apply this everywhere, canonicalize() needs to know whether any
truncation is to be applied at all (e.g. we're processing the request URL
or post body and must use it all), so introduce a new enum constant for this
case. Rename the enum while we're at it to indicate its close relationship
Having done this, several methods can now become functions for truncating strings.
I also removed some indentation from eraseAttributeIfInjected().