зеркало из https://github.com/mozilla/pjs.git
backing out 345517 due to leak test bustage
This commit is contained in:
Родитель
5a46df0591
Коммит
140ad3f195
|
@ -249,7 +249,7 @@ ifeq ($(OS_ARCH),WINNT)
|
|||
# Set it to 256k. See bug 127069.
|
||||
#
|
||||
ifndef GNU_CC
|
||||
LDFLAGS += /HEAP:0x40000
|
||||
LDFLAGS += /HEAP:0x40000 /fixed:no
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = bookmarks
|
||||
LIBRARY_NAME = bookmarks_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
|
@ -77,5 +76,9 @@ CPPSRCS = nsBookmarksService.cpp \
|
|||
|
||||
EXTRA_COMPONENTS = nsBookmarkTransactionManager.js
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -392,12 +392,8 @@ nsFeedLoadListener::TryParseAsRDF ()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!listener) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIStringInputStream> stream =
|
||||
do_CreateInstance("@mozilla.org/io/string-input-stream;1");
|
||||
if (!stream)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = stream->SetData(mBody.get(), mBody.Length());
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(stream), mBody);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
@ -857,9 +853,9 @@ nsFeedLoadListener::TryParseAsSimpleRSS ()
|
|||
}
|
||||
|
||||
// Clean up whitespace
|
||||
CompressWhitespace(titleStr);
|
||||
titleStr.CompressWhitespace();
|
||||
linkStr.Trim("\b\t\r\n ");
|
||||
CompressWhitespace(dateStr);
|
||||
dateStr.CompressWhitespace();
|
||||
|
||||
if (titleStr.IsEmpty() && !dateStr.IsEmpty())
|
||||
titleStr.Assign(dateStr);
|
||||
|
|
|
@ -66,10 +66,11 @@
|
|||
#include "nsRDFCID.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "rdf.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
||||
#include "nsISound.h"
|
||||
|
@ -93,13 +94,6 @@
|
|||
#include "nsIWebNavigation.h"
|
||||
|
||||
#include "plbase64.h"
|
||||
#include "nsCRTGlue.h"
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#define NS_LINEBREAK "\015\012"
|
||||
#else
|
||||
#define NS_LINEBREAK "\012"
|
||||
#endif
|
||||
|
||||
nsIRDFResource *kNC_IEFavoritesRoot;
|
||||
nsIRDFResource *kNC_SystemBookmarksStaticRoot;
|
||||
|
@ -637,8 +631,6 @@ static const char kOpenMeta[] = "<META ";
|
|||
static const char kPersonalToolbarFolderEquals[] = "PERSONAL_TOOLBAR_FOLDER=\"";
|
||||
|
||||
static const char kNameEquals[] = "NAME=\"";
|
||||
static const char kNameEqualsLC[] = "name=\"";
|
||||
|
||||
static const char kHREFEquals[] = "HREF=\"";
|
||||
static const char kTargetEquals[] = "TARGET=\"";
|
||||
static const char kAddDateEquals[] = "ADD_DATE=\"";
|
||||
|
@ -865,7 +857,7 @@ BookmarkParser::DecodeBuffer(nsString &line, char *buf, PRUint32 aLength)
|
|||
}
|
||||
else
|
||||
{
|
||||
line.Append(NS_ConvertASCIItoUTF16(buf, aLength));
|
||||
line.AppendWithConversion(buf, aLength);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -930,7 +922,7 @@ BookmarkParser::ProcessLine(nsIRDFContainer *container, nsIRDFResource *nodeType
|
|||
}
|
||||
}
|
||||
else if ((offset = line.Find(kOpenHeading, PR_TRUE)) >= 0 &&
|
||||
NS_IsAsciiDigit(line.CharAt(offset + 2)))
|
||||
nsCRT::IsAsciiDigit(line.CharAt(offset + 2)))
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> dummy;
|
||||
if (line.CharAt(offset + 2) != PRUnichar('1'))
|
||||
|
@ -1064,27 +1056,27 @@ BookmarkParser::Unescape(nsString &text)
|
|||
|
||||
while((offset = text.FindChar((PRUnichar('&')), offset)) >= 0)
|
||||
{
|
||||
if (Substring(text, offset, 4).LowerCaseEqualsLiteral("<"))
|
||||
if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("<"), nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
text.Cut(offset, 4);
|
||||
text.Insert(PRUnichar('<'), offset);
|
||||
}
|
||||
else if (Substring(text, offset, 4).LowerCaseEqualsLiteral(">"))
|
||||
else if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING(">"), nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
text.Cut(offset, 4);
|
||||
text.Insert(PRUnichar('>'), offset);
|
||||
}
|
||||
else if (Substring(text, offset, 5).LowerCaseEqualsLiteral("&"))
|
||||
else if (Substring(text, offset, 5).Equals(NS_LITERAL_STRING("&"), nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
text.Cut(offset, 5);
|
||||
text.Insert(PRUnichar('&'), offset);
|
||||
}
|
||||
else if (Substring(text, offset, 6).LowerCaseEqualsLiteral("""))
|
||||
else if (Substring(text, offset, 6).Equals(NS_LITERAL_STRING("""), nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
text.Cut(offset, 6);
|
||||
text.Insert(PRUnichar('\"'), offset);
|
||||
}
|
||||
else if (Substring(text, offset, 5).LowerCaseEqualsLiteral("'"))
|
||||
else if (Substring(text, offset, 5).Equals(NS_LITERAL_STRING("'")))
|
||||
{
|
||||
text.Cut(offset, 5);
|
||||
text.Insert(PRUnichar('\''), offset);
|
||||
|
@ -1110,10 +1102,11 @@ BookmarkParser::ParseMetaTag(const nsString &aLine, nsIUnicodeDecoder **decoder)
|
|||
start += (sizeof(kHTTPEquivEquals) - 1);
|
||||
// ...and find the next so we can chop the HTTP-EQUIV attribute
|
||||
PRInt32 end = aLine.FindChar(PRUnichar('"'), start);
|
||||
nsAutoString httpEquiv(Substring(aLine, start, end - start));
|
||||
nsAutoString httpEquiv;
|
||||
aLine.Mid(httpEquiv, start, end - start);
|
||||
|
||||
// if HTTP-EQUIV isn't "Content-Type", just ignore the META tag
|
||||
if (!httpEquiv.LowerCaseEqualsLiteral("content-type"))
|
||||
if (!httpEquiv.EqualsIgnoreCase("Content-Type"))
|
||||
return NS_OK;
|
||||
|
||||
// get the CONTENT attribute
|
||||
|
@ -1124,15 +1117,16 @@ BookmarkParser::ParseMetaTag(const nsString &aLine, nsIUnicodeDecoder **decoder)
|
|||
start += (sizeof(kContentEquals) - 1);
|
||||
// ...and find the next so we can chop the CONTENT attribute
|
||||
end = aLine.FindChar(PRUnichar('"'), start);
|
||||
nsAutoString content(Substring(aLine, start, end - start));
|
||||
nsAutoString content;
|
||||
aLine.Mid(content, start, end - start);
|
||||
|
||||
// look for the charset value
|
||||
start = content.Find(kCharsetEquals, PR_TRUE);
|
||||
NS_ASSERTION(start >= 0, "no 'charset=' string: how'd we get here?");
|
||||
if (start < 0) return NS_ERROR_UNEXPECTED;
|
||||
start += (sizeof(kCharsetEquals)-1);
|
||||
NS_LossyConvertUTF16toASCII charset(Substring(content, start,
|
||||
content.Length() - start));
|
||||
nsCAutoString charset;
|
||||
charset.AssignWithConversion(Substring(content, start, content.Length() - start));
|
||||
if (charset.Length() < 1) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// found a charset, now try and get a decoder from it to Unicode
|
||||
|
@ -1205,13 +1199,13 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
PRInt32 attrStart=0;
|
||||
if (isBookmarkFlag == PR_TRUE)
|
||||
{
|
||||
attrStart = aLine.Find(kOpenAnchor, attrStart, PR_TRUE);
|
||||
attrStart = aLine.Find(kOpenAnchor, PR_TRUE, attrStart);
|
||||
if (attrStart < 0) return NS_ERROR_UNEXPECTED;
|
||||
attrStart += sizeof(kOpenAnchor)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
attrStart = aLine.Find(kOpenHeading, attrStart, PR_TRUE);
|
||||
attrStart = aLine.Find(kOpenHeading, PR_TRUE, attrStart);
|
||||
if (attrStart < 0) return NS_ERROR_UNEXPECTED;
|
||||
attrStart += sizeof(kOpenHeading)-1;
|
||||
}
|
||||
|
@ -1225,14 +1219,16 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
// loop over attributes
|
||||
while((attrStart < lineLen) && (aLine[attrStart] != '>'))
|
||||
{
|
||||
while(NS_IsAsciiWhitespace(aLine[attrStart])) ++attrStart;
|
||||
while(nsCRT::IsAsciiSpace(aLine[attrStart])) ++attrStart;
|
||||
|
||||
PRBool fieldFound = PR_FALSE;
|
||||
|
||||
NS_ConvertASCIItoUTF16 id(kIDEquals);
|
||||
nsAutoString id;
|
||||
id.AssignWithConversion(kIDEquals);
|
||||
for (BookmarkField *field = fields; field->mName; ++field)
|
||||
{
|
||||
NS_ConvertASCIItoUTF16 name(field->mName);
|
||||
nsAutoString name;
|
||||
name.AssignWithConversion(field->mName);
|
||||
if (mIsImportOperation && name.Equals(id))
|
||||
// For import operations, we don't want to save the unique
|
||||
// identifier for folders, because this can cause bugs like
|
||||
|
@ -1245,8 +1241,7 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
// We don't want to assert a BTF arc twice.
|
||||
continue;
|
||||
|
||||
if (Substring(aLine, attrStart, name.Length()).
|
||||
Equals(name, CaseInsensitiveCompare))
|
||||
if (aLine.Find(field->mName, PR_TRUE, attrStart, 1) == attrStart)
|
||||
{
|
||||
attrStart += strlen(field->mName);
|
||||
|
||||
|
@ -1255,8 +1250,8 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
if (termQuote > attrStart)
|
||||
{
|
||||
// process data
|
||||
nsAutoString data(Substring(aLine, attrStart,
|
||||
termQuote-attrStart));
|
||||
nsAutoString data;
|
||||
aLine.Mid(data, attrStart, termQuote-attrStart);
|
||||
|
||||
attrStart = termQuote + 1;
|
||||
fieldFound = PR_TRUE;
|
||||
|
@ -1286,7 +1281,7 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
{
|
||||
// skip to next attribute
|
||||
while((attrStart < lineLen) && (aLine[attrStart] != '>') &&
|
||||
(!NS_IsAsciiWhitespace(aLine[attrStart])))
|
||||
(!nsCRT::IsAsciiSpace(aLine[attrStart])))
|
||||
{
|
||||
++attrStart;
|
||||
}
|
||||
|
@ -1322,7 +1317,7 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
PRBool isIEFavoriteRoot = PR_FALSE;
|
||||
if (!mIEFavoritesRoot.IsEmpty())
|
||||
{
|
||||
if (!strcmp(mIEFavoritesRoot.get(), bookmarkURI))
|
||||
if (!nsCRT::strcmp(mIEFavoritesRoot.get(), bookmarkURI))
|
||||
{
|
||||
mFoundIEFavoritesRoot = PR_TRUE;
|
||||
isIEFavoriteRoot = PR_TRUE;
|
||||
|
@ -1369,8 +1364,8 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
|
||||
if (nameEnd > attrStart)
|
||||
{
|
||||
nsAutoString name(Substring(aLine, attrStart,
|
||||
nameEnd-attrStart));
|
||||
nsAutoString name;
|
||||
aLine.Mid(name, attrStart, nameEnd-attrStart);
|
||||
if (!name.IsEmpty())
|
||||
{
|
||||
Unescape(name);
|
||||
|
@ -1445,7 +1440,8 @@ BookmarkParser::ParseResource(nsIRDFResource *arc, nsString& url, nsIRDFNode** a
|
|||
PRInt32 offset;
|
||||
while ((offset = url.Find(kEscape22)) >= 0)
|
||||
{
|
||||
url.Replace(offset, sizeof(kEscape22) - 1, '\"');
|
||||
url.SetCharAt('\"',offset);
|
||||
url.Cut(offset + 1, sizeof(kEscape22) - 2);
|
||||
}
|
||||
|
||||
// XXX At this point, the URL may be relative. 4.5 called into
|
||||
|
@ -1457,8 +1453,7 @@ BookmarkParser::ParseResource(nsIRDFResource *arc, nsString& url, nsIRDFNode** a
|
|||
// if we don't have a protocol scheme, add "http://" as a default scheme
|
||||
if (url.FindChar(PRUnichar(':')) < 0)
|
||||
{
|
||||
url.AssignLiteral("http://");
|
||||
url.Append(url);
|
||||
url.Assign(NS_LITERAL_STRING("http://") + url);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1483,9 +1478,9 @@ BookmarkParser::ParseLiteral(nsIRDFResource *arc, nsString& aValue, nsIRDFNode**
|
|||
{
|
||||
if (gCharsetAlias)
|
||||
{
|
||||
NS_LossyConvertUTF16toASCII charset(aValue);
|
||||
nsCAutoString charset; charset.AssignWithConversion(aValue);
|
||||
gCharsetAlias->GetPreferred(charset, charset);
|
||||
CopyASCIItoUTF16(charset, aValue);
|
||||
aValue.AssignWithConversion(charset.get());
|
||||
}
|
||||
}
|
||||
else if (arc == kWEB_LastPingETag)
|
||||
|
@ -1508,13 +1503,13 @@ BookmarkParser::ParseLiteral(nsIRDFResource *arc, nsString& aValue, nsIRDFNode**
|
|||
nsresult
|
||||
BookmarkParser::ParseDate(nsIRDFResource *arc, nsString& aValue, nsIRDFNode** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
*aResult = nsnull;
|
||||
|
||||
PRInt32 theDate = 0;
|
||||
if (!aValue.IsEmpty())
|
||||
{
|
||||
theDate = aValue.ToInteger(&rv); // ignored.
|
||||
PRInt32 err;
|
||||
theDate = aValue.ToInteger(&err); // ignored.
|
||||
}
|
||||
if (theDate == 0) return NS_RDF_NO_VALUE;
|
||||
|
||||
|
@ -1524,6 +1519,7 @@ BookmarkParser::ParseDate(nsIRDFResource *arc, nsString& aValue, nsIRDFNode** aR
|
|||
LL_I2L(million, PR_USEC_PER_SEC);
|
||||
LL_MUL(dateVal, temp, million);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFDate> result;
|
||||
if (NS_FAILED(rv = gRDF->GetDateLiteral(dateVal, getter_AddRefs(result))))
|
||||
{
|
||||
|
@ -1585,17 +1581,17 @@ BookmarkParser::ParseBookmarkSeparator(const nsString &aLine, const nsCOMPtr<nsI
|
|||
attrStart += sizeof(kSeparator)-1;
|
||||
|
||||
while((attrStart < lineLen) && (aLine[attrStart] != '>')) {
|
||||
while(NS_IsAsciiWhitespace(aLine[attrStart]))
|
||||
while(nsCRT::IsAsciiSpace(aLine[attrStart]))
|
||||
++attrStart;
|
||||
|
||||
if (Substring(aLine, attrStart, sizeof(kNameEqualsLC) - 1).LowerCaseEqualsLiteral(kNameEqualsLC)) {
|
||||
attrStart += sizeof(kNameEqualsLC) - 1;
|
||||
if (aLine.Find(kNameEquals, PR_TRUE, attrStart, 1) == attrStart) {
|
||||
attrStart += sizeof(kNameEquals) - 1;
|
||||
|
||||
// skip to terminating quote of string
|
||||
PRInt32 termQuote = aLine.FindChar(PRUnichar('\"'), attrStart);
|
||||
if (termQuote > attrStart) {
|
||||
nsAutoString name(Substring(aLine, attrStart,
|
||||
termQuote - attrStart));
|
||||
nsAutoString name;
|
||||
aLine.Mid(name, attrStart, termQuote - attrStart);
|
||||
attrStart = termQuote + 1;
|
||||
if (!name.IsEmpty()) {
|
||||
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
||||
|
@ -1781,7 +1777,8 @@ nsresult
|
|||
nsBookmarksService::getLocaleString(const char *key, nsString &str)
|
||||
{
|
||||
PRUnichar *keyUni = nsnull;
|
||||
NS_ConvertASCIItoUTF16 keyStr(key);
|
||||
nsAutoString keyStr;
|
||||
keyStr.AssignWithConversion(key);
|
||||
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
if (mBundle && (NS_SUCCEEDED(rv = mBundle->GetStringFromName(keyStr.get(), &keyUni)))
|
||||
|
@ -1848,14 +1845,16 @@ nsBookmarksService::ExamineBookmarkSchedule(nsIRDFResource *theBookmark, PRBool
|
|||
PRInt32 slashOffset;
|
||||
if ((slashOffset = schedule.FindChar(PRUnichar('|'))) >= 0)
|
||||
{
|
||||
nsAutoString daySection(StringTail(schedule, slashOffset));
|
||||
nsAutoString daySection;
|
||||
schedule.Left(daySection, slashOffset);
|
||||
schedule.Cut(0, slashOffset+1);
|
||||
if (daySection.Find(dayNum) >= 0)
|
||||
{
|
||||
// ok, we should be checking today. Within hour range?
|
||||
if ((slashOffset = schedule.FindChar(PRUnichar('|'))) >= 0)
|
||||
{
|
||||
nsAutoString hourRange(StringTail(schedule, slashOffset));
|
||||
nsAutoString hourRange;
|
||||
schedule.Left(hourRange, slashOffset);
|
||||
schedule.Cut(0, slashOffset+1);
|
||||
|
||||
// now have the "hour-range" segment of the string
|
||||
|
@ -1863,26 +1862,29 @@ nsBookmarksService::ExamineBookmarkSchedule(nsIRDFResource *theBookmark, PRBool
|
|||
PRInt32 dashOffset;
|
||||
if ((dashOffset = hourRange.FindChar(PRUnichar('-'))) >= 1)
|
||||
{
|
||||
nsAutoString endStr(StringTail(hourRange,
|
||||
hourRange.Length() - dashOffset - 1));
|
||||
nsAutoString startStr(StringHead(hourRange, dashOffset));
|
||||
nsAutoString startStr, endStr;
|
||||
|
||||
nsresult rv2;
|
||||
startHour = startStr.ToInteger(&rv2);
|
||||
if (NS_FAILED(rv2)) startHour = -1;
|
||||
endHour = endStr.ToInteger(&rv2);
|
||||
if (NS_FAILED(rv2)) endHour = -1;
|
||||
hourRange.Right(endStr, hourRange.Length() - dashOffset - 1);
|
||||
hourRange.Left(startStr, dashOffset);
|
||||
|
||||
PRInt32 errorCode2 = 0;
|
||||
startHour = startStr.ToInteger(&errorCode2);
|
||||
if (errorCode2) startHour = -1;
|
||||
endHour = endStr.ToInteger(&errorCode2);
|
||||
if (errorCode2) endHour = -1;
|
||||
|
||||
if ((startHour >=0) && (endHour >=0))
|
||||
{
|
||||
if ((slashOffset = schedule.FindChar(PRUnichar('|'))) >= 0)
|
||||
{
|
||||
nsAutoString durationStr(StringHead(schedule, slashOffset));
|
||||
nsAutoString durationStr;
|
||||
schedule.Left(durationStr, slashOffset);
|
||||
schedule.Cut(0, slashOffset+1);
|
||||
|
||||
// get duration
|
||||
duration = durationStr.ToInteger(&rv2);
|
||||
if (NS_FAILED(rv2)) duration = -1;
|
||||
PRInt32 errorCode = 0;
|
||||
duration = durationStr.ToInteger(&errorCode);
|
||||
if (errorCode) duration = -1;
|
||||
|
||||
// what's left is the notification options
|
||||
notificationMethod = schedule;
|
||||
|
@ -2167,7 +2169,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
currentETagLit->GetValueConst(¤tETagStr);
|
||||
if ((currentETagStr) &&
|
||||
!eTagValue.Equals(nsDependentString(currentETagStr),
|
||||
CaseInsensitiveCompare))
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
changedFlag = PR_TRUE;
|
||||
}
|
||||
|
@ -2213,7 +2215,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
currentLastModLit->GetValueConst(¤tLastModStr);
|
||||
if ((currentLastModStr) &&
|
||||
!lastModValue.Equals(nsDependentString(currentLastModStr),
|
||||
CaseInsensitiveCompare))
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
changedFlag = PR_TRUE;
|
||||
}
|
||||
|
@ -2257,7 +2259,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
currentContentLengthLit->GetValueConst(¤tContentLengthStr);
|
||||
if ((currentContentLengthStr) &&
|
||||
!contentLengthValue.Equals(nsDependentString(currentContentLengthStr),
|
||||
CaseInsensitiveCompare))
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
changedFlag = PR_TRUE;
|
||||
}
|
||||
|
@ -2333,7 +2335,9 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
}
|
||||
|
||||
// update icon?
|
||||
if (schedule.Find("icon", PR_TRUE) != -1)
|
||||
if (FindInReadable(NS_LITERAL_STRING("icon"),
|
||||
schedule,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
nsCOMPtr<nsIRDFLiteral> statusLiteral;
|
||||
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(NS_LITERAL_STRING("new").get(), getter_AddRefs(statusLiteral))))
|
||||
|
@ -2353,7 +2357,9 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
}
|
||||
|
||||
// play a sound?
|
||||
if (schedule.Find("sound", PR_TRUE))
|
||||
if (FindInReadable(NS_LITERAL_STRING("sound"),
|
||||
schedule,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
nsCOMPtr<nsISound> soundInterface = do_CreateInstance("@mozilla.org/sound;1", &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -2366,7 +2372,9 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
PRBool openURLFlag = PR_FALSE;
|
||||
|
||||
// show an alert?
|
||||
if (schedule.Find("alert", PR_TRUE))
|
||||
if (FindInReadable(NS_LITERAL_STRING("alert"),
|
||||
schedule,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
NS_QueryNotificationCallbacks(channel, prompter);
|
||||
|
@ -2439,7 +2447,9 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
|
||||
// open the URL in a new window?
|
||||
if ((openURLFlag == PR_TRUE) ||
|
||||
schedule.Find("open", PR_TRUE))
|
||||
FindInReadable(NS_LITERAL_STRING("open"),
|
||||
schedule,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -2483,12 +2493,12 @@ NS_IMETHODIMP nsBookmarksService::Observe(nsISupports *aSubject, const char *aTo
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!strcmp(aTopic, "profile-before-change"))
|
||||
if (!nsCRT::strcmp(aTopic, "profile-before-change"))
|
||||
{
|
||||
// The profile has not changed yet.
|
||||
rv = Flush();
|
||||
|
||||
if (!NS_strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get()))
|
||||
if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get()))
|
||||
{
|
||||
nsCOMPtr<nsIFile> bookmarksFile;
|
||||
|
||||
|
@ -2500,13 +2510,13 @@ NS_IMETHODIMP nsBookmarksService::Observe(nsISupports *aSubject, const char *aTo
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(aTopic, "profile-after-change"))
|
||||
else if (!nsCRT::strcmp(aTopic, "profile-after-change"))
|
||||
{
|
||||
// The profile has aleady changed.
|
||||
rv = LoadBookmarks();
|
||||
}
|
||||
#ifdef MOZ_PHOENIX
|
||||
else if (!strcmp(aTopic, "quit-application"))
|
||||
else if (!nsCRT::strcmp(aTopic, "quit-application"))
|
||||
{
|
||||
rv = Flush();
|
||||
}
|
||||
|
@ -3481,7 +3491,7 @@ nsBookmarksService::RequestCharset(nsIWebNavigation* aWebNavigation,
|
|||
if (charsetLiteral) {
|
||||
const PRUnichar *charset;
|
||||
charsetLiteral->GetValueConst(&charset);
|
||||
LossyCopyUTF16toASCII(nsDependentString(charset), aResult);
|
||||
LossyCopyUTF16toASCII(charset, aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3694,7 +3704,7 @@ nsBookmarksService::GetLastModifiedFolders(nsISimpleEnumerator **aResult)
|
|||
NS_IMETHODIMP
|
||||
nsBookmarksService::GetURI(char* *aURI)
|
||||
{
|
||||
*aURI = NS_strdup("rdf:bookmarks");
|
||||
*aURI = nsCRT::strdup("rdf:bookmarks");
|
||||
if (! *aURI)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -4267,7 +4277,7 @@ nsBookmarksService::exportBookmarks(nsISupportsArray *aArguments)
|
|||
rv = NS_NewLocalFile(nsDependentString(pathUni), PR_TRUE, getter_AddRefs(file));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (format && NS_LITERAL_STRING("RDF").Equals(format, CaseInsensitiveCompare))
|
||||
if (format && NS_LITERAL_STRING("RDF").Equals(format, nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewFileURI(getter_AddRefs(uri), file);
|
||||
|
@ -4626,13 +4636,13 @@ nsBookmarksService::InitDataSource()
|
|||
|
||||
// create livemark bookmarks
|
||||
{
|
||||
nsString lmloadingName;
|
||||
nsXPIDLString lmloadingName;
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("BookmarksLivemarkLoading").get(), getter_Copies(lmloadingName));
|
||||
if (NS_FAILED(rv)) {
|
||||
lmloadingName.Assign(NS_LITERAL_STRING("Live Bookmark loading..."));
|
||||
}
|
||||
|
||||
nsString lmfailedName;
|
||||
nsXPIDLString lmfailedName;
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("BookmarksLivemarkFailed").get(), getter_Copies(lmfailedName));
|
||||
if (NS_FAILED(rv)) {
|
||||
lmfailedName.Assign(NS_LITERAL_STRING("Live Bookmark feed failed to load."));
|
||||
|
@ -4805,7 +4815,7 @@ nsBookmarksService::LoadBookmarks()
|
|||
}
|
||||
|
||||
// Sets the default bookmarks root name.
|
||||
nsString brName;
|
||||
nsXPIDLString brName;
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("BookmarksRoot").get(), getter_Copies(brName));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// remove any previous NC_Name assertion
|
||||
|
@ -5140,53 +5150,6 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape HTML-special characters in a string.
|
||||
*/
|
||||
static void
|
||||
EscapeHTML(nsACString &data)
|
||||
{
|
||||
const char *begin, *end;
|
||||
PRUint32 len = data.BeginReading(&begin, &end);
|
||||
|
||||
for (PRUint32 pos = 0; pos < len; ++pos) {
|
||||
PRUint32 longer;
|
||||
|
||||
switch (begin[pos]) {
|
||||
case '<':
|
||||
data.Replace(pos, 1, "<");
|
||||
longer = 3;
|
||||
break;
|
||||
|
||||
case '>':
|
||||
data.Replace(pos, 1, ">");
|
||||
longer = 3;
|
||||
break;
|
||||
|
||||
case '&':
|
||||
data.Replace(pos, 1, "&");
|
||||
longer = 4;
|
||||
break;
|
||||
|
||||
case '"':
|
||||
data.Replace(pos, 1, """);
|
||||
longer = 5;
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
data.Replace(pos, 1, "'");
|
||||
longer = 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
pos += longer;
|
||||
len = data.BeginReading(&begin, &end);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBookmarksService::WriteBookmarkIdAndName(nsIRDFDataSource *aDs,
|
||||
nsIOutputStream* aStrm, nsIRDFResource* aChild)
|
||||
|
@ -5197,15 +5160,19 @@ nsBookmarksService::WriteBookmarkIdAndName(nsIRDFDataSource *aDs,
|
|||
// output ID
|
||||
// <A ... ID="rdf:#$Rd48+1">Name</A>
|
||||
// ^^^^^^^^^^^^^^^^^^
|
||||
nsCString id;
|
||||
rv = aChild->GetValueUTF8(id);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
const char *id = nsnull;
|
||||
rv = aChild->GetValueConst(&id);
|
||||
if (NS_SUCCEEDED(rv) && (id))
|
||||
{
|
||||
EscapeHTML(id);
|
||||
rv |= aStrm->Write(kSpaceStr, sizeof(kSpaceStr)-1, &dummy);
|
||||
rv |= aStrm->Write(kIDEquals, sizeof(kIDEquals)-1, &dummy);
|
||||
rv |= aStrm->Write(id.get(), id.Length(), &dummy);
|
||||
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
|
||||
char *escapedID = nsEscapeHTML(id);
|
||||
if (escapedID)
|
||||
{
|
||||
rv |= aStrm->Write(kSpaceStr, sizeof(kSpaceStr)-1, &dummy);
|
||||
rv |= aStrm->Write(kIDEquals, sizeof(kIDEquals)-1, &dummy);
|
||||
rv |= aStrm->Write(escapedID, strlen(escapedID), &dummy);
|
||||
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
|
||||
NS_Free(escapedID);
|
||||
}
|
||||
}
|
||||
|
||||
// <A ... ID="rdf:#$Rd48+1">Name</A>
|
||||
|
@ -5232,8 +5199,12 @@ nsBookmarksService::WriteBookmarkIdAndName(nsIRDFDataSource *aDs,
|
|||
return NS_OK;
|
||||
|
||||
// see bug #65098
|
||||
EscapeHTML(name);
|
||||
rv = aStrm->Write(name.get(), name.Length(), &dummy);
|
||||
char *escapedAttrib = nsEscapeHTML(name.get());
|
||||
if (escapedAttrib)
|
||||
{
|
||||
rv = aStrm->Write(escapedAttrib, strlen(escapedAttrib), &dummy);
|
||||
NS_Free(escapedAttrib);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -5261,38 +5232,48 @@ nsBookmarksService::WriteBookmarkProperties(nsIRDFDataSource *aDs,
|
|||
}
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 attribute(literalString);
|
||||
if (aIsFirst == PR_FALSE)
|
||||
char *attribute = ToNewUTF8String(literalString);
|
||||
if (nsnull != attribute)
|
||||
{
|
||||
rv |= aStrm->Write(kSpaceStr, sizeof(kSpaceStr)-1, &dummy);
|
||||
}
|
||||
|
||||
if (!literalString.IsEmpty())
|
||||
{
|
||||
// We don't HTML-escape URL properties (we instead
|
||||
// URL-escape double-quotes in them--see above) so that
|
||||
// URLs with ampersands don't break if the user switches
|
||||
// back to a build from before we started escaping.
|
||||
if (aProperty == kNC_URL || aProperty == kNC_FeedURL)
|
||||
if (aIsFirst == PR_FALSE)
|
||||
{
|
||||
rv |= aStrm->Write(aHtmlAttrib, strlen(aHtmlAttrib), &dummy);
|
||||
rv |= aStrm->Write(attribute.get(), attribute.Length(), &dummy);
|
||||
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
|
||||
rv |= aStrm->Write(kSpaceStr, sizeof(kSpaceStr)-1, &dummy);
|
||||
}
|
||||
else
|
||||
|
||||
if (!literalString.IsEmpty())
|
||||
{
|
||||
EscapeHTML(attribute);
|
||||
rv |= aStrm->Write(aHtmlAttrib, strlen(aHtmlAttrib), &dummy);
|
||||
rv |= aStrm->Write(attribute.get(), attribute.Length(), &dummy);
|
||||
if (aProperty == kNC_Description)
|
||||
// We don't HTML-escape URL properties (we instead
|
||||
// URL-escape double-quotes in them--see above) so that
|
||||
// URLs with ampersands don't break if the user switches
|
||||
// back to a build from before we started escaping.
|
||||
if (aProperty == kNC_URL || aProperty == kNC_FeedURL)
|
||||
{
|
||||
rv |= aStrm->Write(kNL, sizeof(kNL)-1, &dummy);
|
||||
rv |= aStrm->Write(aHtmlAttrib, strlen(aHtmlAttrib), &dummy);
|
||||
rv |= aStrm->Write(attribute, strlen(attribute), &dummy);
|
||||
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
|
||||
char *escapedAttrib = nsEscapeHTML(attribute);
|
||||
if (escapedAttrib)
|
||||
{
|
||||
rv |= aStrm->Write(aHtmlAttrib, strlen(aHtmlAttrib), &dummy);
|
||||
rv |= aStrm->Write(escapedAttrib, strlen(escapedAttrib), &dummy);
|
||||
if (aProperty == kNC_Description)
|
||||
{
|
||||
rv |= aStrm->Write(kNL, sizeof(kNL)-1, &dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
|
||||
}
|
||||
NS_Free(escapedAttrib);
|
||||
escapedAttrib = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_Free(attribute);
|
||||
attribute = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5363,7 +5344,7 @@ nsBookmarksService::GetTextForNode(nsIRDFNode* aNode, nsString& aResult)
|
|||
const char *p = nsnull;
|
||||
if (NS_SUCCEEDED(rv = resource->GetValueConst( &p )) && (p))
|
||||
{
|
||||
CopyASCIItoUTF16(nsDependentCString(p), aResult);
|
||||
aResult.AssignWithConversion(p);
|
||||
}
|
||||
NS_RELEASE(resource);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "nsITimer.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsIBookmarksService.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
@ -88,7 +88,7 @@ protected:
|
|||
|
||||
PRUint32 htmlSize;
|
||||
PRInt32 mUpdateBatchNest;
|
||||
nsString mPersonalToolbarName;
|
||||
nsXPIDLString mPersonalToolbarName;
|
||||
PRBool mBookmarksAvailable;
|
||||
PRBool mDirty;
|
||||
PRBool mBrowserIcons;
|
||||
|
|
|
@ -45,22 +45,25 @@
|
|||
#include "nsIRDFObserver.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "rdf.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsEnumeratorUtils.h"
|
||||
|
||||
#include "nsForwardProxyDataSource.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
nsresult
|
||||
nsForwardProxyDataSource::Init(void)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// do we need to initialize our globals?
|
||||
nsCOMPtr<nsIRDFService> rdf = do_GetService("@mozilla.org/rdf/rdf-service;1");
|
||||
nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID);
|
||||
if (!rdf) {
|
||||
NS_WARNING ("unable to get RDF service");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -204,7 +207,7 @@ nsForwardProxyDataSource::GetURI(char* *uri)
|
|||
|
||||
nsCAutoString theURI(NS_LITERAL_CSTRING("x-rdf-infer:forward-proxy"));
|
||||
|
||||
nsCString dsURI;
|
||||
nsXPIDLCString dsURI;
|
||||
rv = mDS->GetURI(getter_Copies(dsURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -213,9 +216,9 @@ nsForwardProxyDataSource::GetURI(char* *uri)
|
|||
theURI += dsURI;
|
||||
}
|
||||
|
||||
*uri = ToNewCString(theURI);
|
||||
if (*uri == nsnull)
|
||||
if ((*uri = nsCRT::strdup(theURI.get())) == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,10 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = browsercomps
|
||||
LIBRARY_NAME = browsercomps
|
||||
SHORT_LIBNAME = brwsrcmp
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsBrowserCompsModule
|
||||
FORCE_SHARED_LIB = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = \
|
||||
docshell \
|
||||
|
@ -74,12 +75,17 @@ LOCAL_INCLUDES += -I$(srcdir)/../safebrowsing/src
|
|||
SHARED_LIBRARY_LIBS += ../safebrowsing/src/$(LIB_PREFIX)safebrowsing_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
# Link to gkgfx for GNOME shell service
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
|
||||
EXTRA_DSO_LIBS += gkgfx
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
|
||||
$(LIBS_DIR) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ SHORT_LIBNAME = brwsrdir
|
|||
endif
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = BrowserDirProvider
|
||||
FORCE_SHARED_LIB = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
|
@ -60,9 +61,6 @@ REQUIRES = \
|
|||
|
||||
CPPSRCS = nsBrowserDirectoryProvider.cpp
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(XPCOM_GLUE_LDOPTS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
EXTRA_DSO_LDOPTS = $(MOZ_COMPONENT_LIBS)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -48,12 +48,9 @@
|
|||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsCategoryManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
class nsBrowserDirectoryProvider :
|
||||
|
@ -121,7 +118,7 @@ nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
|
|||
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefs) {
|
||||
nsCString path;
|
||||
nsXPIDLCString path;
|
||||
rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_NewNativeLocalFile(path, PR_TRUE, (nsILocalFile**)(nsIFile**) getter_AddRefs(file));
|
||||
|
|
|
@ -43,8 +43,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = browser_feeds
|
||||
LIBRARY_NAME = browser_feeds_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
|
||||
EXTRA_PP_COMPONENTS = \
|
||||
FeedConverter.js \
|
||||
|
@ -58,4 +56,8 @@ CPPSRCS = nsFeedSniffer.cpp nsAboutFeeds.cpp
|
|||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../../build
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -43,14 +43,13 @@
|
|||
#include "nsNetCID.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringStream.h"
|
||||
|
||||
#include "nsBrowserCompsCID.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsIStreamConverter.h"
|
||||
|
@ -99,12 +98,9 @@ nsFeedSniffer::ConvertEncodedData(nsIRequest* request,
|
|||
|
||||
converter->OnStartRequest(request, nsnull);
|
||||
|
||||
nsCOMPtr<nsIStringInputStream> rawStream =
|
||||
do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID);
|
||||
if (!rawStream)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = rawStream->SetData((const char*)data, length);
|
||||
nsCOMPtr<nsIInputStream> rawStream;
|
||||
rv = NS_NewByteInputStream(getter_AddRefs(rawStream),
|
||||
(const char*)data, length);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = converter->OnDataAvailable(request, nsnull, rawStream, 0, length);
|
||||
|
@ -116,14 +112,6 @@ nsFeedSniffer::ConvertEncodedData(nsIRequest* request,
|
|||
return rv;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
static PRBool
|
||||
StringBeginsWithLowercaseLiteral(nsAString& aString,
|
||||
const char (&aSubstring)[N])
|
||||
{
|
||||
return StringHead(aString, N).LowerCaseEqualsLiteral(aSubstring);
|
||||
}
|
||||
|
||||
// XXXsayrer put this in here to get on the branch with minimal delay.
|
||||
// Trunk really needs to factor this out. This is the third usage.
|
||||
PRBool
|
||||
|
@ -160,13 +148,13 @@ HasAttachmentDisposition(nsIHttpChannel* httpChannel)
|
|||
// Content-Disposition: ; filename="file"
|
||||
// screen those out here.
|
||||
!dispToken.IsEmpty() &&
|
||||
!StringBeginsWithLowercaseLiteral(dispToken, "inline") &&
|
||||
// Broken sites just send
|
||||
// Content-Disposition: filename="file"
|
||||
// without a disposition token... screen those out.
|
||||
!StringBeginsWithLowercaseLiteral(dispToken, "filename")) &&
|
||||
!dispToken.LowerCaseEqualsLiteral("inline") &&
|
||||
// Broken sites just send
|
||||
// Content-Disposition: filename="file"
|
||||
// without a disposition token... screen those out.
|
||||
!dispToken.EqualsIgnoreCase("filename", 8)) &&
|
||||
// Also in use is Content-Disposition: name="file"
|
||||
!StringBeginsWithLowercaseLiteral(dispToken, "name"))
|
||||
!dispToken.EqualsIgnoreCase("name", 4))
|
||||
// We have a content-disposition of "attachment" or unknown
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -175,20 +163,6 @@ HasAttachmentDisposition(nsIHttpChannel* httpChannel)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first occurrence of a character within a string buffer,
|
||||
* or nsnull if not found
|
||||
*/
|
||||
static const char*
|
||||
FindChar(char c, const char *begin, const char *end)
|
||||
{
|
||||
for (; begin < end; ++begin) {
|
||||
if (*begin == c)
|
||||
return begin;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Determine if a substring is the "documentElement" in the document.
|
||||
|
@ -199,38 +173,54 @@ FindChar(char c, const char *begin, const char *end)
|
|||
* another type, e.g. a HTML document, and we don't want to show the preview
|
||||
* page if the document isn't actually a feed.
|
||||
*
|
||||
* @param start
|
||||
* The beginning of the data being sniffed
|
||||
* @param end
|
||||
* The end of the data being sniffed, right before the substring that
|
||||
* was found.
|
||||
* @returns PR_TRUE if the found substring is the documentElement, PR_FALSE
|
||||
* @param dataString
|
||||
* The data being sniffed
|
||||
* @param substring
|
||||
* The substring being tested for document-element-ness
|
||||
* @param indicator
|
||||
* An iterator initialized to the end of |substring|, located in
|
||||
* |dataString|
|
||||
* @returns PR_TRUE if the substring is the documentElement, PR_FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
static PRBool
|
||||
IsDocumentElement(const char *start, const char* end)
|
||||
IsDocumentElement(nsACString& dataString, const nsACString& substring,
|
||||
nsACString::const_iterator& indicator)
|
||||
{
|
||||
nsACString::const_iterator start, end, endOfString;
|
||||
|
||||
dataString.BeginReading(start);
|
||||
endOfString = end = indicator;
|
||||
|
||||
// For every tag in the buffer, check to see if it's a PI, Doctype or
|
||||
// comment, our desired substring or something invalid.
|
||||
while ( (start = FindChar('<', start, end)) ) {
|
||||
while (FindCharInReadable('<', start, end)) {
|
||||
++start;
|
||||
if (start >= end)
|
||||
if (start == endOfString)
|
||||
return PR_FALSE;
|
||||
|
||||
// Check to see if the character following the '<' is either '?' or '!'
|
||||
// (processing instruction or doctype or comment)... these are valid nodes
|
||||
// to have in the prologue.
|
||||
if (*start != '?' && *start != '!')
|
||||
return PR_FALSE;
|
||||
if (*start != '?' && *start != '!') {
|
||||
// Check to see if the string following the '<' is our indicator substring.
|
||||
// If it's not, it's an indication that the indicator substring was
|
||||
// embedded in some other kind of document, e.g. HTML.
|
||||
return substring.Equals(Substring(--start, indicator));
|
||||
}
|
||||
|
||||
// Reset end so we can re-scan the entire remaining section of the
|
||||
// string, and advance start so we don't loop infinitely.
|
||||
dataString.EndReading(end);
|
||||
|
||||
// Now advance the iterator until the '>' (We do this because we don't want
|
||||
// to sniff indicator substrings that are embedded within other nodes, e.g.
|
||||
// comments: <!-- <rdf:RDF .. > -->
|
||||
start = FindChar('>', start, end);
|
||||
if (!start)
|
||||
if (!FindCharInReadable('>', start, end))
|
||||
return PR_FALSE;
|
||||
|
||||
++start;
|
||||
|
||||
// Reset end again
|
||||
dataString.EndReading(end);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -246,16 +236,17 @@ IsDocumentElement(const char *start, const char* end)
|
|||
* otherwise.
|
||||
*/
|
||||
static PRBool
|
||||
ContainsTopLevelSubstring(nsACString& dataString, const char *substring)
|
||||
ContainsTopLevelSubstring(nsACString& dataString, const nsACString& substring)
|
||||
{
|
||||
PRInt32 offset = dataString.Find(substring);
|
||||
if (offset == -1)
|
||||
return PR_FALSE;
|
||||
nsACString::const_iterator start, end;
|
||||
|
||||
const char *begin = dataString.BeginReading();
|
||||
dataString.BeginReading(start);
|
||||
dataString.EndReading(end);
|
||||
|
||||
// Only do the validation when we find the substring.
|
||||
return IsDocumentElement(begin, begin + offset);
|
||||
PRBool isFeed = FindInReadable(substring, start, end);
|
||||
|
||||
// Only do the validation when we find the substring.
|
||||
return isFeed ? IsDocumentElement(dataString, substring, end) : isFeed;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -332,22 +323,32 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request,
|
|||
length = MAX_BYTES;
|
||||
|
||||
// Thus begins the actual sniffing.
|
||||
nsDependentCSubstring dataString((const char*)testData, length);
|
||||
nsDependentCSubstring dataString((const char*)testData,
|
||||
(const char*)testData + length);
|
||||
nsACString::const_iterator start_iter, end_iter;
|
||||
|
||||
PRBool isFeed = PR_FALSE;
|
||||
|
||||
// RSS 0.91/0.92/2.0
|
||||
isFeed = ContainsTopLevelSubstring(dataString, "<rss");
|
||||
isFeed = ContainsTopLevelSubstring(dataString, NS_LITERAL_CSTRING("<rss"));
|
||||
|
||||
// Atom 1.0
|
||||
if (!isFeed)
|
||||
isFeed = ContainsTopLevelSubstring(dataString, "<feed");
|
||||
isFeed = ContainsTopLevelSubstring(dataString, NS_LITERAL_CSTRING("<feed"));
|
||||
|
||||
// RSS 1.0
|
||||
if (!isFeed) {
|
||||
isFeed = ContainsTopLevelSubstring(dataString, "<rdf:RDF") &&
|
||||
dataString.Find(NS_RDF) &&
|
||||
dataString.Find(NS_RSS);
|
||||
isFeed = ContainsTopLevelSubstring(dataString, NS_LITERAL_CSTRING("<rdf:RDF"));
|
||||
if (isFeed) {
|
||||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING(NS_RDF), start_iter, end_iter);
|
||||
if (isFeed) {
|
||||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING(NS_RSS), start_iter, end_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we sniffed a feed, coerce our internal type
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "nsIGenericFactory.h"
|
||||
#include "nsIContentSniffer.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsFeedSniffer : public nsIContentSniffer, nsIStreamListener
|
||||
{
|
||||
|
|
|
@ -43,8 +43,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = migration
|
||||
LIBRARY_NAME = migration_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
|
@ -64,7 +63,7 @@ REQUIRES = \
|
|||
docshell \
|
||||
xulapp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
ifdef MOZ_PLACES
|
||||
REQUIRES += places
|
||||
endif
|
||||
|
@ -103,5 +102,9 @@ CPPSRCS += nsSafariProfileMigrator.cpp \
|
|||
$(NULL)
|
||||
endif
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -95,10 +95,9 @@ void SetProxyPref(const nsAString& aHostPort, const char* aPref,
|
|||
if (portDelimOffset > 0) {
|
||||
SetUnicharPref(aPref, Substring(hostPort, 0, portDelimOffset), aPrefs);
|
||||
nsAutoString port(Substring(hostPort, portDelimOffset + 1));
|
||||
nsresult stringErr;
|
||||
PRInt32 stringErr;
|
||||
portValue = port.ToInteger(&stringErr);
|
||||
if (NS_SUCCEEDED(stringErr))
|
||||
aPrefs->SetIntPref(aPortPref, portValue);
|
||||
aPrefs->SetIntPref(aPortPref, portValue);
|
||||
}
|
||||
else
|
||||
SetUnicharPref(aPref, hostPort, aPrefs);
|
||||
|
@ -268,11 +267,11 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
|
|||
rv = bundleService->CreateBundle(MIGRATION_BUNDLE, getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString sourceName;
|
||||
nsXPIDLString sourceName;
|
||||
bundle->GetStringFromName(aImportSourceNameKey, getter_Copies(sourceName));
|
||||
|
||||
const PRUnichar* sourceNameStrings[] = { sourceName.get() };
|
||||
nsString importedBookmarksTitle;
|
||||
nsXPIDLString importedBookmarksTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
|
||||
sourceNameStrings, 1,
|
||||
getter_Copies(importedBookmarksTitle));
|
||||
|
|
|
@ -60,9 +60,7 @@
|
|||
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsString.h"
|
||||
class nsIProfileStartup;
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsCaminoProfileMigrator
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsCaminoProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
|
@ -58,4 +58,4 @@ private:
|
|||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsDogbertProfileMigrator.h"
|
||||
#include "nsICookieManager2.h"
|
||||
#include "nsIFile.h"
|
||||
|
@ -52,12 +53,12 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "prprf.h"
|
||||
#include "prenv.h"
|
||||
#include "nsEscape.h"
|
||||
#include "NSReg.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef _MAX_PATH
|
||||
|
@ -288,7 +289,7 @@ nsDogbertProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
|||
if (!mProfiles) {
|
||||
nsresult rv;
|
||||
|
||||
mProfiles = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mProfiles));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> regFile;
|
||||
|
@ -360,7 +361,7 @@ nsDogbertProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
|||
|
||||
mSourceProfile = profileFile;
|
||||
|
||||
mProfiles = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mProfiles));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupportsString> nameString
|
||||
|
@ -565,7 +566,7 @@ nsDogbertProfileMigrator::FixDogbertCookies()
|
|||
|
||||
// skip line if it is a comment or null line
|
||||
if (buffer.IsEmpty() || buffer.CharAt(0) == '#' ||
|
||||
buffer.CharAt(0) == '\r' || buffer.CharAt(0) == '\n') {
|
||||
buffer.CharAt(0) == nsCRT::CR || buffer.CharAt(0) == nsCRT::LF) {
|
||||
fileOutputStream->Write(buffer.get(), buffer.Length(), &written);
|
||||
continue;
|
||||
}
|
||||
|
@ -582,12 +583,10 @@ nsDogbertProfileMigrator::FixDogbertCookies()
|
|||
continue;
|
||||
|
||||
// separate the expires field from the rest of the cookie line
|
||||
const nsDependentCSubstring prefix =
|
||||
Substring(buffer, hostIndex, expiresIndex-hostIndex-1);
|
||||
const nsDependentCSubstring expiresString =
|
||||
Substring(buffer, expiresIndex, nameIndex-expiresIndex-1);
|
||||
const nsDependentCSubstring suffix =
|
||||
Substring(buffer, nameIndex, buffer.Length()-nameIndex);
|
||||
nsCAutoString prefix, expiresString, suffix;
|
||||
buffer.Mid(prefix, hostIndex, expiresIndex-hostIndex-1);
|
||||
buffer.Mid(expiresString, expiresIndex, nameIndex-expiresIndex-1);
|
||||
buffer.Mid(suffix, nameIndex, buffer.Length()-nameIndex);
|
||||
|
||||
// correct the expires field
|
||||
char* expiresCString = ToNewCString(expiresString);
|
||||
|
@ -644,7 +643,7 @@ nsDogbertProfileMigrator::MigrateDogbertBookmarks()
|
|||
dogbertPrefsFile->Append(PREF_FILE_NAME_IN_4x);
|
||||
psvc->ReadUserPrefs(dogbertPrefsFile);
|
||||
|
||||
nsCString toolbarName;
|
||||
nsXPIDLCString toolbarName;
|
||||
nsCOMPtr<nsIPrefBranch> branch(do_QueryInterface(psvc));
|
||||
rv = branch->GetCharPref("custtoolbar.personal_toolbar_folder", getter_Copies(toolbarName));
|
||||
// If the pref wasn't set in the user's 4.x preferences, there's no way we can "Fix" the
|
||||
|
@ -664,5 +663,5 @@ nsDogbertProfileMigrator::MigrateDogbertBookmarks()
|
|||
targetBookmarksFile->Append(BOOKMARKS_FILE_NAME_IN_5x);
|
||||
|
||||
return AnnotatePersonalToolbarFolder(sourceBookmarksFile,
|
||||
targetBookmarksFile, toolbarName.get());
|
||||
targetBookmarksFile, toolbarName);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsNetscapeProfileMigratorBase.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#define NEED_TO_FIX_4X_COOKIES 1
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsICabProfileMigrator
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsICabProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
|
@ -58,4 +58,4 @@ private:
|
|||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -45,13 +45,12 @@
|
|||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCRTGlue.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsDependentString.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "plstr.h"
|
||||
#include "prio.h"
|
||||
#include "prmem.h"
|
||||
|
@ -92,6 +91,7 @@
|
|||
#include "nsIBookmarksService.h"
|
||||
#endif
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
@ -873,7 +873,7 @@ nsIEProfileMigrator::MigrateSiteAuthSignons(IPStore* aPStore)
|
|||
}
|
||||
|
||||
nsAutoString tmp(itemName);
|
||||
tmp.SetLength(6);
|
||||
tmp.Truncate(6);
|
||||
if (tmp.Equals(NS_LITERAL_STRING("DPAPI:"))) // often FTP logins
|
||||
password = NULL; // We can't handle these yet
|
||||
|
||||
|
@ -916,8 +916,9 @@ nsIEProfileMigrator::GetSignonsListFromPStore(IPStore* aPStore, nsVoidArray* aSi
|
|||
hr = aPStore->ReadItem(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, itemName, &count, &data, NULL, 0);
|
||||
if (SUCCEEDED(hr) && data) {
|
||||
nsAutoString itemNameString(itemName);
|
||||
if (StringTail(itemNameString, 11).
|
||||
LowerCaseEqualsLiteral(":stringdata")) {
|
||||
nsAutoString suffix;
|
||||
itemNameString.Right(suffix, 11);
|
||||
if (suffix.EqualsIgnoreCase(":StringData")) {
|
||||
// :StringData contains the saved data
|
||||
const nsAString& key = Substring(itemNameString, 0, itemNameString.Length() - 11);
|
||||
char* realm = nsnull;
|
||||
|
@ -972,7 +973,7 @@ nsIEProfileMigrator::KeyIsURI(const nsAString& aKey, char** aRealm)
|
|||
uri->GetHost(host);
|
||||
realm.Append(host);
|
||||
|
||||
*aRealm = ToNewCString(realm);
|
||||
*aRealm = nsCRT::strdup(realm.get());
|
||||
return validScheme;
|
||||
}
|
||||
}
|
||||
|
@ -995,14 +996,15 @@ nsIEProfileMigrator::ResolveAndMigrateSignons(IPStore* aPStore, nsVoidArray* aSi
|
|||
hr = aPStore->ReadItem(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, itemName, &count, &data, NULL, 0);
|
||||
if (SUCCEEDED(hr) && data) {
|
||||
nsAutoString itemNameString(itemName);
|
||||
if (StringTail(itemNameString, 11).
|
||||
LowerCaseEqualsLiteral(":stringdata")) {
|
||||
nsAutoString suffix;
|
||||
itemNameString.Right(suffix, 11);
|
||||
if (suffix.EqualsIgnoreCase(":StringData")) {
|
||||
// :StringData contains the saved data
|
||||
const nsAString& key = Substring(itemNameString, 0, itemNameString.Length() - 11);
|
||||
|
||||
// Assume all keys that are valid URIs are signons, not saved form data, and that
|
||||
// all keys that aren't valid URIs are form field names (containing form data).
|
||||
nsCString realm;
|
||||
nsXPIDLCString realm;
|
||||
if (!KeyIsURI(key, getter_Copies(realm))) {
|
||||
// Search the data for a username that matches one of the found signons.
|
||||
EnumerateUsernames(key, (PRUnichar*)data, (count/sizeof(PRUnichar)), aSignonsFound);
|
||||
|
@ -1019,7 +1021,7 @@ nsIEProfileMigrator::ResolveAndMigrateSignons(IPStore* aPStore, nsVoidArray* aSi
|
|||
for (PRInt32 i = 0; i < signonCount; ++i) {
|
||||
SignonData* sd = (SignonData*)aSignonsFound->ElementAt(i);
|
||||
::CoTaskMemFree(sd->user); // |sd->user| is a pointer to the start of a buffer that also contains sd->pass
|
||||
NS_Free(sd->realm);
|
||||
nsCRT::free(sd->realm);
|
||||
delete sd;
|
||||
}
|
||||
}
|
||||
|
@ -1122,11 +1124,12 @@ nsIEProfileMigrator::CopyFormData(PRBool aReplace)
|
|||
hr = PStore->ReadItem(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, itemName, &count, &data, NULL, 0);
|
||||
if (SUCCEEDED(hr) && data) {
|
||||
nsAutoString itemNameString(itemName);
|
||||
if (StringTail(itemNameString, 11).
|
||||
LowerCaseEqualsLiteral(":stringdata")) {
|
||||
nsAutoString suffix;
|
||||
itemNameString.Right(suffix, 11);
|
||||
if (suffix.EqualsIgnoreCase(":StringData")) {
|
||||
// :StringData contains the saved data
|
||||
const nsAString& key = Substring(itemNameString, 0, itemNameString.Length() - 11);
|
||||
nsCString realm;
|
||||
nsXPIDLCString realm;
|
||||
if (!KeyIsURI(key, getter_Copies(realm))) {
|
||||
nsresult rv = AddDataToFormHistory(key, (PRUnichar*)data, (count/sizeof(PRUnichar)));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1205,12 +1208,12 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
|
|||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle(TRIDENTPROFILE_BUNDLE, getter_AddRefs(bundle));
|
||||
|
||||
nsString sourceNameIE;
|
||||
nsXPIDLString sourceNameIE;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("sourceNameIE").get(),
|
||||
getter_Copies(sourceNameIE));
|
||||
|
||||
const PRUnichar* sourceNameStrings[] = { sourceNameIE.get() };
|
||||
nsString importedIEFavsTitle;
|
||||
nsXPIDLString importedIEFavsTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
|
||||
sourceNameStrings, 1, getter_Copies(importedIEFavsTitle));
|
||||
|
||||
|
@ -1277,7 +1280,7 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
|
|||
nsresult rv;
|
||||
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRInt64 keywordsFolder = 0;
|
||||
PRInt64 keywordsFolder;
|
||||
#else
|
||||
nsCOMPtr<nsIBookmarksService> bms(do_GetService("@mozilla.org/browser/bookmarks-service;1"));
|
||||
nsCOMPtr<nsIRDFResource> keywordsFolder, bookmark;
|
||||
|
@ -1296,12 +1299,12 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
|
|||
break;
|
||||
|
||||
if (!keywordsFolder) {
|
||||
nsString sourceNameIE;
|
||||
nsXPIDLString sourceNameIE;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("sourceNameIE").get(),
|
||||
getter_Copies(sourceNameIE));
|
||||
|
||||
const PRUnichar* sourceNameStrings[] = { sourceNameIE.get() };
|
||||
nsString importedIESearchUrlsTitle;
|
||||
nsXPIDLString importedIESearchUrlsTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchURLsFolder").get(),
|
||||
sourceNameStrings, 1, getter_Copies(importedIESearchUrlsTitle));
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
|
@ -1334,13 +1337,13 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
|
|||
NS_ConvertUTF8toUTF16 host(hostCStr);
|
||||
|
||||
const PRUnichar* nameStrings[] = { host.get() };
|
||||
nsString keywordName;
|
||||
nsXPIDLString keywordName;
|
||||
nsresult rv = bundle->FormatStringFromName(
|
||||
NS_LITERAL_STRING("importedSearchURLsTitle").get(),
|
||||
nameStrings, 1, getter_Copies(keywordName));
|
||||
|
||||
const PRUnichar* descStrings[] = { keyName.get(), host.get() };
|
||||
nsString keywordDesc;
|
||||
nsXPIDLString keywordDesc;
|
||||
rv = bundle->FormatStringFromName(
|
||||
NS_LITERAL_STRING("importedSearchUrlDesc").get(),
|
||||
descStrings, 2, getter_Copies(keywordDesc));
|
||||
|
@ -1366,7 +1369,7 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
|
|||
}
|
||||
|
||||
void
|
||||
nsIEProfileMigrator::ResolveShortcut(const nsString &aFileName, char** aOutURL)
|
||||
nsIEProfileMigrator::ResolveShortcut(const nsAFlatString &aFileName, char** aOutURL)
|
||||
{
|
||||
HRESULT result;
|
||||
|
||||
|
@ -1460,8 +1463,8 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
|
|||
NS_NAMED_LITERAL_STRING(lnkExt, ".lnk");
|
||||
PRInt32 lnkExtStart = bookmarkName.Length() - lnkExt.Length();
|
||||
if (StringEndsWith(bookmarkName, lnkExt,
|
||||
CaseInsensitiveCompare))
|
||||
bookmarkName.SetLength(lnkExtStart);
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
bookmarkName.Truncate(lnkExtStart);
|
||||
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
nsCOMPtr<nsIURI> bookmarkURI;
|
||||
|
@ -1554,7 +1557,8 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
|
|||
nsCAutoString extension;
|
||||
|
||||
url->GetFileExtension(extension);
|
||||
if (!extension.Equals("url", CaseInsensitiveCompare))
|
||||
if (!extension.Equals(NS_LITERAL_CSTRING("url"),
|
||||
nsCaseInsensitiveCStringComparator()))
|
||||
continue;
|
||||
|
||||
nsAutoString name(Substring(bookmarkName, 0,
|
||||
|
@ -1563,7 +1567,7 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
|
|||
nsAutoString path;
|
||||
currFile->GetPath(path);
|
||||
|
||||
nsCString resolvedURL;
|
||||
nsXPIDLCString resolvedURL;
|
||||
ResolveShortcut(path, getter_Copies(resolvedURL));
|
||||
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
|
@ -1711,7 +1715,7 @@ nsIEProfileMigrator::CopyCookies(PRBool aReplace)
|
|||
nsCAutoString fileName;
|
||||
cookieFile->GetNativeLeafName(fileName);
|
||||
const nsACString &fileOwner = Substring(fileName, 0, usernameLength);
|
||||
if (!fileOwner.Equals(username, CaseInsensitiveCompare))
|
||||
if (!fileOwner.Equals(username, nsCaseInsensitiveCStringComparator()))
|
||||
continue;
|
||||
|
||||
// ensure the contents buffer is large enough to hold the entire file
|
||||
|
|
|
@ -89,7 +89,7 @@ protected:
|
|||
nsresult AddDataToFormHistory(const nsAString& aKey, PRUnichar* data, unsigned long len);
|
||||
|
||||
nsresult CopyFavorites(PRBool aReplace);
|
||||
void ResolveShortcut(const nsString &aFileName, char** aOutURL);
|
||||
void ResolveShortcut(const nsAFlatString &aFileName, char** aOutURL);
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
nsresult ParseFavoritesFolder(nsIFile* aDirectory,
|
||||
PRInt64 aParentFolder,
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -46,8 +45,6 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIProperties.h"
|
||||
|
||||
#define MACIE_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("Favorites.html")
|
||||
#define MACIE_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Explorer")
|
||||
|
@ -199,7 +196,7 @@ nsMacIEProfileMigrator::CopyBookmarks(PRBool aReplace)
|
|||
rv = bundleService->CreateBundle(MIGRATION_BUNDLE, getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString toolbarFolderNameMacIE;
|
||||
nsXPIDLString toolbarFolderNameMacIE;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("toolbarFolderNameMacIE").get(),
|
||||
getter_Copies(toolbarFolderNameMacIE));
|
||||
nsCAutoString ctoolbarFolderNameMacIE;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsMacIEProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsICookieManager2.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsILineInputStream.h"
|
||||
|
@ -51,6 +52,8 @@
|
|||
#include "nsIURL.h"
|
||||
#include "nsNetscapeProfileMigratorBase.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "prtime.h"
|
||||
#include "prprf.h"
|
||||
|
||||
|
@ -172,8 +175,8 @@ nsNetscapeProfileMigratorBase::GetProfileDataFromRegistry(nsILocalFile* aRegistr
|
|||
aProfileLocations->AppendElement(dir);
|
||||
|
||||
// Get the profile name and add it to the names array
|
||||
nsString profileName;
|
||||
CopyUTF8toUTF16(nsDependentCString(profileStr), profileName);
|
||||
nsXPIDLString profileName;
|
||||
CopyUTF8toUTF16(profileStr, profileName);
|
||||
|
||||
nsCOMPtr<nsISupportsString> profileNameString(
|
||||
do_CreateInstance("@mozilla.org/supports-string;1"));
|
||||
|
@ -224,7 +227,7 @@ nsNetscapeProfileMigratorBase::GetWString(void* aTransform, nsIPrefBranch* aBran
|
|||
getter_AddRefs(prefValue));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && prefValue) {
|
||||
nsString data;
|
||||
nsXPIDLString data;
|
||||
prefValue->ToString(getter_Copies(data));
|
||||
|
||||
xform->stringValue = ToNewCString(NS_ConvertUTF16toUTF8(data));
|
||||
|
@ -239,7 +242,7 @@ nsNetscapeProfileMigratorBase::SetWStringFromASCII(void* aTransform, nsIPrefBran
|
|||
PrefTransform* xform = (PrefTransform*)aTransform;
|
||||
if (xform->prefHasValue) {
|
||||
nsCOMPtr<nsIPrefLocalizedString> pls(do_CreateInstance("@mozilla.org/pref-localizedstring;1"));
|
||||
NS_ConvertUTF8toUTF16 data(xform->stringValue);
|
||||
nsAutoString data; data.AssignWithConversion(xform->stringValue);
|
||||
pls->SetData(data.get());
|
||||
return aBranch->SetComplexValue(xform->targetPrefName ? xform->targetPrefName : xform->sourcePrefName, NS_GET_IID(nsIPrefLocalizedString), pls);
|
||||
}
|
||||
|
@ -338,6 +341,7 @@ nsNetscapeProfileMigratorBase::ImportNetscapeCookies(nsIFile* aCookiesFile)
|
|||
nsCAutoString buffer;
|
||||
PRBool isMore = PR_TRUE;
|
||||
PRInt32 hostIndex = 0, isDomainIndex, pathIndex, secureIndex, expiresIndex, nameIndex, cookieIndex;
|
||||
nsASingleFragmentCString::char_iterator iter;
|
||||
PRInt32 numInts;
|
||||
PRInt64 expires;
|
||||
PRBool isDomain;
|
||||
|
@ -377,19 +381,18 @@ nsNetscapeProfileMigratorBase::ImportNetscapeCookies(nsIFile* aCookiesFile)
|
|||
|
||||
// check the expirytime first - if it's expired, ignore
|
||||
// nullstomp the trailing tab, to avoid copying the string
|
||||
char *iter = buffer.BeginWriting();
|
||||
buffer.BeginWriting(iter);
|
||||
*(iter += nameIndex - 1) = char(0);
|
||||
numInts = PR_sscanf(buffer.get() + expiresIndex, "%lld", &expires);
|
||||
if (numInts != 1 || nsInt64(expires) < currentTime)
|
||||
continue;
|
||||
|
||||
isDomain = Substring(buffer, isDomainIndex, pathIndex - isDomainIndex - 1).Equals(kTrue);
|
||||
const nsDependentCSubstring host =
|
||||
Substring(buffer, hostIndex, isDomainIndex - hostIndex - 1);
|
||||
const nsASingleFragmentCString &host = Substring(buffer, hostIndex, isDomainIndex - hostIndex - 1);
|
||||
// check for bad legacy cookies (domain not starting with a dot, or containing a port),
|
||||
// and discard
|
||||
if (isDomain && !host.IsEmpty() && host.First() != '.' ||
|
||||
host.FindChar(':') != -1)
|
||||
host.FindChar(':') != kNotFound)
|
||||
continue;
|
||||
|
||||
// create a new nsCookie and assign the data.
|
||||
|
@ -455,7 +458,7 @@ nsNetscapeProfileMigratorBase::LocateSignonsFile(char** aResult)
|
|||
nsCAutoString extn;
|
||||
url->GetFileExtension(extn);
|
||||
|
||||
if (extn.Equals("s", CaseInsensitiveCompare)) {
|
||||
if (extn.EqualsIgnoreCase("s")) {
|
||||
url->GetFileName(fileName);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsILocalFile.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsIPrefBranch;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -43,7 +42,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsOmniWebProfileMigrator
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsOmniWebProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
|
@ -58,4 +58,4 @@ private:
|
|||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
#include "nsINavBookmarksService.h"
|
||||
|
@ -67,6 +67,8 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsOperaProfileMigrator.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
|
@ -215,9 +217,7 @@ NS_IMETHODIMP
|
|||
nsOperaProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
if (!mProfiles) {
|
||||
nsresult rv;
|
||||
|
||||
mProfiles = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(mProfiles));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIProperties> fileLocator(do_GetService("@mozilla.org/file/directory_service;1"));
|
||||
|
@ -379,7 +379,7 @@ nsOperaProfileMigrator::SetWString(void* aTransform, nsIPrefBranch* aBranch)
|
|||
{
|
||||
PrefTransform* xform = (PrefTransform*)aTransform;
|
||||
nsCOMPtr<nsIPrefLocalizedString> pls(do_CreateInstance("@mozilla.org/pref-localizedstring;1"));
|
||||
NS_ConvertASCIItoUTF16 data(xform->stringValue);
|
||||
nsAutoString data; data.AssignWithConversion(xform->stringValue);
|
||||
pls->SetData(data.get());
|
||||
return aBranch->SetComplexValue(xform->targetPrefName, NS_GET_IID(nsIPrefLocalizedString), pls);
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
|
|||
transform->keyName,
|
||||
val);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsresult strerr;
|
||||
PRInt32 strerr;
|
||||
switch (transform->type) {
|
||||
case _OPM(STRING):
|
||||
transform->stringValue = ToNewCString(val);
|
||||
|
@ -550,7 +550,7 @@ nsOperaProfileMigrator::GetInteger(nsINIParser &aParser,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*aResult = val.ToInteger(&rv);
|
||||
*aResult = val.ToInteger((PRInt32*) &rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ nsOperaCookieMigrator::AddCookieOverride(nsIPermissionManager* aManager)
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCString domain;
|
||||
nsXPIDLCString domain;
|
||||
SynthesizeDomain(getter_Copies(domain));
|
||||
nsCOMPtr<nsIURI> uri(do_CreateInstance("@mozilla.org/network/standard-url;1"));
|
||||
if (!uri)
|
||||
|
@ -896,10 +896,10 @@ nsOperaCookieMigrator::AddCookie(nsICookieManager2* aManager)
|
|||
{
|
||||
// This is where we use the information gathered in all the other
|
||||
// states to add a cookie to the Firebird/Firefox Cookie Manager.
|
||||
nsCString domain;
|
||||
nsXPIDLCString domain;
|
||||
SynthesizeDomain(getter_Copies(domain));
|
||||
|
||||
nsCString path;
|
||||
nsXPIDLCString path;
|
||||
SynthesizePath(getter_Copies(path));
|
||||
|
||||
mCookieOpen = PR_FALSE;
|
||||
|
@ -1006,7 +1006,7 @@ nsOperaProfileMigrator::CopyHistory(PRBool aReplace)
|
|||
break;
|
||||
case LASTVISIT:
|
||||
// Opera time format is a second offset, PRTime is a microsecond offset
|
||||
nsresult err;
|
||||
PRInt32 err;
|
||||
lastVisitDate = buffer.ToInteger(&err);
|
||||
|
||||
PRInt64 temp, million;
|
||||
|
@ -1067,12 +1067,12 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
|
|||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle(MIGRATION_BUNDLE, getter_AddRefs(bundle));
|
||||
if (!aReplace) {
|
||||
nsString sourceNameOpera;
|
||||
nsXPIDLString sourceNameOpera;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("sourceNameOpera").get(),
|
||||
getter_Copies(sourceNameOpera));
|
||||
|
||||
const PRUnichar* sourceNameStrings[] = { sourceNameOpera.get() };
|
||||
nsString importedOperaHotlistTitle;
|
||||
nsXPIDLString importedOperaHotlistTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
|
||||
sourceNameStrings, 1,
|
||||
getter_Copies(importedOperaHotlistTitle));
|
||||
|
@ -1135,12 +1135,12 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
|
|||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
nsString sourceNameOpera;
|
||||
nsXPIDLString sourceNameOpera;
|
||||
aBundle->GetStringFromName(NS_LITERAL_STRING("sourceNameOpera").get(),
|
||||
getter_Copies(sourceNameOpera));
|
||||
|
||||
const PRUnichar* sourceNameStrings[] = { sourceNameOpera.get() };
|
||||
nsString importedSearchUrlsTitle;
|
||||
nsXPIDLString importedSearchUrlsTitle;
|
||||
aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchURLsFolder").get(),
|
||||
sourceNameStrings, 1,
|
||||
getter_Copies(importedSearchUrlsTitle));
|
||||
|
@ -1207,10 +1207,10 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
|
|||
|
||||
nsCAutoString hostCStr;
|
||||
uri->GetHost(hostCStr);
|
||||
NS_ConvertASCIItoUTF16 host(hostCStr);
|
||||
nsAutoString host; host.AssignWithConversion(hostCStr.get());
|
||||
|
||||
const PRUnichar* descStrings[] = { NS_ConvertUTF8toUTF16(keyword).get(), host.get() };
|
||||
nsString keywordDesc;
|
||||
nsXPIDLString keywordDesc;
|
||||
aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchUrlDesc").get(),
|
||||
descStrings, 2, getter_Copies(keywordDesc));
|
||||
|
||||
|
@ -1340,6 +1340,7 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
|
|||
nsAutoString name, keyword, description;
|
||||
nsCAutoString url;
|
||||
PRBool onToolbar = PR_FALSE;
|
||||
NS_NAMED_LITERAL_STRING(empty, "");
|
||||
do {
|
||||
nsCAutoString cBuffer;
|
||||
rv = aStream->ReadLine(cBuffer, &moreData);
|
||||
|
@ -1348,7 +1349,7 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
|
|||
if (!moreData) break;
|
||||
|
||||
CopyUTF8toUTF16(cBuffer, buffer);
|
||||
nsString data;
|
||||
nsXPIDLString data;
|
||||
LineType type = GetLineType(buffer, getter_Copies(data));
|
||||
switch(type) {
|
||||
case LineType_FOLDER:
|
||||
|
@ -1414,10 +1415,10 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
|
|||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
#endif
|
||||
name.Truncate();
|
||||
url.Truncate();
|
||||
keyword.Truncate();
|
||||
description.Truncate();
|
||||
name = empty;
|
||||
url.AssignWithConversion(empty);
|
||||
keyword = empty;
|
||||
description = empty;
|
||||
onToolbar = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1439,7 +1440,7 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
|
|||
continue;
|
||||
rv = ParseBookmarksFolder(aStream, itemRes, aToolbar, aBMS);
|
||||
#endif
|
||||
name.Truncate();
|
||||
name = empty;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsICookieManager2;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -172,11 +173,11 @@ nsPhoenixProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
|||
aReplace, mSourceProfile, aResult);
|
||||
|
||||
// Now locate passwords
|
||||
nsCString signonsFileName;
|
||||
nsXPIDLCString signonsFileName;
|
||||
GetSignonFileName(aReplace, getter_Copies(signonsFileName));
|
||||
|
||||
if (!signonsFileName.IsEmpty()) {
|
||||
NS_ConvertASCIItoUTF16 fileName(signonsFileName);
|
||||
nsAutoString fileName; fileName.AssignWithConversion(signonsFileName);
|
||||
nsCOMPtr<nsIFile> sourcePasswordsFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourcePasswordsFile));
|
||||
sourcePasswordsFile->Append(fileName);
|
||||
|
@ -228,9 +229,11 @@ NS_IMETHODIMP
|
|||
nsPhoenixProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
if (!mProfileNames && !mProfileLocations) {
|
||||
mProfileNames = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
mProfileLocations = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
NS_ENSURE_TRUE(mProfileNames && mProfileLocations, NS_ERROR_UNEXPECTED);
|
||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(mProfileNames));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mProfileLocations));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Fills mProfileNames and mProfileLocations
|
||||
FillProfileDataFromPhoenixRegistry();
|
||||
|
@ -254,14 +257,11 @@ nsPhoenixProfileMigrator::GetSourceProfile(const PRUnichar* aProfile)
|
|||
PRUint32 count;
|
||||
mProfileNames->Count(&count);
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsISupportsString> str;
|
||||
mProfileNames->QueryElementAt(i, NS_GET_IID(nsISupportsString),
|
||||
getter_AddRefs(str));
|
||||
nsString profileName;
|
||||
nsCOMPtr<nsISupportsString> str(do_QueryElementAt(mProfileNames, i));
|
||||
nsXPIDLString profileName;
|
||||
str->GetData(profileName);
|
||||
if (profileName.Equals(aProfile)) {
|
||||
mProfileLocations->QueryElementAt(i, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(mSourceProfile));
|
||||
mSourceProfile = do_QueryElementAt(mProfileLocations, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ nsPhoenixProfileMigrator::CopyPasswords(PRBool aReplace)
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCString signonsFileName;
|
||||
nsXPIDLCString signonsFileName;
|
||||
if (!aReplace)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -417,7 +417,7 @@ nsPhoenixProfileMigrator::CopyPasswords(PRBool aReplace)
|
|||
if (signonsFileName.IsEmpty())
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
NS_ConvertASCIItoUTF16 fileName(signonsFileName);
|
||||
nsAutoString fileName; fileName.AssignWithConversion(signonsFileName);
|
||||
return aReplace ? CopyFile(fileName, fileName) : NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsNetscapeProfileMigratorBase.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsIPrefBranch;
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProperties.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
@ -52,13 +51,13 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsBrowserCompsCID.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "NSReg.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsString.h"
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
#include "nsIWindowsRegKey.h"
|
||||
|
@ -66,6 +65,7 @@
|
|||
#endif
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef _MAX_PATH
|
||||
|
@ -95,8 +95,8 @@ nsProfileMigrator::Migrate(nsIProfileStartup* aStartup)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!bpm) {
|
||||
nsCAutoString contractID(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX);
|
||||
contractID.Append(key);
|
||||
nsCAutoString contractID =
|
||||
NS_LITERAL_CSTRING(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX) + key;
|
||||
|
||||
bpm = do_CreateInstance(contractID.get());
|
||||
if (!bpm) return NS_ERROR_FAILURE;
|
||||
|
@ -123,8 +123,8 @@ nsProfileMigrator::Migrate(nsIProfileStartup* aStartup)
|
|||
// By opening the Migration FE with a supplied bpm, it will automatically
|
||||
// migrate from it.
|
||||
nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsArray> params =
|
||||
do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
nsCOMPtr<nsISupportsArray> params;
|
||||
NS_NewISupportsArray(getter_AddRefs(params));
|
||||
if (!ww || !params) return NS_ERROR_FAILURE;
|
||||
|
||||
params->AppendElement(cstr);
|
||||
|
@ -187,18 +187,20 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
|
|||
if (NS_FAILED(regKey->ReadStringValue(EmptyString(), value)))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 len = value.Find(NS_LITERAL_STRING(".exe"), CaseInsensitiveCompare);
|
||||
if (len == -1)
|
||||
nsAString::const_iterator start, end;
|
||||
value.BeginReading(start);
|
||||
value.EndReading(end);
|
||||
nsAString::const_iterator tmp = start;
|
||||
|
||||
if (!FindInReadable(NS_LITERAL_STRING(".exe"), tmp, end,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 start = 0;
|
||||
// skip an opening quotation mark if present
|
||||
if (value.get()[1] != ':') {
|
||||
start = 1;
|
||||
--len;
|
||||
}
|
||||
if (value.CharAt(1) != ':')
|
||||
++start;
|
||||
|
||||
const nsDependentSubstring filePath(Substring(value, start, len));
|
||||
nsDependentSubstring filePath(start, end);
|
||||
|
||||
// We want to find out what the default browser is but the path in and of itself
|
||||
// isn't enough. Why? Because sometimes on Windows paths get truncated like so:
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
#include "nsINavBookmarksService.h"
|
||||
|
@ -476,7 +476,7 @@ nsSafariProfileMigrator::SetDefaultEncoding(void* aTransform, nsIPrefBranch* aBr
|
|||
for (PRUint16 i = 0; (charsetIndex == -1) &&
|
||||
i < (sizeof(gCharsets) / sizeof(gCharsets[0])); ++i) {
|
||||
if (gCharsets[i].webkitLabelLength == encodingLength &&
|
||||
!strcmp(gCharsets[i].webkitLabel, encodingStr))
|
||||
!nsCRT::strcmp(gCharsets[i].webkitLabel, encodingStr))
|
||||
charsetIndex = (PRInt16)i;
|
||||
}
|
||||
if (charsetIndex == -1) // Default to "Western"
|
||||
|
@ -654,7 +654,7 @@ nsSafariProfileMigrator::SetDisplayImages(void* aTransform, nsIPrefBranch* aBran
|
|||
nsresult
|
||||
nsSafariProfileMigrator::SetFontName(void* aTransform, nsIPrefBranch* aBranch)
|
||||
{
|
||||
nsCString associatedLangGroup;
|
||||
nsXPIDLCString associatedLangGroup;
|
||||
nsresult rv = aBranch->GetCharPref("migration.associatedLangGroup",
|
||||
getter_Copies(associatedLangGroup));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -670,7 +670,7 @@ nsSafariProfileMigrator::SetFontName(void* aTransform, nsIPrefBranch* aBranch)
|
|||
nsresult
|
||||
nsSafariProfileMigrator::SetFontSize(void* aTransform, nsIPrefBranch* aBranch)
|
||||
{
|
||||
nsCString associatedLangGroup;
|
||||
nsXPIDLCString associatedLangGroup;
|
||||
nsresult rv = aBranch->GetCharPref("migration.associatedLangGroup",
|
||||
getter_Copies(associatedLangGroup));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -916,12 +916,12 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
|
|||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle(MIGRATION_BUNDLE, getter_AddRefs(bundle));
|
||||
|
||||
nsString sourceNameSafari;
|
||||
nsXPIDLString sourceNameSafari;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("sourceNameSafari").get(),
|
||||
getter_Copies(sourceNameSafari));
|
||||
|
||||
const PRUnichar* sourceNameStrings[] = { sourceNameSafari.get() };
|
||||
nsString importedSafariBookmarksTitle;
|
||||
nsXPIDLString importedSafariBookmarksTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
|
||||
sourceNameStrings, 1,
|
||||
getter_Copies(importedSafariBookmarksTitle));
|
||||
|
@ -1144,9 +1144,7 @@ nsSafariProfileMigrator::ProfileHasContentStyleSheet(PRBool *outExists)
|
|||
rv = userChromeDir->GetNativePath(userChromeDirPath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString path(userChromeDirPath);
|
||||
path.Append("/userContent.css");
|
||||
|
||||
nsCAutoString path = userChromeDirPath + NS_LITERAL_CSTRING("/userContent.css");
|
||||
nsCOMPtr<nsILocalFile> file;
|
||||
rv = NS_NewNativeLocalFile(path, PR_FALSE,
|
||||
getter_AddRefs(file));
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsICookieManager2.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
@ -160,11 +161,11 @@ nsSeamonkeyProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
|||
aReplace, mSourceProfile, aResult);
|
||||
|
||||
// Now locate passwords
|
||||
nsCString signonsFileName;
|
||||
nsXPIDLCString signonsFileName;
|
||||
GetSignonFileName(aReplace, getter_Copies(signonsFileName));
|
||||
|
||||
if (!signonsFileName.IsEmpty()) {
|
||||
NS_ConvertASCIItoUTF16 fileName(signonsFileName);
|
||||
nsAutoString fileName; fileName.AssignWithConversion(signonsFileName);
|
||||
nsCOMPtr<nsIFile> sourcePasswordsFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourcePasswordsFile));
|
||||
sourcePasswordsFile->Append(fileName);
|
||||
|
@ -216,9 +217,11 @@ NS_IMETHODIMP
|
|||
nsSeamonkeyProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
if (!mProfileNames && !mProfileLocations) {
|
||||
mProfileNames = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
mProfileLocations = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
NS_ENSURE_TRUE(mProfileNames && mProfileLocations, NS_ERROR_UNEXPECTED);
|
||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(mProfileNames));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mProfileLocations));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Fills mProfileNames and mProfileLocations
|
||||
FillProfileDataFromSeamonkeyRegistry();
|
||||
|
@ -252,7 +255,7 @@ nsSeamonkeyProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
|||
NS_GET_IID(nsIPrefLocalizedString),
|
||||
getter_AddRefs(prefValue));
|
||||
if (NS_SUCCEEDED(rv) && prefValue) {
|
||||
nsString data;
|
||||
nsXPIDLString data;
|
||||
prefValue->ToString(getter_Copies(data));
|
||||
|
||||
nsCAutoString val;
|
||||
|
@ -277,14 +280,11 @@ nsSeamonkeyProfileMigrator::GetSourceProfile(const PRUnichar* aProfile)
|
|||
PRUint32 count;
|
||||
mProfileNames->Count(&count);
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsISupportsString> str;
|
||||
mProfileNames->QueryElementAt(i, NS_GET_IID(nsISupportsString),
|
||||
getter_AddRefs(str));
|
||||
nsString profileName;
|
||||
nsCOMPtr<nsISupportsString> str(do_QueryElementAt(mProfileNames, i));
|
||||
nsXPIDLString profileName;
|
||||
str->GetData(profileName);
|
||||
if (profileName.Equals(aProfile)) {
|
||||
mProfileLocations->QueryElementAt(i, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(mSourceProfile));
|
||||
mSourceProfile = do_QueryElementAt(mProfileLocations, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ nsSeamonkeyProfileMigrator::WriteFontsBranch(nsIPrefService* aPrefService,
|
|||
switch (pref->type) {
|
||||
case nsIPrefBranch::PREF_STRING:
|
||||
rv = branch->SetCharPref(pref->prefName, pref->stringValue);
|
||||
NS_Free(pref->stringValue);
|
||||
PL_strfree(pref->stringValue);
|
||||
pref->stringValue = nsnull;
|
||||
break;
|
||||
case nsIPrefBranch::PREF_BOOL:
|
||||
|
@ -673,13 +673,13 @@ nsSeamonkeyProfileMigrator::CopyPasswords(PRBool aReplace)
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCString signonsFileName;
|
||||
nsXPIDLCString signonsFileName;
|
||||
GetSignonFileName(aReplace, getter_Copies(signonsFileName));
|
||||
|
||||
if (signonsFileName.IsEmpty())
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
NS_ConvertASCIItoUTF16 fileName(signonsFileName);
|
||||
nsAutoString fileName; fileName.AssignWithConversion(signonsFileName);
|
||||
if (aReplace)
|
||||
rv = CopyFile(fileName, fileName);
|
||||
else {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsNetscapeProfileMigratorBase.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsIPrefBranch;
|
||||
|
|
|
@ -43,8 +43,8 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = safebrowsing
|
||||
LIBRARY_NAME = safebrowsing_s
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
|
||||
REQUIRES = \
|
||||
necko \
|
||||
|
|
|
@ -43,9 +43,8 @@
|
|||
#include "nsITimer.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS4(nsDocNavStartProgressListener,
|
||||
nsIDocNavStartProgressListener,
|
||||
|
@ -333,7 +332,7 @@ nsDocNavStartProgressListener::Observe(nsISupports *subject, const char *topic,
|
|||
// We don't care about URL fragments so we take that off.
|
||||
PRInt32 pos = uriString.FindChar('#');
|
||||
if (pos > -1) {
|
||||
uriString.SetLength(pos);
|
||||
uriString.Truncate(pos);
|
||||
}
|
||||
|
||||
mCallback->OnDocNavStart(request, uriString);
|
||||
|
|
|
@ -43,8 +43,7 @@ VPATH = @srcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = shellservice
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
|
@ -80,6 +79,8 @@ ifdef CPPSRCS
|
|||
LIBRARY_NAME = shellservice_s
|
||||
endif
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DMOZ_APP_NAME=\"$(MOZ_APP_NAME)\"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "prenv.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIGConfService.h"
|
||||
#include "nsIGnomeVFSService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
@ -56,10 +56,10 @@
|
|||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIImage.h"
|
||||
#include "prprf.h"
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include "nsIImageToPixbuf.h"
|
||||
#endif
|
||||
#include "nsColor.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
@ -217,13 +217,12 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
|
|||
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
|
||||
|
||||
nsCAutoString schemeList;
|
||||
nsCAutoString appKeyValue(mAppPath);
|
||||
appKeyValue.Append(" \"%s\"");
|
||||
nsCAutoString appKeyValue(mAppPath + NS_LITERAL_CSTRING(" \"%s\""));
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
|
||||
schemeList.Append(nsDependentCString(appProtocols[i].name));
|
||||
schemeList.Append(',');
|
||||
schemeList.Append(nsDependentCString(appProtocols[i].name)
|
||||
+ NS_LITERAL_CSTRING(","));
|
||||
|
||||
if (appProtocols[i].essential || aClaimAllTypes) {
|
||||
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
|
||||
|
@ -243,7 +242,7 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
|
|||
bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
|
||||
NS_ENSURE_TRUE(brandBundle, NS_ERROR_FAILURE);
|
||||
|
||||
nsString brandShortName, brandFullName;
|
||||
nsXPIDLString brandShortName, brandFullName;
|
||||
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(brandShortName));
|
||||
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandFullName").get(),
|
||||
|
@ -280,7 +279,7 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
|
|||
if (lastSlash == -1) {
|
||||
NS_ERROR("no slash in executable path?");
|
||||
} else {
|
||||
iconFilePath.SetLength(lastSlash);
|
||||
iconFilePath.Truncate(lastSlash);
|
||||
nsCOMPtr<nsILocalFile> iconFile;
|
||||
NS_NewNativeLocalFile(iconFilePath, PR_FALSE, getter_AddRefs(iconFile));
|
||||
if (iconFile) {
|
||||
|
@ -401,7 +400,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
|||
nsCAutoString filePath(PR_GetEnv("HOME"));
|
||||
|
||||
// get the product brand name from localized strings
|
||||
nsString brandName;
|
||||
nsXPIDLString brandName;
|
||||
nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(bundleCID));
|
||||
if (bundleService) {
|
||||
|
@ -416,10 +415,10 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
|||
}
|
||||
|
||||
// build the file name
|
||||
filePath.Append('/');
|
||||
filePath.Append(NS_ConvertUTF16toUTF8(brandName));
|
||||
filePath.Append("_wallpaper.png");
|
||||
|
||||
filePath.Append(NS_LITERAL_CSTRING("/") +
|
||||
NS_ConvertUTF16toUTF8(brandName) +
|
||||
NS_LITERAL_CSTRING("_wallpaper.png"));
|
||||
|
||||
// write the image to a file in the home dir
|
||||
rv = WriteImage(filePath, gfxFrame);
|
||||
|
||||
|
@ -448,59 +447,6 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// In: pointer to two characters CC
|
||||
// Out: parsed color number
|
||||
static PRUint8
|
||||
HexToNum(char ch)
|
||||
{
|
||||
if ('0' <= ch && '9' >= ch)
|
||||
return ch - '0';
|
||||
|
||||
if ('A' <= ch && 'F' >= ch)
|
||||
return ch - 'A';
|
||||
|
||||
if ('a' <= ch && 'f' >= ch)
|
||||
return ch - 'a';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// In: 3 or 6-character RRGGBB hex string
|
||||
// Out: component colors
|
||||
static PRBool
|
||||
HexToRGB(const nsCString& aColorSpec,
|
||||
PRUint8 &aRed,
|
||||
PRUint8 &aGreen,
|
||||
PRUint8 &aBlue)
|
||||
{
|
||||
const char *buf = aColorSpec.get();
|
||||
|
||||
if (aColorSpec.Length() == 6) {
|
||||
aRed = HexToNum(buf[0]) >> 4 |
|
||||
HexToNum(buf[1]);
|
||||
aGreen = HexToNum(buf[2]) >> 4 |
|
||||
HexToNum(buf[3]);
|
||||
aBlue = HexToNum(buf[4]) >> 4 |
|
||||
HexToNum(buf[5]);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (aColorSpec.Length() == 3) {
|
||||
aRed = HexToNum(buf[0]);
|
||||
aGreen = HexToNum(buf[1]);
|
||||
aBlue = HexToNum(buf[2]);
|
||||
|
||||
aRed |= aRed >> 4;
|
||||
aGreen |= aGreen >> 4;
|
||||
aBlue |= aBlue >> 4;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGNOMEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
|
||||
{
|
||||
|
@ -517,36 +463,26 @@ nsGNOMEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
|
|||
// Chop off the leading '#' character
|
||||
background.Cut(0, 1);
|
||||
|
||||
PRUint8 red, green, blue;
|
||||
if (!HexToRGB(background, red, green, blue))
|
||||
return NS_ERROR_FAILURE;
|
||||
nscolor rgb;
|
||||
if (!NS_ASCIIHexToRGB(background, &rgb))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// The result must be in RGB order with the high 8 bits zero.
|
||||
*aColor = (red << 16 | green << 8 | blue);
|
||||
*aColor = (NS_GET_R(rgb) << 16 | NS_GET_G(rgb) << 8 | NS_GET_B(rgb));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
ColorToHex(PRUint32 aColor, nsCString& aResult)
|
||||
{
|
||||
char *buf = aResult.BeginWriting(7);
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
PRUint8 red = (aColor >> 16);
|
||||
PRUint8 green = (aColor >> 8) & 0xff;
|
||||
PRUint8 blue = aColor & 0xff;
|
||||
|
||||
PR_snprintf(buf, 8, "#%02x%02x%02x", red, green, blue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGNOMEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
|
||||
{
|
||||
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
|
||||
|
||||
nsCString colorString;
|
||||
ColorToHex(aColor, colorString);
|
||||
unsigned char red = (aColor >> 16);
|
||||
unsigned char green = (aColor >> 8) & 0xff;
|
||||
unsigned char blue = aColor & 0xff;
|
||||
|
||||
nsCAutoString colorString;
|
||||
NS_RGBToASCIIHex(NS_RGB(red, green, blue), colorString);
|
||||
|
||||
gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), colorString);
|
||||
|
||||
|
@ -620,7 +556,7 @@ nsGNOMEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const ns
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
const nsCString spec(aURI);
|
||||
const nsPromiseFlatCString& spec = PromiseFlatCString(aURI);
|
||||
const char* specStr = spec.get();
|
||||
PRUint32 pid;
|
||||
return process->Run(PR_FALSE, &specStr, 1, &pid);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#define nsgnomeshellservice_h____
|
||||
|
||||
#include "nsIShellService.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsGNOMEShellService : public nsIShellService
|
||||
{
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
* Contributor(s):
|
||||
* Ben Goodger <ben@mozilla.org> (Original Author)
|
||||
* Asaf Romano <mozilla.mano@sent.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -53,7 +52,7 @@
|
|||
#include "nsMacShellService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsShellService.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
|
@ -469,7 +468,7 @@ nsMacShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsAC
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
const nsCString spec(aURI);
|
||||
const nsPromiseFlatCString& spec = PromiseFlatCString(aURI);
|
||||
const UInt8* uriString = (const UInt8*)spec.get();
|
||||
CFURLRef uri = ::CFURLCreateWithBytes(NULL, uriString, aURI.Length(),
|
||||
kCFStringEncodingUTF8, NULL);
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsIMacShellService.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsMacShellService : public nsIMacShellService,
|
||||
public nsIWebProgressListener
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "gfxIImageFrame.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
|
@ -56,6 +57,7 @@
|
|||
#include "nsIProcess.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsBrowserCompsCID.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "shlobj.h"
|
||||
|
@ -455,8 +457,8 @@ nsWindowsShellService::IsDefaultBrowser(PRBool aStartupCheck, PRBool* aIsDefault
|
|||
// Close the key we opened.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(result) ||
|
||||
!dataLongPath.Equals(currValue, CaseInsensitiveCompare) &&
|
||||
!dataShortPath.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
!dataLongPath.EqualsIgnoreCase(currValue) &&
|
||||
!dataShortPath.EqualsIgnoreCase(currValue)) {
|
||||
// Key wasn't set, or was set to something else (something else became the default browser)
|
||||
*aIsDefaultBrowser = PR_FALSE;
|
||||
break;
|
||||
|
@ -532,13 +534,12 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Create the Start Menu item if it doesn't exist
|
||||
nsString brandFullName;
|
||||
nsXPIDLString brandFullName;
|
||||
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandFullName").get(),
|
||||
getter_Copies(brandFullName));
|
||||
nsCAutoString nativeFullName;
|
||||
// For the now, we use 'A' APIs (see bug 240272, 239279)
|
||||
NS_UTF16ToCString(brandFullName, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM,
|
||||
nativeFullName);
|
||||
NS_CopyUnicodeToNative(brandFullName, nativeFullName);
|
||||
|
||||
nsCAutoString key1(NS_LITERAL_CSTRING(SMI));
|
||||
key1.Append(exeName);
|
||||
|
@ -547,39 +548,35 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
|
|||
aForAllUsers);
|
||||
|
||||
// Set the Options and Safe Mode start menu context menu item labels
|
||||
nsCAutoString optionsKey(SMI);
|
||||
optionsKey.Append(exeName);
|
||||
optionsKey.Append("\\shell\\properties");
|
||||
nsCAutoString optionsKey(NS_LITERAL_CSTRING(SMI "%APPEXE%\\shell\\properties"));
|
||||
optionsKey.ReplaceSubstring("%APPEXE%", exeName.get());
|
||||
|
||||
nsCAutoString safeModeKey(SMI);
|
||||
safeModeKey.Append(exeName);
|
||||
safeModeKey.Append("\\shell\\safemode");
|
||||
nsCAutoString safeModeKey(NS_LITERAL_CSTRING(SMI "%APPEXE%\\shell\\safemode"));
|
||||
safeModeKey.ReplaceSubstring("%APPEXE%", exeName.get());
|
||||
|
||||
nsString brandShortName;
|
||||
nsXPIDLString brandShortName;
|
||||
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(brandShortName));
|
||||
|
||||
const PRUnichar* brandNameStrings[] = { brandShortName.get() };
|
||||
|
||||
// Set the Options menu item
|
||||
nsString optionsTitle;
|
||||
nsXPIDLString optionsTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("optionsLabel").get(),
|
||||
brandNameStrings, 1, getter_Copies(optionsTitle));
|
||||
// Set the Safe Mode menu item
|
||||
nsString safeModeTitle;
|
||||
nsXPIDLString safeModeTitle;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("safeModeLabel").get(),
|
||||
brandNameStrings, 1, getter_Copies(safeModeTitle));
|
||||
|
||||
// Set the registry keys
|
||||
nsCAutoString nativeTitle;
|
||||
// For the now, we use 'A' APIs (see bug 240272, 239279)
|
||||
NS_UTF16ToCString(optionsTitle, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM,
|
||||
nativeTitle);
|
||||
NS_CopyUnicodeToNative(optionsTitle, nativeTitle);
|
||||
SetRegKey(optionsKey.get(), "", nativeTitle.get(), aClaimAllTypes,
|
||||
aForAllUsers);
|
||||
// For the now, we use 'A' APIs (see bug 240272, 239279)
|
||||
NS_UTF16ToCString(safeModeTitle, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM,
|
||||
nativeTitle);
|
||||
NS_CopyUnicodeToNative(safeModeTitle, nativeTitle);
|
||||
SetRegKey(safeModeKey.get(), "", nativeTitle.get(), aClaimAllTypes,
|
||||
aForAllUsers);
|
||||
|
||||
|
@ -781,7 +778,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// e.g. "Desktop Background.bmp"
|
||||
nsString fileLeafName;
|
||||
nsXPIDLString fileLeafName;
|
||||
rv = shellBundle->GetStringFromName
|
||||
(NS_LITERAL_STRING("desktopBackgroundLeafNameWin").get(),
|
||||
getter_Copies(fileLeafName));
|
||||
|
@ -1057,7 +1054,7 @@ nsWindowsShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
const nsCString spec(aURI);
|
||||
const nsPromiseFlatCString& spec = PromiseFlatCString(aURI);
|
||||
const char* specStr = spec.get();
|
||||
PRUint32 pid;
|
||||
return process->Run(PR_FALSE, &specStr, 1, &pid);
|
||||
|
|
|
@ -211,8 +211,6 @@ bin/components/nsSessionStore.js
|
|||
bin/components/sessionstore.xpt
|
||||
bin/components/nsURLFormatter.js
|
||||
bin/components/urlformatter.xpt
|
||||
bin/components/libbrowserdirprovider.so
|
||||
bin/components/libbrowsercomps.so
|
||||
|
||||
; Safe Browsing
|
||||
bin/components/nsSafebrowsingApplication.js
|
||||
|
|
|
@ -220,8 +220,6 @@ bin\components\nsSessionStore.js
|
|||
bin\components\sessionstore.xpt
|
||||
bin\components\nsURLFormatter.js
|
||||
bin\components\urlformatter.xpt
|
||||
bin\components\browserdirprovider.dll
|
||||
bin\components\brwsrcmp.dll
|
||||
|
||||
; Safe Browsing
|
||||
bin\components\nsSafebrowsingApplication.js
|
||||
|
|
|
@ -284,18 +284,11 @@ ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
|
|||
_ENABLE_PIC=1
|
||||
endif
|
||||
|
||||
# In Firefox, all components are linked into either libxul or the static
|
||||
# meta-component, and should be compiled with PIC.
|
||||
ifdef MOZ_META_COMPONENT
|
||||
_ENABLE_PIC=1
|
||||
endif
|
||||
|
||||
# If module is going to be merged into the nsStaticModule,
|
||||
# make sure that the entry points are translated and
|
||||
# the module is built static.
|
||||
|
||||
ifdef IS_COMPONENT
|
||||
ifdef EXPORT_LIBRARY
|
||||
ifneq (,$(BUILD_STATIC_LIBS))
|
||||
ifdef MODULE_NAME
|
||||
DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
|
||||
|
@ -303,7 +296,6 @@ FORCE_STATIC_LIB=1
|
|||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Determine if module being compiled is destined
|
||||
# to be merged into libxul
|
||||
|
|
|
@ -347,11 +347,11 @@ endif
|
|||
|
||||
LOOP_OVER_DIRS = \
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
|
||||
$(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
|
||||
|
||||
LOOP_OVER_TOOL_DIRS = \
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
|
||||
$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
|
||||
|
||||
#
|
||||
# Now we can differentiate between objects used to build a library, and
|
||||
|
@ -571,13 +571,13 @@ STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
|
|||
|
||||
default all alldep::
|
||||
$(EXIT_ON_ERROR) \
|
||||
$(foreach tier,$(TIERS),$(MAKE) tier_$(tier); ) true
|
||||
$(foreach tier,$(TIERS),$(MAKE) tier_$(tier); )
|
||||
|
||||
else
|
||||
|
||||
default all::
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); ) true
|
||||
$(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); )
|
||||
$(MAKE) export
|
||||
$(MAKE) libs
|
||||
$(MAKE) tools
|
||||
|
@ -598,24 +598,24 @@ export_tier_%:
|
|||
@echo "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; ) true
|
||||
$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; )
|
||||
|
||||
libs_tier_%:
|
||||
@echo "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; ) true
|
||||
$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; )
|
||||
|
||||
tools_tier_%:
|
||||
@echo "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; ) true
|
||||
$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; )
|
||||
|
||||
$(foreach tier,$(TIERS),tier_$(tier))::
|
||||
@echo "$@: $($@_staticdirs) $($@_dirs)"
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); ) true
|
||||
$(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); )
|
||||
$(MAKE) export_$@
|
||||
$(MAKE) libs_$@
|
||||
|
||||
|
@ -658,7 +658,7 @@ tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
|
|||
+$(LOOP_OVER_DIRS)
|
||||
ifdef TOOL_DIRS
|
||||
@$(EXIT_ON_ERROR) \
|
||||
$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; ) true
|
||||
$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; )
|
||||
endif
|
||||
|
||||
#
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#define NS_SIDE_BOTTOM 2
|
||||
#define NS_SIDE_LEFT 3
|
||||
|
||||
#if defined(MOZ_ENABLE_LIBXUL) || !defined(MOZILLA_INTERNAL_API)
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
# define NS_GFX
|
||||
# define NS_GFX_(type) type
|
||||
# define NS_GFX_STATIC_MEMBER_(type) type
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define nsICharsetAlias_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/* 0b4028d6-7473-4958-9b3c-4dee46bf68cb */
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#ifndef nsIPlatformCharset_h__
|
||||
#define nsIPlatformCharset_h__
|
||||
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Interface ID for our nsIPlatformCharset interface
|
||||
|
|
|
@ -342,7 +342,7 @@ static PRBool ns_strnimatch(const PRUnichar *aStr, const char* aSubstring,
|
|||
if (!NS_IsAscii(*aStr))
|
||||
return PR_FALSE;
|
||||
|
||||
if (NS_ToLower((char) *aStr) != NS_ToLower(*aSubstring))
|
||||
if (NS_ToLower((char) *aStr) != *aSubstring)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ static PRBool ns_strnimatch(const PRUnichar *aStr, const char* aSubstring,
|
|||
}
|
||||
|
||||
PRInt32
|
||||
nsAString::Find(const char *aStr, PRUint32 aOffset, PRBool aIgnoreCase) const
|
||||
nsAString::Find(const char *aStr, PRBool aIgnoreCase) const
|
||||
{
|
||||
PRBool (*match)(const PRUnichar*, const char*, PRUint32) =
|
||||
aIgnoreCase ? ns_strnimatch : ns_strnmatch;
|
||||
|
@ -358,9 +358,6 @@ nsAString::Find(const char *aStr, PRUint32 aOffset, PRBool aIgnoreCase) const
|
|||
const char_type *begin, *end;
|
||||
PRUint32 selflen = BeginReading(&begin, &end);
|
||||
|
||||
if (aOffset > selflen)
|
||||
return -1;
|
||||
|
||||
PRUint32 otherlen = strlen(aStr);
|
||||
|
||||
if (otherlen > selflen)
|
||||
|
@ -369,7 +366,7 @@ nsAString::Find(const char *aStr, PRUint32 aOffset, PRBool aIgnoreCase) const
|
|||
// We want to stop searching otherlen characters before the end of the string
|
||||
end -= otherlen;
|
||||
|
||||
for (const char_type *cur = begin + aOffset; cur <= end; ++cur) {
|
||||
for (const char_type *cur = begin; cur <= end; ++cur) {
|
||||
if (match(cur, aStr, otherlen)) {
|
||||
return cur - begin;
|
||||
}
|
||||
|
@ -685,7 +682,7 @@ nsACString::Find(const char_type *aStr, PRUint32 aLen, ComparatorFunc c) const
|
|||
end -= aLen;
|
||||
|
||||
for (const char_type *cur = begin; cur <= end; ++cur) {
|
||||
if (!c(cur, aStr, aLen))
|
||||
if (!c(begin, aStr, aLen))
|
||||
return cur - begin;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -229,10 +229,7 @@ public:
|
|||
*
|
||||
* @return the offset of aStr, or -1 if not found.
|
||||
*/
|
||||
NS_HIDDEN_(PRInt32) Find(const char *aStr, PRBool aIgnoreCase = PR_FALSE) const
|
||||
{ return Find(aStr, 0, aIgnoreCase); }
|
||||
|
||||
NS_HIDDEN_(PRInt32) Find(const char *aStr, PRUint32 aOffset, PRBool aIgnoreCase = PR_FALSE) const;
|
||||
NS_HIDDEN_(PRInt32) Find(const char *aStr, PRBool aIgnoreCase = PR_FALSE) const;
|
||||
|
||||
/**
|
||||
* Search for the offset of the first occurrence of a character in a
|
||||
|
|
Загрузка…
Ссылка в новой задаче