Bug 974368 - Fix ! operator precedence in manifestparser's expression parser. r=jmaher

This commit is contained in:
Ted Mielczarek 2014-02-19 09:18:13 -05:00
parent c825576979
commit be7cc08ee9
4 changed files with 16 additions and 3 deletions

View File

@ -8,7 +8,7 @@ support-files =
[browser_bug731866.js]
[browser_connection.js]
[browser_healthreport.js]
skip-if = (!healthreport) || (os == 'linux' && debug)
skip-if = !healthreport || (os == 'linux' && debug)
[browser_privacypane_1.js]
[browser_privacypane_3.js]
[browser_privacypane_5.js]

View File

@ -8,7 +8,7 @@ support-files =
[browser_bug705422.js]
[browser_chunk_permissions.js]
[browser_healthreport.js]
skip-if = (!healthreport) || (os == 'linux' && debug)
skip-if = !healthreport || (os == 'linux' && debug)
[browser_permissions.js]
[browser_privacypane_1.js]
[browser_privacypane_3.js]

View File

@ -85,7 +85,7 @@ class neq_op_token(object):
class not_op_token(object):
"!"
def nud(self, parser):
return not parser.expression()
return not parser.expression(100)
class and_op_token(object):
"&&"

View File

@ -78,5 +78,18 @@ class ExpressionParserTest(unittest.TestCase):
self.assertTrue(parse('"string with #" == "string with #" # really, it does'))
self.assertTrue(parse('"string with #" != "string with # but not the same" # no match!'))
def test_not(self):
"""
Test the ! operator.
"""
self.assertTrue(parse("!false"))
self.assertTrue(parse("!(false)"))
self.assertFalse(parse("!true"))
self.assertFalse(parse("!(true)"))
self.assertTrue(parse("!true || true)"))
self.assertTrue(parse("true || !true)"))
self.assertFalse(parse("!true && true"))
self.assertFalse(parse("true && !true"))
if __name__ == '__main__':
unittest.main()