From bd04bc46475744efbd4b4052d4f2a141f863b6fa Mon Sep 17 00:00:00 2001 From: Shawn Wilsher Date: Wed, 22 Jul 2009 14:04:12 -0700 Subject: [PATCH] Backed out changeset 06433d3dafd9 (bug 504422) because the patch is wrong. --- build/automationutils.py | 46 ++++++++++++++++ .../components/places/src/SQLFunctions.cpp | 52 ++++++++----------- toolkit/components/places/src/SQLFunctions.h | 6 +-- 3 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 build/automationutils.py diff --git a/build/automationutils.py b/build/automationutils.py new file mode 100644 index 00000000000..a76a992f641 --- /dev/null +++ b/build/automationutils.py @@ -0,0 +1,46 @@ +import sys, glob, os, subprocess, logging + +__all__ = [ + "addCommonOptions", + "checkForCrashes", + ] + +log = logging.getLogger() + +def addCommonOptions(parser, defaults={}): + parser.add_option("--xre-path", + action = "store", type = "string", dest = "xrePath", + # individual scripts will set a sane default + default = None, + help = "absolute path to directory containing XRE (probably xulrunner)") + if 'SYMBOLS_PATH' not in defaults: + defaults['SYMBOLS_PATH'] = None + parser.add_option("--symbols-path", + action = "store", type = "string", dest = "symbolsPath", + default = defaults['SYMBOLS_PATH'], + help = "absolute path to directory containing breakpad symbols") + +def checkForCrashes(dumpDir, symbolsPath, testName=None): + stackwalkPath = os.environ.get('MINIDUMP_STACKWALK', None) + # try to get the caller's filename if no test name is given + if testName is None: + try: + testName = os.path.basename(sys._getframe(1).f_code.co_filename) + except: + testName = "unknown" + + foundCrash = False + dumps = glob.glob(os.path.join(dumpDir, '*.dmp')) + for d in dumps: + log.info("TEST-UNEXPECTED-FAIL | %s | application crashed (minidump found)", testName) + if symbolsPath and stackwalkPath: + nullfd = open(os.devnull, 'w') + # eat minidump_stackwalk errors + subprocess.call([stackwalkPath, d, symbolsPath], stderr=nullfd) + nullfd.close() + os.remove(d) + extra = os.path.splitext(d)[0] + ".extra" + if os.path.exists(extra): + os.remove(extra) + foundCrash = True + return foundCrash diff --git a/toolkit/components/places/src/SQLFunctions.cpp b/toolkit/components/places/src/SQLFunctions.cpp index 5aad78ef03b..8ca9b7a8d9c 100644 --- a/toolkit/components/places/src/SQLFunctions.cpp +++ b/toolkit/components/places/src/SQLFunctions.cpp @@ -71,29 +71,29 @@ namespace places { } /* static */ - void - MatchAutoCompleteFunction::fixupURISpec(const nsDependentCString &aURISpec, - nsString &_fixedSpec) + nsString + MatchAutoCompleteFunction::fixupURISpec(const nsDependentCString &aURISpec) { - nsCString unescapedSpec; + nsCAutoString unescapedSpec; (void)NS_UnescapeURL(aURISpec, esc_SkipControl | esc_AlwaysCopy, unescapedSpec); // If this unescaped string is valid UTF-8, we'll convert it. Otherwise, // we will simply convert our original string. - NS_ASSERTION(_fixedSpec.IsEmpty(), - "Passing a non-empty string as an out parameter!"); + nsString fixedSpec; if (IsUTF8(unescapedSpec)) - CopyUTF8toUTF16(unescapedSpec, _fixedSpec); + CopyUTF8toUTF16(unescapedSpec, fixedSpec); else - CopyUTF8toUTF16(aURISpec, _fixedSpec); + CopyUTF8toUTF16(aURISpec, fixedSpec); - if (StringBeginsWith(_fixedSpec, NS_LITERAL_STRING("http://"))) - _fixedSpec.Cut(0, 7); - else if (StringBeginsWith(_fixedSpec, NS_LITERAL_STRING("https://"))) - _fixedSpec.Cut(0, 8); - else if (StringBeginsWith(_fixedSpec, NS_LITERAL_STRING("ftp://"))) - _fixedSpec.Cut(0, 6); + if (StringBeginsWith(fixedSpec, NS_LITERAL_STRING("http://"))) + fixedSpec.Cut(0, 7); + else if (StringBeginsWith(fixedSpec, NS_LITERAL_STRING("https://"))) + fixedSpec.Cut(0, 8); + else if (StringBeginsWith(fixedSpec, NS_LITERAL_STRING("ftp://"))) + fixedSpec.Cut(0, 6); + + return fixedSpec; } /* static */ @@ -214,15 +214,10 @@ namespace places { #define HAS_BEHAVIOR(aBitName) \ (searchBehavior & mozIPlacesAutoComplete::BEHAVIOR_##aBitName) - // Temporaries used to get the strings. - const PRUnichar *wStr; - const char *str; - PRUint32 len; - - (void)aArguments->GetSharedString(kArgSearchString, &len, &wStr); - nsDependentString searchString(wStr, len / sizeof(PRUnichar)); - (void)aArguments->GetSharedUTF8String(kArgIndexURL, &len, &str); - nsDependentCString url(str, len); + nsDependentString searchString; + (void)aArguments->GetString(kArgSearchString, searchString); + nsDependentCString url; + (void)aArguments->GetUTF8String(kArgIndexURL, url); // We only want to filter javascript: URLs if we are not supposed to search // for them, and the search does not start with "javascript:". @@ -237,8 +232,8 @@ namespace places { PRInt32 visitCount = aArguments->AsInt32(kArgIndexVisitCount); bool typed = aArguments->AsInt32(kArgIndexTyped) ? true : false; bool bookmark = aArguments->AsInt32(kArgIndexBookmark) ? true : false; - (void)aArguments->GetSharedString(kArgIndexTags, &len, &wStr); - nsDependentString tags(wStr, len / sizeof(PRUnichar)); + nsDependentString tags; + (void)aArguments->GetString(kArgIndexTags, tags); // Make sure we match all the filter requirements. If a given restriction // is active, make sure the corresponding condition is not true. @@ -255,15 +250,14 @@ namespace places { } // Clean up our URI spec and prepare it for searching. - nsString fixedURI; - fixupURISpec(url, fixedURI); + nsString fixedURI = fixupURISpec(url); // Obtain our search function. PRInt32 matchBehavior = aArguments->AsInt32(kArgIndexMatchBehavior); searchFunctionPtr searchFunction = getSearchFunction(matchBehavior); - (void)aArguments->GetSharedString(kArgIndexTitle, &len, &wStr); - nsDependentString title(wStr, len / sizeof(PRUnichar)); + nsDependentString title; + (void)aArguments->GetString(kArgIndexTitle, title); // Determine if every token matches either the bookmark title, tags, page // title, or page URL. diff --git a/toolkit/components/places/src/SQLFunctions.h b/toolkit/components/places/src/SQLFunctions.h index 89074db17cb..dc6e3f5d536 100644 --- a/toolkit/components/places/src/SQLFunctions.h +++ b/toolkit/components/places/src/SQLFunctions.h @@ -197,11 +197,9 @@ private: * * @param aURISpec * The spec of the URI to prepare for searching. - * @param _fixedSpec - * An out parameter that is the fixed up string. + * @return the new string to use for the URI spec. */ - static void fixupURISpec(const nsDependentCString &aURISpec, - nsString &_fixedSpec); + static nsString fixupURISpec(const nsDependentCString &aURISpec); }; } // namespace places