Bug 755480 - Part 2: Detect unknwon URLs faster; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 15 May 2012 16:36:04 -0400
changeset 94278 7b6dd63e140001c87ce43f92706404b28ac53b4e
parent 94277 44731e4787f0ff522a9f54eb145406187a0109b8
child 94279 942b6e232d80e92939f7f0bd1a41fe37f957119b
push id22705
push userMs2ger@gmail.com
push dateFri, 18 May 2012 08:29:06 +0000
treeherdermozilla-central@20fbb51c9462 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs755480
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 755480 - Part 2: Detect unknwon URLs faster; r=roc
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -938,26 +938,26 @@ WordSplitState::FindSpecialWord()
       // current position for potentially removing a spelling range.
       if (i > 0 && ClassifyCharacter(i - 1, false) == CHAR_CLASS_WORD &&
           i < (PRInt32)mDOMWordText.Length() - 1 &&
           ClassifyCharacter(i + 1, false) == CHAR_CLASS_WORD)
 
       return mDOMWordText.Length() - mDOMWordOffset;
     } else if (mDOMWordText[i] == ':' && firstColon < 0) {
       firstColon = i;
+
+      // If the first colon is followed by a slash, consider it a URL
+      // This will catch things like asdf://foo.com
+      if (firstColon < (PRInt32)mDOMWordText.Length() - 1 &&
+          mDOMWordText[firstColon + 1] == '/') {
+        return mDOMWordText.Length() - mDOMWordOffset;
+      }
     }
   }
 
-  // If the first colon is followed by a slash, consider it a URL
-  // This will catch things like asdf://foo.com
-  if (firstColon >= 0 && firstColon < (PRInt32)mDOMWordText.Length() - 1 &&
-      mDOMWordText[firstColon + 1] == '/') {
-    return mDOMWordText.Length() - mDOMWordOffset;
-  }
-
   // Check the text before the first colon against some known protocols. It
   // is impossible to check against all protocols, especially since you can
   // plug in new protocols. We also don't want to waste time here checking
   // against a lot of obscure protocols.
   if (firstColon > mDOMWordOffset) {
     nsString protocol(Substring(mDOMWordText, mDOMWordOffset,
                       firstColon - mDOMWordOffset));
     if (protocol.EqualsIgnoreCase("http") ||