зеркало из https://github.com/mozilla/gecko-dev.git
Bug 596502: unbreak XML parsing on JS1.6 and onwards. (r=brendan)
This commit is contained in:
Родитель
c2d459282e
Коммит
d0e1ff2c6e
|
@ -1949,12 +1949,25 @@ static const uint32 HAS_XML = 0x1000; /* flag induced by XML option */
|
|||
static const uint32 ANONFUNFIX = 0x2000; /* see jsapi.h comment on JSOPTION_ANONFUNFIX */
|
||||
}
|
||||
|
||||
static inline JSVersion
|
||||
VersionNumber(JSVersion version)
|
||||
{
|
||||
return JSVersion(uint32(version) & VersionFlags::MASK);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionHasXML(JSVersion version)
|
||||
{
|
||||
return !!(version & VersionFlags::HAS_XML);
|
||||
}
|
||||
|
||||
/* @warning This is a distinct condition from having the XML flag set. */
|
||||
static inline bool
|
||||
VersionShouldParseXML(JSVersion version)
|
||||
{
|
||||
return VersionHasXML(version) || VersionNumber(version) >= JSVERSION_1_6;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionHasAnonFunFix(JSVersion version)
|
||||
{
|
||||
|
@ -1991,12 +2004,6 @@ VersionHasFlags(JSVersion version)
|
|||
return !!VersionExtractFlags(version);
|
||||
}
|
||||
|
||||
static inline JSVersion
|
||||
VersionNumber(JSVersion version)
|
||||
{
|
||||
return JSVersion(uint32(version) & VersionFlags::MASK);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionIsKnown(JSVersion version)
|
||||
{
|
||||
|
|
|
@ -1438,7 +1438,7 @@ TokenStream::getTokenInternal()
|
|||
* The check for this is in jsparse.cpp, Compiler::compileScript.
|
||||
*/
|
||||
if ((flags & TSF_OPERAND) &&
|
||||
(VersionHasXML(version) || peekChar() != '!')) {
|
||||
(VersionShouldParseXML(version) || peekChar() != '!')) {
|
||||
/* Check for XML comment or CDATA section. */
|
||||
if (matchChar('!')) {
|
||||
tokenbuf.clear();
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* All versions >= 1.6. */
|
||||
|
||||
function syntaxErrorFromXML() {
|
||||
try {
|
||||
var f = new Function('var text = <![CDATA[aaaaa bbbb]]>.toString();');
|
||||
return false;
|
||||
} catch (e if e instanceof SyntaxError) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
version(150);
|
||||
assertEq(syntaxErrorFromXML(), true);
|
||||
revertVersion();
|
||||
|
||||
for (vno in {150: null, 160: null, 170: null, 180: null}) {
|
||||
version(vno);
|
||||
assertEq(syntaxErrorFromXML(), false);
|
||||
revertVersion();
|
||||
}
|
||||
|
||||
print('PASS!')
|
Загрузка…
Ссылка в новой задаче