From ee87a8a0dab2c5d60783bc066c80ac6b71540fc8 Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Wed, 19 Feb 2014 09:18:13 -0500 Subject: [PATCH] Bug 974368 - Fix ! operator precedence in manifestparser's expression parser. r=jmaher --- .../preferences/in-content/tests/browser.ini | 2 +- browser/components/preferences/tests/browser.ini | 2 +- .../manifestparser/manifestparser.py | 2 +- .../manifestdestiny/tests/test_expressionparser.py | 13 +++++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini index 3003b3293f5e..65091f957080 100644 --- a/browser/components/preferences/in-content/tests/browser.ini +++ b/browser/components/preferences/in-content/tests/browser.ini @@ -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] diff --git a/browser/components/preferences/tests/browser.ini b/browser/components/preferences/tests/browser.ini index 585ec6a8fccf..c78f160ba8cc 100644 --- a/browser/components/preferences/tests/browser.ini +++ b/browser/components/preferences/tests/browser.ini @@ -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] diff --git a/testing/mozbase/manifestdestiny/manifestparser/manifestparser.py b/testing/mozbase/manifestdestiny/manifestparser/manifestparser.py index 907fc7be5867..adc59a769aec 100755 --- a/testing/mozbase/manifestdestiny/manifestparser/manifestparser.py +++ b/testing/mozbase/manifestdestiny/manifestparser/manifestparser.py @@ -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): "&&" diff --git a/testing/mozbase/manifestdestiny/tests/test_expressionparser.py b/testing/mozbase/manifestdestiny/tests/test_expressionparser.py index 448facea8709..d8a1c310ef38 100755 --- a/testing/mozbase/manifestdestiny/tests/test_expressionparser.py +++ b/testing/mozbase/manifestdestiny/tests/test_expressionparser.py @@ -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()