45 #include "nsAppDirectoryServiceDefs.h"
48 #include "nsCRTGlue.h"
50 #include "nsDocShellCID.h"
52 #include "nsDirectoryServiceDefs.h"
53 #include "nsDirectoryServiceUtils.h"
54 #include "nsStringAPI.h"
59 #include "nsICookieManager2.h"
62 #include "nsILocalFile.h"
63 #include "nsIPrefService.h"
64 #include "nsIPrefBranch.h"
65 #include "nsISimpleEnumerator.h"
66 #include "nsISupportsArray.h"
67 #include "nsIProfileMigrator.h"
68 #include "nsIBrowserProfileMigrator.h"
69 #include "nsIObserverService.h"
70 #include "nsILocalFileWin.h"
71 #include "nsAutoPtr.h"
80 #include "nsIBrowserHistory.h"
81 #include "nsIGlobalHistory.h"
82 #include "nsIRDFRemoteDataSource.h"
84 #include "nsILoginManagerIEMigrationHelper.h"
85 #include "nsILoginInfo.h"
86 #include "nsIFormHistory.h"
87 #include "nsIRDFService.h"
88 #include "nsIRDFContainer.h"
90 #include "nsINavBookmarksService.h"
92 #include "nsIStringBundle.h"
93 #include "nsNetUtil.h"
94 #include "nsToolkitCompsCID.h"
95 #include "nsUnicharUtils.h"
96 #include "nsIWindowsRegKey.h"
97 #include "nsISupportsPrimitives.h"
99 #define TRIDENTPROFILE_BUNDLE "chrome://browser/locale/migration/migration.properties"
101 #define REGISTRY_IE_MAIN_KEY \
102 NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\Main")
103 #define REGISTRY_IE_TYPEDURL_KEY \
104 NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\TypedURLs")
105 #define REGISTRY_IE_TOOLBAR_KEY \
106 NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\Toolbar")
107 #define REGISTRY_IE_SEARCHURL_KEY \
108 NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\SearchUrl")
135 nsAutoString regValue;
136 if (NS_SUCCEEDED(aRegKey->ReadStringValue(aRegValueName, regValue)))
137 aPrefs->SetBoolPref(aPrefKeyName, regValue.EqualsLiteral(
"yes"));
146 nsAutoString regValue;
147 if (NS_SUCCEEDED(aRegKey->ReadStringValue(aRegValueName, regValue)))
148 aPrefs->SetBoolPref(aPrefKeyName, !regValue.EqualsLiteral(
"yes"));
153 const nsString& aRegValueName,
156 nsAutoString regValue;
157 if (NS_SUCCEEDED(aRegKey->ReadStringValue(aRegValueName, regValue)) &&
158 !regValue.IsEmpty()) {
159 if (regValue.EqualsLiteral(
"yes"))
160 aPrefs->SetIntPref(aPrefKeyName, 1);
162 aPrefs->SetIntPref(aPrefKeyName, 2);
168 const nsString& aRegValueName,
171 if (NS_SUCCEEDED(aRegKey->ReadIntValue(aRegValueName, &val))) {
173 aPrefs->SetCharPref(aPrefKeyName,
"1.1");
175 aPrefs->SetCharPref(aPrefKeyName,
"1.0");
185 char prefStringValue[10];
187 nsAutoString regValue;
188 if (NS_SUCCEEDED(aRegKey->ReadStringValue(aRegValueName, regValue)) &&
189 !regValue.IsEmpty()) {
190 int red, green, blue;
191 ::swscanf(regValue.get(), L
"%d,%d,%d", &red, &green, &blue);
192 ::sprintf(prefStringValue,
"#%02X%02X%02X", red, green, blue);
193 aPrefs->SetCharPref(aPrefKeyName, prefStringValue);
200 const nsString& aRegValueName,
204 PRInt32 prefIntValue = 0;
206 if (NS_SUCCEEDED(aRegKey->ReadIntValue(aRegValueName,
207 reinterpret_cast<PRUint32 *>(&prefIntValue))))
208 aPrefs->SetIntPref(aPrefKeyName, prefIntValue);
215 nsAutoString regValue;
216 if (NS_SUCCEEDED(aRegKey->ReadStringValue(aRegValueName, regValue)) &&
217 !regValue.IsEmpty()) {
218 aPrefs->SetCharPref(aPrefKeyName, NS_ConvertUTF16toUTF8(regValue).
get());
229 if (NS_FAILED(aRegKey->ReadStringValue(aRegValueName, lang)))
235 char prefStringValue[MAX_PATH];
236 NS_LossyConvertUTF16toASCII langCstr(lang);
237 const char *source = langCstr.get(),
238 *sourceEnd = source + langCstr.Length();
239 char *dest = prefStringValue,
240 *destEnd = dest + (MAX_PATH-2);
241 PRBool
skip = PR_FALSE,
244 while (source < sourceEnd && *source && dest < destEnd) {
247 else if (*source ==
';')
250 if (comma && *source !=
' ')
254 comma = *source ==
',';
259 aPrefs->SetCharPref(aPrefKeyName, prefStringValue);
265 *((
int *) aClosure) = aLogFont->lfPitchAndFamily & FF_ROMAN;
277 lf.lfCharSet = DEFAULT_CHARSET;
278 lf.lfPitchAndFamily = 0;
280 if (NS_FAILED(aRegKey->ReadStringValue(aRegValueName, font)))
283 ::wcsncpy(lf.lfFaceName, font.get(), LF_FACESIZE);
284 lf.lfFaceName[LF_FACESIZE - 1] = L
'\0';
285 ::EnumFontFamiliesExW(dc, &lf,
fontEnumProc, (LPARAM) &isSerif, 0);
290 nsDependentCString
generic(isSerif ?
"serif" :
"sans-serif");
291 nsCAutoString prefName(
"font.name.");
292 prefName.Append(
generic);
293 prefName.Append(
".x-western");
294 aPrefs->SetCharPref(prefName.get(), NS_ConvertUTF16toUTF8(font).get());
295 aPrefs->SetCharPref(
"font.default.x-western",
generic.
get());
310 {
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoComplete",
312 "browser.urlbar.autocomplete.enabled",
314 {
"Software\\Microsoft\\Internet Explorer\\International",
316 "intl.accept_languages",
320 {
"Software\\Microsoft\\Internet Explorer\\International\\Scripts\\3",
322 "font.name.monospace.x-western",
328 {
"Software\\Microsoft\\Internet Explorer\\Main",
330 "browser.display.use_system_colors",
334 "browser.formfill.enable",
337 "FormSuggest Passwords",
338 "signon.rememberSignons",
345 "browser.startup.homepage",
350 "browser.underline_anchors",
353 "Display Inline Images",
354 "permissions.default.image",
357 "Enable AutoImageResize",
358 "browser.enable_automatic_image_resizing",
362 "accessibility.browsewithcaret",
365 "NotifyDownloadComplete",
366 "browser.download.manager.showAlertOnComplete",
370 "general.smoothScroll",
372 {
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
374 "network.http.version",
378 "network.http.proxy.version",
381 {
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Url History",
383 "browser.history_expire_days",
385 {
"Software\\Microsoft\\Internet Explorer\\Settings",
386 "Always Use My Colors",
387 "browser.display.use_document_colors",
391 "browser.display.foreground_color",
395 "browser.display.background_color",
399 "browser.anchor_color",
402 "Anchor Color Visited",
403 "browser.visited_color",
406 "Always Use My Font Face",
407 "browser.display.use_document_fonts",
409 {
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Url History",
411 "browser.history_expire_days",
416 user_pref(
"font.size.fixed.x-western", 14);
417 user_pref(
"font.size.variable.x-western", 15);
423 nsIEProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup,
const PRUnichar* aProfile)
427 PRBool aReplace = PR_FALSE;
431 rv = aStartup->DoStartup();
432 NS_ENSURE_SUCCESS(rv, rv);
450 nsIEProfileMigrator::GetMigrateData(
const PRUnichar* aProfile,
475 nsIEProfileMigrator::GetSourceExists(PRBool* aResult)
484 nsIEProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
491 nsIEProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
498 nsIEProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
500 nsCOMPtr<nsIWindowsRegKey> regKey =
501 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
503 NS_FAILED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
508 NS_NAMED_LITERAL_STRING(homeURLValName,
"Start Page");
509 nsAutoString homeURLVal;
511 if (NS_SUCCEEDED(regKey->ReadStringValue(homeURLValName, homeURLVal))) {
516 nsCAutoString homePageURL;
517 nsCOMPtr<nsIURI> homePageURI;
519 if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(homePageURI), homeURLVal))) {
520 if (NS_SUCCEEDED(homePageURI->GetSpec(homePageURL)) && !homePageURL.IsEmpty()) {
521 aResult.Assign(homePageURL);
529 NS_NAMED_LITERAL_STRING(ssRegKeyName,
"Secondary Start Pages");
530 nsAutoString secondaryList;
532 if (NS_SUCCEEDED(regKey->ReadStringValue(ssRegKeyName, secondaryList)) &&
533 !secondaryList.IsEmpty()) {
534 nsTArray<nsCString> parsedList;
535 if (!ParseString(NS_ConvertUTF16toUTF8(secondaryList),
'\0', parsedList))
539 for (PRUint32 index = 0; index < parsedList.Length(); ++index) {
540 nsCOMPtr<nsIURI>
uri;
541 nsCAutoString homePage;
544 if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(uri), parsedList[index]))) {
545 if (NS_SUCCEEDED(uri->GetSpec(homePage)) && !homePage.IsEmpty()) {
546 aResult.AppendLiteral(
"|");
547 aResult.Append(homePage);
563 mObserverService = do_GetService(
"@mozilla.org/observer-service;1");
575 nsCOMPtr<nsIWindowsRegKey> regKey =
576 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
580 NS_NAMED_LITERAL_STRING(
key,
581 "Applications\\iexplore.exe\\shell\\open\\command");
582 if (NS_FAILED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
583 key, nsIWindowsRegKey::ACCESS_QUERY_VALUE)))
587 if (NS_FAILED(regKey->ReadStringValue(EmptyString(), iePath)))
592 ::ExpandEnvironmentStringsW(iePath.get(),
597 nsAutoArrayPtr<PRUnichar> destination(
new PRUnichar[bufLength]);
601 if (!::ExpandEnvironmentStringsW(iePath.get(),
606 iePath = destination;
608 if (StringBeginsWith(iePath, NS_LITERAL_STRING(
"\""))) {
610 PRUint32 index = iePath.FindChar(
'\"', 0);
612 iePath.Cut(index,iePath.Length());
615 nsCOMPtr<nsILocalFile> lf;
616 NS_NewLocalFile(iePath, PR_TRUE, getter_AddRefs(lf));
618 nsCOMPtr<nsILocalFileWin> lfw = do_QueryInterface(lf);
622 nsAutoString ieVersion;
623 if (NS_FAILED(lfw->GetVersionInfoField(
"FileVersion", ieVersion)))
626 if (ieVersion.Length() > 2) {
627 PRUint32 index = ieVersion.FindChar(
'.', 0);
630 ieVersion.Cut(index, ieVersion.Length());
631 PRInt32 ver = wcstol(ieVersion.get(), nsnull, 0);
640 nsIEProfileMigrator::RunBatched(
nsISupports* aUserData)
643 nsCOMPtr<nsISupportsPRUint8> strWrapper(do_QueryInterface(aUserData));
644 NS_ASSERTION(strWrapper,
"Unable to create nsISupportsPRUint8 wrapper!");
645 nsresult rv = strWrapper->GetData(&batchAction);
646 NS_ENSURE_SUCCESS(rv, rv);
648 switch (batchAction) {
662 NS_ENSURE_SUCCESS(rv, rv);
671 nsCOMPtr<nsINavHistoryService>
history =
672 do_GetService(NS_NAVHISTORYSERVICE_CONTRACTID, &rv);
673 NS_ENSURE_SUCCESS(rv, rv);
677 nsCOMPtr<nsISupportsPRUint8> supports =
678 do_CreateInstance(NS_SUPPORTS_PRUINT8_CONTRACTID);
679 NS_ENSURE_TRUE(supports, NS_ERROR_OUT_OF_MEMORY);
680 rv = supports->SetData(batchAction);
681 NS_ENSURE_SUCCESS(rv, rv);
683 rv = history->RunInBatchMode(
this, supports);
684 NS_ENSURE_SUCCESS(rv, rv);
692 nsCOMPtr<nsIBrowserHistory> hist(do_GetService(NS_GLOBALHISTORY2_CONTRACTID));
693 nsCOMPtr<nsIIOService>
ios(do_GetService(NS_IOSERVICE_CONTRACTID));
696 ::CoInitialize(NULL);
698 IUrlHistoryStg2* ieHistory;
699 HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
701 CLSCTX_INPROC_SERVER,
703 reinterpret_cast<void**>(&ieHistory));
705 IEnumSTATURL* enumURLs;
706 hr = ieHistory->EnumUrls(&enumURLs);
711 nsCAutoString scheme;
713 PRBool validScheme = PR_FALSE;
714 PRUnichar* tempTitle = nsnull;
716 for (
int count = 0; (hr = enumURLs->Next(1, &statURL, &fetched)) == S_OK; ++
count) {
717 if (statURL.pwcsUrl) {
719 tempTitle = statURL.pwcsTitle ? (PRUnichar*)((
wchar_t*)(statURL.pwcsTitle)) : nsnull;
722 ::FileTimeToSystemTime(&(statURL.ftLastVisited), &st);
724 prt.tm_year = st.wYear;
725 prt.tm_month = st.wMonth - 1;
726 prt.tm_mday = st.wDay;
727 prt.tm_hour = st.wHour;
728 prt.tm_min = st.wMinute;
729 prt.tm_sec = st.wSecond;
730 prt.tm_usec = st.wMilliseconds * 1000;
733 prt.tm_params.tp_gmt_offset = 0;
734 prt.tm_params.tp_dst_offset = 0;
735 PRTime lastVisited = PR_ImplodeTime(&prt);
738 url = statURL.pwcsUrl;
740 NS_ConvertUTF16toUTF8 urlStr(url);
742 if (NS_FAILED(ios->ExtractScheme(urlStr, scheme))) {
743 ::CoTaskMemFree(statURL.pwcsUrl);
744 if (statURL.pwcsTitle)
745 ::CoTaskMemFree(statURL.pwcsTitle);
754 const char* schemes[] = {
"http",
"https",
"ftp",
"file" };
755 for (
int i = 0;
i < 4; ++
i) {
756 if (validScheme = scheme.Equals(schemes[
i]))
762 nsCOMPtr<nsIURI>
uri;
763 ios->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri));
766 hist->AddPageWithDetails(uri, tempTitle, lastVisited);
768 hist->AddPageWithDetails(uri, url, lastVisited);
771 ::CoTaskMemFree(statURL.pwcsUrl);
773 if (statURL.pwcsTitle)
774 ::CoTaskMemFree(statURL.pwcsTitle);
776 nsCOMPtr<nsIRDFRemoteDataSource> ds(do_QueryInterface(hist));
783 ieHistory->Release();
788 nsCOMPtr<nsIWindowsRegKey> regKey =
789 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
791 NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
797 nsAutoString valueName;
798 if (NS_FAILED(regKey->GetValueName(offset, valueName)))
802 if (Substring(valueName, 0, 3).EqualsLiteral(
"url") &&
803 NS_SUCCEEDED(regKey->ReadStringValue(valueName, url))) {
804 nsCOMPtr<nsIURI>
uri;
805 ios->NewURI(NS_ConvertUTF16toUTF8(url), nsnull, nsnull,
806 getter_AddRefs(uri));
808 hist->MarkPageAsTyped(uri);
882 static GUID
IEPStoreAutocompGUID = { 0xe161255a, 0x37c3, 0x11d2, { 0xbc, 0xaa, 0x00, 0xc0, 0x4f, 0xd9, 0x29, 0xdb } };
883 static GUID
IEPStoreSiteAuthGUID = { 0x5e7e8100, 0x9138, 0x11d1, { 0x94, 0x5a, 0x00, 0xc0, 0x4f, 0xc3, 0x08, 0xff } };
940 nsTArray<SignonData> signonsFound;
942 HMODULE pstoreDLL = ::LoadLibraryW(L
"pstorec.dll");
947 return NS_ERROR_FAILURE;
952 hr = PStoreCreateInstance(&PStore, 0, 0, 0);
955 if (NS_SUCCEEDED(rv))
980 NS_ENSURE_ARG_POINTER(aPStore);
982 nsCOMPtr<nsILoginManagerIEMigrationHelper> pwmgr(
983 do_GetService(
"@mozilla.org/login-manager/storage/legacy;1"));
988 IEnumPStoreItemsPtr enumItems = NULL;
989 hr = aPStore->EnumItems(0, &IEPStoreSiteAuthGUID, &mtGuid, 0, &enumItems);
990 if (SUCCEEDED(hr) && enumItems != NULL) {
991 LPWSTR itemName = NULL;
992 while ((enumItems->Next(1, &itemName, 0) == S_OK) && itemName) {
993 unsigned long count = 0;
994 unsigned char*
data = NULL;
996 hr = aPStore->ReadItem(0, &IEPStoreSiteAuthGUID, &mtGuid, itemName,
997 &count, &data, NULL, 0);
998 if (SUCCEEDED(hr) && data) {
1000 unsigned char* password = NULL;
1001 for (i = 0; i <
count; i++)
1002 if (data[i] ==
':') {
1005 password = &data[i + 1];
1009 nsAutoString host(itemName), realm;
1010 if (Substring(host, 0, 6).EqualsLiteral(
"DPAPI:"))
1015 idx = host.FindChar(
'/');
1017 realm.Assign(Substring(host, idx + 1));
1018 host.Assign(Substring(host, 0, idx));
1024 nsCOMPtr<nsILoginInfo> aLogin (do_CreateInstance(
1025 NS_LOGININFO_CONTRACTID, &rv));
1026 NS_ENSURE_SUCCESS(rv, rv);
1030 aLogin->SetHostname(host);
1031 aLogin->SetHttpRealm(realm);
1032 aLogin->SetUsername(NS_ConvertUTF8toUTF16((
char *)data));
1033 aLogin->SetPassword(NS_ConvertUTF8toUTF16((
char *)password));
1034 aLogin->SetUsernameField(EmptyString());
1035 aLogin->SetPasswordField(EmptyString());
1037 pwmgr->MigrateAndAddLogin(aLogin);
1039 ::CoTaskMemFree(data);
1051 NS_ENSURE_ARG_POINTER(aPStore);
1053 IEnumPStoreItemsPtr enumItems = NULL;
1054 hr = aPStore->EnumItems(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, 0, &enumItems);
1055 if (SUCCEEDED(hr) && enumItems != NULL) {
1056 LPWSTR itemName = NULL;
1057 while ((enumItems->Next(1, &itemName, 0) == S_OK) && itemName) {
1058 unsigned long count = 0;
1059 unsigned char*
data = NULL;
1063 hr = aPStore->ReadItem(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, itemName, &count, &data, NULL, 0);
1064 if (SUCCEEDED(hr) && data) {
1065 nsAutoString itemNameString(itemName);
1066 if (StringTail(itemNameString, 11).
1067 LowerCaseEqualsLiteral(
":stringdata")) {
1069 const nsAString&
key = Substring(itemNameString, 0, itemNameString.Length() - 11);
1070 char* realm = nsnull;
1074 unsigned char* username = NULL;
1075 unsigned char* pass = NULL;
1078 if (username && pass) {
1085 return NS_ERROR_OUT_OF_MEMORY;
1086 d->
user = (PRUnichar*)username;
1087 d->
pass = (PRUnichar*)pass;
1103 nsCOMPtr<nsIURI>
uri;
1105 if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), aKey)))
1108 PRBool validScheme = PR_FALSE;
1109 const char* schemes[] = {
"http",
"https" };
1110 for (
int i = 0;
i < 2; ++
i) {
1111 uri->SchemeIs(schemes[
i], &validScheme);
1113 nsCAutoString realm;
1114 uri->GetScheme(realm);
1115 realm.AppendLiteral(
"://");
1121 *aRealm = ToNewCString(realm);
1133 IEnumPStoreItemsPtr enumItems = NULL;
1134 hr = aPStore->EnumItems(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, 0, &enumItems);
1135 if (SUCCEEDED(hr) && enumItems != NULL) {
1136 LPWSTR itemName = NULL;
1137 while ((enumItems->Next(1, &itemName, 0) == S_OK) && itemName) {
1138 unsigned long count = 0;
1139 unsigned char*
data = NULL;
1141 hr = aPStore->ReadItem(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, itemName, &count, &data, NULL, 0);
1142 if (SUCCEEDED(hr) && data) {
1143 nsAutoString itemNameString(itemName);
1144 if (StringTail(itemNameString, 11).
1145 LowerCaseEqualsLiteral(
":stringdata")) {
1147 const nsAString&
key = Substring(itemNameString, 0, itemNameString.Length() - 11);
1152 if (!
KeyIsURI(key, getter_Copies(realm))) {
1158 ::CoTaskMemFree(data);
1164 PRUint32 signonCount = aSignonsFound->Length();
1165 for (PRUint32
i = 0;
i < signonCount; ++
i) {
1167 ::CoTaskMemFree(sd.
user);
1170 aSignonsFound->Clear();
1178 nsCOMPtr<nsILoginManagerIEMigrationHelper> pwmgr(
1179 do_GetService(
"@mozilla.org/login-manager/storage/legacy;1"));
1183 PRUnichar* cursor =
aData;
1185 PRUint32 signonCount = aSignonsFound->Length();
1187 while (offset < aCount) {
1188 nsAutoString curr; curr = cursor;
1191 for (PRUint32
i = 0;
i < signonCount; ++
i) {
1193 if (curr.Equals(sd.
user)) {
1195 nsDependentString usernameStr(sd.
user), passStr(sd.
pass);
1196 nsAutoString realm(NS_ConvertUTF8toUTF16(sd.
realm));
1200 nsCOMPtr<nsILoginInfo> aLogin (do_CreateInstance(NS_LOGININFO_CONTRACTID, &rv));
1201 NS_ENSURE_SUCCESS(rv, );
1209 aLogin->SetHostname(realm);
1210 aLogin->SetFormSubmitURL(EmptyString());
1211 aLogin->SetUsername(usernameStr);
1212 aLogin->SetPassword(passStr);
1213 aLogin->SetUsernameField(aKey);
1214 aLogin->SetPasswordField(EmptyString());
1216 pwmgr->MigrateAndAddLogin(aLogin);
1221 PRInt32 advance = curr.Length() + 1;
1233 unsigned char* temp =
data;
1235 for (
unsigned int i = 0;
i < len;
i += 2, temp += 2*
sizeof(
unsigned char)) {
1236 if (*temp ==
'\0') {
1237 *pass = temp + 2*
sizeof(
unsigned char);
1265 HMODULE pstoreDLL = ::LoadLibraryW(L
"pstorec.dll");
1270 return NS_ERROR_FAILURE;
1274 IPStorePtr PStore = NULL;
1275 hr = PStoreCreateInstance(&PStore, 0, 0, 0);
1276 if (FAILED(hr) || PStore == NULL)
1279 IEnumPStoreItemsPtr enumItems = NULL;
1280 hr = PStore->EnumItems(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, 0, &enumItems);
1281 if (SUCCEEDED(hr) && enumItems != NULL) {
1282 LPWSTR itemName = NULL;
1283 while ((enumItems->Next(1, &itemName, 0) == S_OK) && itemName) {
1284 unsigned long count = 0;
1285 unsigned char*
data = NULL;
1288 hr = PStore->ReadItem(0, &IEPStoreAutocompGUID, &IEPStoreAutocompGUID, itemName, &count, &data, NULL, 0);
1289 if (SUCCEEDED(hr) && data) {
1290 nsAutoString itemNameString(itemName);
1291 if (StringTail(itemNameString, 11).
1292 LowerCaseEqualsLiteral(
":stringdata")) {
1294 const nsAString&
key = Substring(itemNameString, 0, itemNameString.Length() - 11);
1296 if (!
KeyIsURI(key, getter_Copies(realm))) {
1298 if (NS_FAILED(rv))
return rv;
1310 nsCOMPtr<nsIFormHistory2> formHistory(do_GetService(
"@mozilla.org/satchel/form-history;1"));
1312 return NS_ERROR_OUT_OF_MEMORY;
1314 PRUnichar* cursor =
aData;
1317 while (offset < aCount) {
1318 nsAutoString curr; curr = cursor;
1320 formHistory->AddEntry(aKey, curr);
1323 PRInt32 advance = curr.Length() + 1;
1340 nsCOMPtr<nsINavBookmarksService> bookmarks =
1341 do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);
1342 NS_ENSURE_SUCCESS(rv, rv);
1346 nsCOMPtr<nsISupportsPRUint8> supports =
1347 do_CreateInstance(NS_SUPPORTS_PRUINT8_CONTRACTID);
1348 NS_ENSURE_TRUE(supports, NS_ERROR_OUT_OF_MEMORY);
1349 rv = supports->SetData(batchAction);
1350 NS_ENSURE_SUCCESS(rv, rv);
1352 rv = bookmarks->RunInBatchMode(
this, supports);
1353 NS_ENSURE_SUCCESS(rv, rv);
1366 nsCOMPtr<nsINavBookmarksService> bms =
1367 do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);
1368 NS_ENSURE_SUCCESS(rv, rv);
1370 PRInt64 bookmarksMenuFolderId;
1371 rv = bms->GetBookmarksMenuFolder(&bookmarksMenuFolderId);
1372 NS_ENSURE_SUCCESS(rv, rv);
1374 nsAutoString personalToolbarFolderName;
1377 nsCOMPtr<nsIStringBundleService> bundleService =
1378 do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
1379 NS_ENSURE_SUCCESS(rv, rv);
1380 nsCOMPtr<nsIStringBundle>
bundle;
1382 getter_AddRefs(bundle));
1383 NS_ENSURE_SUCCESS(rv, rv);
1385 nsString sourceNameIE;
1386 rv = bundle->GetStringFromName(NS_LITERAL_STRING(
"sourceNameIE").
get(),
1387 getter_Copies(sourceNameIE));
1388 NS_ENSURE_SUCCESS(rv, rv);
1390 const PRUnichar* sourceNameStrings[] = { sourceNameIE.get() };
1391 nsString importedIEFavsTitle;
1392 rv = bundle->FormatStringFromName(NS_LITERAL_STRING(
"importedBookmarksFolder").
get(),
1393 sourceNameStrings, 1,
1394 getter_Copies(importedIEFavsTitle));
1395 NS_ENSURE_SUCCESS(rv, rv);
1397 rv = bms->CreateFolder(bookmarksMenuFolderId,
1398 NS_ConvertUTF16toUTF8(importedIEFavsTitle),
1399 nsINavBookmarksService::DEFAULT_INDEX,
1401 NS_ENSURE_SUCCESS(rv, rv);
1405 nsCOMPtr<nsIFile> profile;
1408 NS_ENSURE_SUCCESS(rv, rv);
1412 nsCOMPtr<nsIWindowsRegKey> regKey =
1413 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
1415 NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
1418 nsAutoString linksFolderName;
1419 if (NS_SUCCEEDED(regKey->ReadStringValue(
1420 NS_LITERAL_STRING(
"LinksFolderName"),
1422 personalToolbarFolderName = linksFolderName;
1424 folder = bookmarksMenuFolderId;
1427 nsCOMPtr<nsIProperties> fileLocator =
1428 do_GetService(
"@mozilla.org/file/directory_service;1", &rv);
1429 NS_ENSURE_SUCCESS(rv, rv);
1430 nsCOMPtr<nsIFile> favoritesDirectory;
1431 (void)fileLocator->Get(
"Favs", NS_GET_IID(nsIFile),
1432 getter_AddRefs(favoritesDirectory));
1438 if (favoritesDirectory) {
1440 personalToolbarFolderName, PR_TRUE);
1441 NS_ENSURE_SUCCESS(rv, rv);
1449 PRInt64 aParentFolder)
1453 nsCOMPtr<nsIWindowsRegKey> regKey =
1454 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
1456 NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
1460 nsCOMPtr<nsIStringBundleService> bundleService =
1461 do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
1462 NS_ENSURE_SUCCESS(rv, rv);
1463 nsCOMPtr<nsIStringBundle>
bundle;
1465 getter_AddRefs(bundle));
1466 NS_ENSURE_SUCCESS(rv, rv);
1468 PRInt64 keywordsFolder = 0;
1471 nsAutoString keyName;
1472 if (NS_FAILED(regKey->GetChildName(offset, keyName)))
1475 if (!keywordsFolder) {
1476 nsString sourceNameIE;
1477 rv = bundle->GetStringFromName(NS_LITERAL_STRING(
"sourceNameIE").
get(),
1478 getter_Copies(sourceNameIE));
1479 NS_ENSURE_SUCCESS(rv, rv);
1481 const PRUnichar* sourceNameStrings[] = { sourceNameIE.get() };
1482 nsString importedIESearchUrlsTitle;
1483 rv = bundle->FormatStringFromName(NS_LITERAL_STRING(
"importedSearchURLsFolder").
get(),
1484 sourceNameStrings, 1,
1485 getter_Copies(importedIESearchUrlsTitle));
1486 NS_ENSURE_SUCCESS(rv, rv);
1487 rv = aBMS->CreateFolder(aParentFolder,
1488 NS_ConvertUTF16toUTF8(importedIESearchUrlsTitle),
1489 nsINavBookmarksService::DEFAULT_INDEX,
1491 NS_ENSURE_SUCCESS(rv, rv);
1494 nsCOMPtr<nsIWindowsRegKey> childKey;
1495 if (NS_SUCCEEDED(regKey->OpenChild(keyName,
1497 getter_AddRefs(childKey)))) {
1499 if (NS_SUCCEEDED(childKey->ReadStringValue(EmptyString(), url))) {
1500 nsCOMPtr<nsIURI>
uri;
1501 if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), url))) {
1502 NS_WARNING(
"Invalid url while importing smart keywords of MS IE");
1508 rv = aBMS->InsertBookmark(keywordsFolder, uri,
1509 nsINavBookmarksService::DEFAULT_INDEX,
1510 NS_ConvertUTF16toUTF8(keyName),
1512 NS_ENSURE_SUCCESS(rv, rv);
1529 IUniformResourceLocatorW* urlLink = nsnull;
1530 result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
1531 IID_IUniformResourceLocatorW, (
void**)&urlLink);
1532 if (SUCCEEDED(result) && urlLink) {
1533 IPersistFile* urlFile = nsnull;
1534 result = urlLink->QueryInterface(IID_IPersistFile, (
void**)&urlFile);
1535 if (SUCCEEDED(result) && urlFile) {
1536 result = urlFile->Load(aFileName.get(), STGM_READ);
1537 if (SUCCEEDED(result) ) {
1538 LPWSTR lpTemp = nsnull;
1539 result = urlLink->GetURL(&lpTemp);
1540 if (SUCCEEDED(result) && lpTemp) {
1541 *aOutURL = (
char*)ToNewUTF8String(nsDependentString(lpTemp));
1543 ::CoTaskMemFree(lpTemp);
1554 PRInt64 aParentFolder,
1555 nsINavBookmarksService* aBMS,
1556 const nsAString& aPersonalToolbarFolderName,
1557 PRBool aIsAtRootLevel)
1561 nsCOMPtr<nsISimpleEnumerator> entries;
1562 rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
1563 NS_ENSURE_SUCCESS(rv, rv);
1567 rv = entries->HasMoreElements(&hasMore);
1568 if (NS_FAILED(rv) || !hasMore)
break;
1570 nsCOMPtr<nsISupports> supp;
1571 rv = entries->GetNext(getter_AddRefs(supp));
1572 if (NS_FAILED(rv))
break;
1574 nsCOMPtr<nsIFile> currFile(do_QueryInterface(supp));
1576 nsCOMPtr<nsIURI>
uri;
1577 rv = NS_NewFileURI(getter_AddRefs(uri), currFile);
1578 if (NS_FAILED(rv))
break;
1580 nsAutoString bookmarkName;
1581 currFile->GetLeafName(bookmarkName);
1583 PRBool isSymlink = PR_FALSE;
1584 PRBool isDir = PR_FALSE;
1586 currFile->IsSymlink(&isSymlink);
1587 currFile->IsDirectory(&isDir);
1596 rv = currFile->GetTarget(path);
1597 if (NS_FAILED(rv))
continue;
1599 nsCOMPtr<nsILocalFile> localFile;
1600 rv = NS_NewLocalFile(path, PR_TRUE, getter_AddRefs(localFile));
1601 if (NS_FAILED(rv))
continue;
1605 rv = localFile->IsDirectory(&isDir);
1606 NS_ENSURE_SUCCESS(rv, rv);
1607 if (!isDir)
continue;
1610 NS_NAMED_LITERAL_STRING(lnkExt,
".lnk");
1611 PRInt32 lnkExtStart = bookmarkName.Length() - lnkExt.Length();
1612 if (StringEndsWith(bookmarkName, lnkExt,
1613 CaseInsensitiveCompare))
1614 bookmarkName.SetLength(lnkExtStart);
1616 nsCOMPtr<nsIURI> bookmarkURI;
1617 rv = NS_NewFileURI(getter_AddRefs(bookmarkURI), localFile);
1618 if (NS_FAILED(rv))
continue;
1620 rv = aBMS->InsertBookmark(aParentFolder, bookmarkURI,
1621 nsINavBookmarksService::DEFAULT_INDEX,
1622 NS_ConvertUTF16toUTF8(bookmarkName),
1624 if (NS_FAILED(rv))
continue;
1628 if (bookmarkName.Equals(aPersonalToolbarFolderName)) {
1629 rv = aBMS->GetToolbarFolder(&folderId);
1630 if (NS_FAILED(rv))
break;
1633 rv = aBMS->CreateFolder(aParentFolder,
1634 NS_ConvertUTF16toUTF8(bookmarkName),
1635 nsINavBookmarksService::DEFAULT_INDEX,
1637 if (NS_FAILED(rv))
continue;
1641 aBMS, aPersonalToolbarFolderName,
1643 if (NS_FAILED(rv))
continue;
1646 nsCOMPtr<nsIURL>
url(do_QueryInterface(uri));
1647 nsCAutoString extension;
1649 url->GetFileExtension(extension);
1650 if (!extension.Equals(
"url", CaseInsensitiveCompare))
1653 nsAutoString
name(Substring(bookmarkName, 0,
1654 bookmarkName.Length() - extension.Length() - 1));
1657 currFile->GetPath(path);
1659 nsCString resolvedURL;
1663 rv = NS_NewURI(getter_AddRefs(resolvedURI), resolvedURL);
1664 if (NS_FAILED(rv))
continue;
1666 rv = aBMS->InsertBookmark(aParentFolder, resolvedURI,
1667 nsINavBookmarksService::DEFAULT_INDEX,
1668 NS_ConvertUTF16toUTF8(name), &
id);
1669 if (NS_FAILED(rv))
continue;
1680 PRBool regKeyOpen = PR_FALSE;
1682 *endEntry = gRegEntries + NS_ARRAY_LENGTH(gRegEntries);
1685 nsCOMPtr<nsIPrefBranch>
prefs;
1690 pserve->GetBranch(
"", getter_AddRefs(prefs));
1693 return NS_ERROR_FAILURE;
1695 nsCOMPtr<nsIWindowsRegKey> regKey =
1696 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
1698 return NS_ERROR_UNEXPECTED;
1701 for (entry = gRegEntries; entry < endEntry; ++
entry) {
1707 regKeyOpen = PR_FALSE;
1709 regKeyOpen = NS_SUCCEEDED(regKey->
1710 Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
1711 NS_ConvertASCIItoUTF16(
1719 NS_ConvertASCIItoUTF16(
1725 if (NS_FAILED(rv))
return rv;
1728 if (NS_FAILED(rv))
return rv;
1740 nsresult rv =
NS_OK;
1742 nsCOMPtr<nsIFile> cookiesDir;
1743 nsCOMPtr<nsISimpleEnumerator> cookieFiles;
1745 nsCOMPtr<nsICookieManager2>
cookieManager(do_GetService(NS_COOKIEMANAGER_CONTRACTID));
1747 return NS_ERROR_FAILURE;
1750 NS_GetSpecialDirectory(NS_WIN_COOKIES_DIR, getter_AddRefs(cookiesDir));
1752 return NS_ERROR_FAILURE;
1755 nsCOMPtr<nsIWindowsRegKey> regKey =
1756 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
1758 NS_NAMED_LITERAL_STRING(regPath,
"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
1759 if (NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
1761 nsIWindowsRegKey::ACCESS_QUERY_VALUE))) {
1763 if (NS_SUCCEEDED(regKey->ReadIntValue(NS_LITERAL_STRING(
"EnableLUA"),
1770 cookiesDir->GetLeafName(dir);
1771 if (!dir.EqualsLiteral(
"Low"))
1772 cookiesDir->Append(NS_LITERAL_STRING(
"Low"));
1777 cookiesDir->GetDirectoryEntries(getter_AddRefs(cookieFiles));
1779 return NS_ERROR_FAILURE;
1783 ::GetEnvironmentVariableW(L
"USERNAME", username,
1784 sizeof(username)/
sizeof(PRUnichar));
1786 wcscat(username, L
"@");
1787 int usernameLength = wcslen(username);
1792 return NS_ERROR_OUT_OF_MEMORY;
1797 PRBool moreFiles = PR_FALSE;
1798 if (NS_FAILED(cookieFiles->HasMoreElements(&moreFiles)) || !moreFiles)
1801 nsCOMPtr<nsISupports> supFile;
1802 cookieFiles->GetNext(getter_AddRefs(supFile));
1803 nsCOMPtr<nsIFile> cookieFile(do_QueryInterface(supFile));
1805 rv = NS_ERROR_FAILURE;
1810 nsAutoString fileName;
1811 cookieFile->GetLeafName(fileName);
1812 const nsAString &fileOwner = Substring(fileName, 0, usernameLength);
1813 if (!fileOwner.Equals(username, CaseInsensitiveCompare))
1819 if (NS_FAILED(cookieFile->GetFileSize(&llFileSize)))
1822 PRUint32 fileSize, readSize;
1823 LL_L2UI(fileSize, llFileSize);
1824 if (fileSize >= fileContentsSize) {
1825 PR_Free(fileContents);
1826 fileContents = (
char *) PR_Malloc(fileSize+1);
1827 if (!fileContents) {
1828 rv = NS_ERROR_FAILURE;
1831 fileContentsSize = fileSize;
1836 nsCOMPtr<nsILocalFile> localCookieFile(do_QueryInterface(cookieFile));
1837 if (localCookieFile &&
1838 NS_SUCCEEDED(localCookieFile->OpenNSPRFileDesc(
PR_RDONLY, 0444, &fd))) {
1840 readSize = PR_Read(fd, fileContents, fileSize);
1843 if (fileSize == readSize) {
1846 if (NS_FAILED(onerv))
1853 PR_Free(fileContents);
1861 PRUint32 aBufferLength,
1862 nsICookieManager2 *aCookieManager)
1864 nsresult rv =
NS_OK;
1866 const char *bufferEnd = aBuffer + aBufferLength;
1873 *expirationDate1, *expirationDate2,
1874 *creationDate1, *creationDate2,
1877 time_t expirationDate,
1880 *hostCopyConstructor,
1895 if (terminator >= bufferEnd)
1903 ::sscanf(flags,
"%d", &flagsValue);
1909 hostCopyConstructor = hostCopy;
1913 if (*host && *host !=
'.' && *host !=
'/')
1914 *hostCopyConstructor++ =
'.';
1917 for (path = host; *path && *path !=
'/'; ++
path)
1919 int hostLength = path - host;
1920 if (hostLength > hostCopyEnd - hostCopyConstructor)
1921 hostLength = hostCopyEnd - hostCopyConstructor;
1922 PL_strncpy(hostCopyConstructor, host, hostLength);
1923 hostCopyConstructor += hostLength;
1925 *hostCopyConstructor =
'\0';
1927 nsDependentCString stringName(name),
1931 if (hostCopy[0] ==
'.')
1932 aCookieManager->Remove(nsDependentCString(hostCopy+1),
1933 stringName, stringPath, PR_FALSE);
1937 onerv = aCookieManager->Add(nsDependentCString(hostCopy),
1940 nsDependentCString(value),
1944 PRInt64(expirationDate));
1945 if (NS_FAILED(onerv)) {
1950 }
while(aBuffer < bufferEnd);
1968 const char *aBufferEnd,
1971 char *scan = *aBuffer;
1973 while (scan < aBufferEnd && (*scan !=
'\r' && *scan !=
'\n'))
1975 if (scan+1 < aBufferEnd && (*(scan+1) ==
'\r' || *(scan+1) ==
'\n') &&
1976 *scan != *(scan+1)) {
1980 if (scan <= aBufferEnd)
1990 const char *aHighDateIntString)
1993 SYSTEMTIME systemTime;
1997 ::sscanf(aLowDateIntString,
"%ld", &fileTime.dwLowDateTime);
1998 ::sscanf(aHighDateIntString,
"%ld", &fileTime.dwHighDateTime);
1999 ::FileTimeToSystemTime(&fileTime, &systemTime);
2000 tTime.tm_year = systemTime.wYear - 1900;
2001 tTime.tm_mon = systemTime.wMonth-1;
2002 tTime.tm_mday = systemTime.wDay;
2003 tTime.tm_hour = systemTime.wHour;
2004 tTime.tm_min = systemTime.wMinute;
2005 tTime.tm_sec = systemTime.wSecond;
2006 tTime.tm_isdst = -1;
2007 rv = ::mktime(&tTime);
2008 return rv < 0 ? 0 : rv;
2016 nsresult rv =
NS_OK;
2019 nsCOMPtr<nsIWindowsRegKey> regKey =
2020 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
2022 return NS_ERROR_UNEXPECTED;
2024 NS_NAMED_LITERAL_STRING(styleKey,
2025 "Software\\Microsoft\\Internet Explorer\\Styles");
2026 if (NS_FAILED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
2030 NS_NAMED_LITERAL_STRING(myStyleValName,
"Use My StyleSheet");
2031 PRUint32 type, useMyStyle;
2032 if (NS_SUCCEEDED(regKey->GetValueType(myStyleValName, &type)) &&
2033 type == nsIWindowsRegKey::TYPE_INT &&
2034 NS_SUCCEEDED(regKey->ReadIntValue(myStyleValName, &useMyStyle)) &&
2037 nsAutoString tridentFilename;
2038 if (NS_SUCCEEDED(regKey->ReadStringValue(
2039 NS_LITERAL_STRING(
"User Stylesheet"), tridentFilename))) {
2043 nsCOMPtr<nsILocalFile> tridentFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
2047 tridentFile->InitWithPath(tridentFilename);
2048 tridentFile->Exists(&exists);
2051 nsCOMPtr<nsIFile> chromeDir;
2052 NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR,
2053 getter_AddRefs(chromeDir));
2055 rv = tridentFile->CopyTo(chromeDir,
2056 NS_LITERAL_STRING(
"userContent.css"));
2067 nsCOMPtr<nsIFile> userChrome;
2072 NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR, getter_AddRefs(userChrome));
2076 userChrome->Exists(&exists);
2078 NS_FAILED(userChrome->Create(nsIFile::DIRECTORY_TYPE, 0755)))
2082 userChrome->Append(NS_LITERAL_STRING(
"userContent.css"));
2083 *aUserFile = userChrome;
2084 NS_ADDREF(*aUserFile);
2091 nsCOMPtr<nsIWindowsRegKey> regKey =
2092 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
2093 NS_NAMED_LITERAL_STRING(
key,
2094 "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
2096 NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
2100 if (NS_SUCCEEDED(regKey->ReadIntValue(NS_LITERAL_STRING(
"SecureProtocols"),
2102 aPrefs->SetBoolPref(
"security.enable_ssl2", (value >> 3) & PR_TRUE);
2103 aPrefs->SetBoolPref(
"security.enable_ssl3", (value >> 5) & PR_TRUE);
2104 aPrefs->SetBoolPref(
"security.enable_tls", (value >> 7) & PR_TRUE);
2122 nsCOMPtr<nsIWindowsRegKey> regKey =
2123 do_CreateInstance(
"@mozilla.org/windows-registry-key;1");
2124 NS_NAMED_LITERAL_STRING(
key,
2125 "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
2127 NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
2131 PRUint32 proxyType = 0;
2134 if (NS_SUCCEEDED(regKey->
2135 ReadStringValue(NS_LITERAL_STRING(
"AutoConfigURL"), buf))) {
2144 if (NS_SUCCEEDED(regKey->
2145 ReadIntValue(NS_LITERAL_STRING(
"ProxyEnable"), &enabled))) {
2150 aPrefs->SetIntPref(
"network.proxy.type", proxyType);
2152 if (NS_SUCCEEDED(regKey->
2153 ReadStringValue(NS_LITERAL_STRING(
"ProxyOverride"), buf)))
2156 if (NS_SUCCEEDED(regKey->
2157 ReadStringValue(NS_LITERAL_STRING(
"ProxyServer"), buf))) {
2160 {
"ftp=", 4, PR_FALSE,
"network.proxy.ftp",
2161 "network.proxy.ftp_port" },
2162 {
"gopher=", 7, PR_FALSE,
"network.proxy.gopher",
2163 "network.proxy.gopher_port" },
2164 {
"http=", 5, PR_FALSE,
"network.proxy.http",
2165 "network.proxy.http_port" },
2166 {
"https=", 6, PR_FALSE,
"network.proxy.ssl",
2167 "network.proxy.ssl_port" },
2168 {
"socks=", 6, PR_FALSE,
"network.proxy.socks",
2169 "network.proxy.socks_port" },
2172 PRInt32 startIndex = 0,
count = 0;
2173 PRBool foundSpecificProxy = PR_FALSE;
2174 for (PRUint32
i = 0;
i < 5; ++
i) {
2175 PRInt32
offset = buf.Find(NS_ConvertASCIItoUTF16(data[
i].prefix));
2177 foundSpecificProxy = PR_TRUE;
2183 PRInt32 terminal = buf.FindChar(
';', offset);
2184 count = terminal > startIndex ? terminal - startIndex :
2185 buf.Length() - startIndex;
2189 data[
i].portPref, aPrefs);
2193 if (!foundSpecificProxy) {
2197 for (PRUint32
i = 0;
i < 5; ++
i)
2199 aPrefs->SetBoolPref(
"network.proxy.share_proxy_settings", PR_TRUE);
const int sHostnameLengthLimit
const unsigned short FORMDATA
nsresult InitializeBookmarks(nsIFile *aTargetProfile)
void TranslateString(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
void TranslateDWORDtoHTTPVersion(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
void TranslateYNtoFT(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
nsresult CopyStyleSheet(PRBool aReplace)
const int sInitialCookieBufferSize
nsresult CopyFavorites(PRBool aReplace)
const unsigned short HISTORY
void ParseOverrideServers(const nsAString &aServers, nsIPrefBranch *aBranch)
static GUID IEPStoreAutocompGUID
HRESULT(WINAPI * PStoreCreateInstancePtr)(IPStore **, DWORD, DWORD, DWORD)
void TranslatePropFont(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
nsresult CopyProxyPreferences(nsIPrefBranch *aPrefs)
static GUID IEPStoreSiteAuthGUID
#define BATCH_ACTION_BOOKMARKS
const NS_PREFSERVICE_CONTRACTID
void TranslateDWORDtoPRInt32(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
void TranslateDRGBtoHRGB(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
void(* regEntryHandler)(nsIWindowsRegKey *, const nsString &, nsIPrefBranch *, char *)
nsresult AddDataToFormHistory(const nsAString &aKey, PRUnichar *data, unsigned long len)
sbDeviceFirmwareAutoCheckForUpdate prototype flags
nsresult ParseFavoritesFolder(nsIFile *aDirectory, PRInt64 aParentFolder, nsINavBookmarksService *aBookmarksService, const nsAString &aPersonalToolbarFolderName, PRBool aIsAtRootLevel)
nsresult CopyHistoryBatched(PRBool aReplace)
nsresult CopyFormData(PRBool aReplace)
const unsigned short SETTINGS
static int CALLBACK fontEnumProc(const LOGFONTW *aLogFont, const TEXTMETRICW *aMetric, DWORD aFontType, LPARAM aClosure)
void GetUserStyleSheetFile(nsIFile **aUserFile)
#define BATCH_ACTION_HISTORY_REPLACE
#define REGISTRY_IE_TYPEDURL_KEY
#define NOTIFY_OBSERVERS(message, item)
void DelimitField(char **aBuffer, const char *aBufferEnd, char **aField)
const regEntry gRegEntries[]
virtual ~nsIEProfileMigrator()
nsresult CopyCookiesFromBuffer(char *aBuffer, PRUint32 aBufferLength, nsICookieManager2 *aCookieManager)
time_t FileTimeToTimeT(const char *aLowDateIntString, const char *aHighDateIntString)
#define MIGRATION_STARTED
#define COPY_DATA(func, replace, itemIndex)
#define TRIDENTPROFILE_BUNDLE
#define REGISTRY_IE_SEARCHURL_KEY
this _dialogInput val(dateText)
void TranslateYNtoTF(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
nsresult MigrateSiteAuthSignons(IPStore *aPStore)
PRBool KeyIsURI(const nsAString &aKey, char **aRealm)
function fileContents(file)
void TranslateYNtoImageBehavior(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
void __stdcall _com_issue_error(HRESULT hr)
void TranslateLanglist(nsIWindowsRegKey *aRegKey, const nsString &aRegValueName, nsIPrefBranch *aPrefs, char *aPrefKeyName)
nsresult CopyPreferences(PRBool aReplace)
void ResolveShortcut(const nsString &aFileName, char **aOutURL)
const unsigned short COOKIES
regEntryHandler entryHandler
void GetUserNameAndPass(unsigned char *data, unsigned long len, unsigned char **username, unsigned char **pass)
StringArrayEnumerator prototype hasMore
nsresult GetSignonsListFromPStore(IPStore *aPStore, nsTArray< SignonData > *aSignonsFound)
nsresult CopySmartKeywords(nsINavBookmarksService *aBMS, PRInt64 aParentFolder)
void SetUnicharPref(const char *aPref, const nsAString &aValue, nsIPrefBranch *aPrefs)
const unsigned short BOOKMARKS
nsresult CopyFavoritesBatched(PRBool aReplace)
#define REGISTRY_IE_MAIN_KEY
void GetProfilePath(nsIProfileStartup *aStartup, nsCOMPtr< nsIFile > &aProfileDir)
#define BATCH_ACTION_HISTORY
void SetProxyPref(const nsAString &aHostPort, const char *aPref, const char *aPortPref, nsIPrefBranch *aPrefs)
nsresult CopyHistory(PRBool aReplace)
restoreHistoryPrecursor aCount
void EnumerateUsernames(const nsAString &aKey, PRUnichar *aData, unsigned long aCount, nsTArray< SignonData > *aSignonsFound)
#define BATCH_ACTION_BOOKMARKS_REPLACE
nsresult CopyPasswords(PRBool aReplace)
const unsigned short PASSWORDS
nsresult ResolveAndMigrateSignons(IPStore *aPStore, nsTArray< SignonData > *aSignonsFound)
_getSelectedPageStyle s i
nsresult CopySecurityPrefs(nsIPrefBranch *aPrefs)
NS_IMPL_ISUPPORTS2(nsIEProfileMigrator, nsIBrowserProfileMigrator, nsINavHistoryBatchCallback)
nsresult CopyCookies(PRBool aReplace)
const int sUsernameLengthLimit
_updateTextAndScrollDataForFrame aData
#define REGISTRY_IE_TOOLBAR_KEY
NS_DECL_NSIBROWSERPROFILEMIGRATOR NS_DECL_NSINAVHISTORYBATCHCALLBACK NS_DECL_ISUPPORTS nsIEProfileMigrator()