Avoid costly GetScheme on nsSimpleURI, and avoid yet another "javascript:" string literal and the consequent PL_strcasecmp call, in favor of a fast NUL first-char test.

This commit is contained in:
brendan%mozilla.org 2000-07-13 02:30:16 +00:00
Родитель 89608ef140
Коммит c4a7de165c
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -298,11 +298,11 @@ public:
// If mURI is just "javascript:", we bring up the JavaScript console
// and return NS_ERROR_DOM_RETVAL_UNDEFINED.
nsXPIDLCString spec;
rv = mURI->GetSpec(getter_Copies(spec));
nsXPIDLCString script;
rv = mURI->GetPath(getter_Copies(script));
if (NS_FAILED(rv)) return rv;
if (PL_strcasecmp(spec, "javascript:") == 0) {
if (*((const char*)script) == '\0') {
rv = evalProxy->BringUpConsole();
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
return NS_ERROR_DOM_RETVAL_UNDEFINED;