Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj

ReplaceSubstring() is an O(n*m) algorithm (n being the length of the
string and m being the number of occurrences of aTarget) because we have
to move the remainder of the string, search it again and potentially
memmove most of it again as we find more matches.  This patch rewrites
that function to make it O(n+m).

Note that we currently don't build TestStrings.cpp, so the test case in
this patch is not run automatically, but the test case has been verified
to pass separately by moving the test function into Gecko and calling it
during startup and stepping through it in the debugger.
Bug 649012 - Fail mochitests which use flaky timeouts (setTimeout(x) for x > 0); r=ted

We are white-listing the existing set of tests that use setTimeout
like this.  Hopefully these tests will be investigated and fixed
in the future, so that we can narrow down the white-list.
Port TestStrings.cpp to gtest and enable it; r=froydnj
compile fixes