From 16f680cbdc4ba8b9b5a054103cfa8569aca602c7 Mon Sep 17 00:00:00 2001 From: "tony%ponderer.org" Date: Thu, 18 Jan 2007 05:55:09 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20366645=20=EF=BF=BD=EF=BF=BD=EF=BF=BD=20Re?= =?UTF-8?q?ference=20to=20undefined=20property=20FIND=5FTRAILING=5FDOTS=5F?= =?UTF-8?q?GLOBAL=20patch:=20remove=20unused=20regexes=20r=3Dmmchew?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- testing/mochitest/tests/index.html | 1 + testing/mochitest/tests/test_bug356355.xhtml | 26 +---- testing/mochitest/tests/test_bug366645.xhtml | 108 ++++++++++++++++++ .../content/enchash-decrypter.js | 16 +-- 4 files changed, 114 insertions(+), 37 deletions(-) create mode 100644 testing/mochitest/tests/test_bug366645.xhtml diff --git a/testing/mochitest/tests/index.html b/testing/mochitest/tests/index.html index 4a1c80eb6d5b..4980ab89bc46 100644 --- a/testing/mochitest/tests/index.html +++ b/testing/mochitest/tests/index.html @@ -102,6 +102,7 @@ RunSet.runall = function() { 'test_bug364092.xhtml', 'test_bug364413.xhtml', 'test_bug365773.xul', + 'test_bug366645.xhtml', 'test_bug367164.html, 'test_MochiKit-Async.html', 'test_MochiKit-Base.html', diff --git a/testing/mochitest/tests/test_bug356355.xhtml b/testing/mochitest/tests/test_bug356355.xhtml index 3cf73135713b..b15bfb8e0022 100644 --- a/testing/mochitest/tests/test_bug356355.xhtml +++ b/testing/mochitest/tests/test_bug356355.xhtml @@ -165,37 +165,13 @@ function testRE(re, inputValPairs) { "RegExp broken: " + re + " (input: " + inputValPairs[i] + ")"); }; -var tests = - ["", false, - "normal chars;!@#$%^&*&(", false, - "MORE NORMAL ,./<>?;':{}", false, - "Slightly less\2 normal", true, - "\245 stuff \45", true, - "\31", true]; -testRE(r.FIND_DODGY_CHARS, tests); - -tests = - [no_dots, false, - one_dot, false, - leading_dot, true, - trailing_dots, true, - end_dots, true]; -testRE(r.FIND_END_DOTS, tests); - tests = [no_dots, false, one_dot, false, two_dots, true, lots_o_dots, true, multi_dots, true]; -testRE(r.FIND_MULTIPLE_DOTS, tests); - -tests = - [no_dots, false, - one_dot, false, - trailing_dot, true, - trailing_dots, true]; -testRE(r.FIND_TRAILING_DOTS, tests); +testRE(r.FIND_MULTIPLE_DOTS_GLOBAL, tests); tests = ["random junk", false, diff --git a/testing/mochitest/tests/test_bug366645.xhtml b/testing/mochitest/tests/test_bug366645.xhtml new file mode 100644 index 000000000000..c035a3dc0cfd --- /dev/null +++ b/testing/mochitest/tests/test_bug366645.xhtml @@ -0,0 +1,108 @@ + + + + Test for Bug 366645 + + + + + +Mozilla Bug 366645 +

+ +
+
+
+ + diff --git a/toolkit/components/url-classifier/content/enchash-decrypter.js b/toolkit/components/url-classifier/content/enchash-decrypter.js index c042bbc2746e..847fbdf3dd1c 100644 --- a/toolkit/components/url-classifier/content/enchash-decrypter.js +++ b/toolkit/components/url-classifier/content/enchash-decrypter.js @@ -74,18 +74,13 @@ PROT_EnchashDecrypter.SALT_LENGTH = PROT_EnchashDecrypter.DATABASE_SALT.length; PROT_EnchashDecrypter.MAX_DOTS = 5; PROT_EnchashDecrypter.REs = {}; -PROT_EnchashDecrypter.REs.FIND_DODGY_CHARS = - new RegExp("[\x01-\x1f\x7f-\xff]+"); -PROT_EnchashDecrypter.REs.FIND_DODGY_CHARS_GLOBAL = +PROT_EnchashDecrypter.REs.FIND_DODGY_CHARS_GLOBAL = new RegExp("[\x01-\x1f\x7f-\xff]+", "g"); -PROT_EnchashDecrypter.REs.FIND_END_DOTS = new RegExp("^\\.+|\\.+$"); -PROT_EnchashDecrypter.REs.FIND_END_DOTS_GLOBAL = +PROT_EnchashDecrypter.REs.FIND_END_DOTS_GLOBAL = new RegExp("^\\.+|\\.+$", "g"); -PROT_EnchashDecrypter.REs.FIND_MULTIPLE_DOTS = new RegExp("\\.{2,}"); -PROT_EnchashDecrypter.REs.FIND_MULTIPLE_DOTS_GLOBAL = +PROT_EnchashDecrypter.REs.FIND_MULTIPLE_DOTS_GLOBAL = new RegExp("\\.{2,}", "g"); -PROT_EnchashDecrypter.REs.FIND_TRAILING_DOTS = new RegExp("\\.+$"); -PROT_EnchashDecrypter.REs.POSSIBLE_IP = +PROT_EnchashDecrypter.REs.POSSIBLE_IP = new RegExp("^((?:0x[0-9a-f]+|[0-9\\.])+)$", "i"); PROT_EnchashDecrypter.REs.FIND_BAD_OCTAL = new RegExp("(^|\\.)0\\d*[89]"); PROT_EnchashDecrypter.REs.IS_OCTAL = new RegExp("^0[0-7]*$"); @@ -243,9 +238,6 @@ PROT_EnchashDecrypter.prototype.getCanonicalHost = function(str, opt_maxDots) { } PROT_EnchashDecrypter.prototype.parseIPAddress_ = function(host) { - - host = host.replace(this.REs_.FIND_TRAILING_DOTS_GLOBAL, ""); - if (!this.REs_.POSSIBLE_IP.test(host)) return "";