Commit e2038653 authored by Marco Bonardo's avatar Marco Bonardo
Browse files

Bug 591884 - Make IE importer fallback to the default Links folder to support...

Bug 591884 - Make IE importer fallback to the default Links folder to support toolbar favorites in versions >= 7
r=felipe
parent fa0bd044
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ include $(DEPTH)/config/autoconf.mk

DIRS		= public src

TEST_DIRS += tests

include $(topsrcdir)/config/rules.mk

# Needed for preprocessor removal of IE Profile Migrator label - bug 236901
+9 −1
Original line number Diff line number Diff line
@@ -1412,6 +1412,9 @@ nsIEProfileMigrator::CopyFavoritesBatched(bool aReplace)

    // Locate the Links toolbar folder, we want to replace the Personal Toolbar
    // content with Favorites in this folder.
    // On versions minor or equal to IE6 the folder name is stored in the
    // LinksFolderName registry key, but in newer versions it may be just a
    // Links subfolder inside the default Favorites folder.
    nsCOMPtr<nsIWindowsRegKey> regKey =
      do_CreateInstance("@mozilla.org/windows-registry-key;1");
    if (regKey &&
@@ -1421,9 +1424,14 @@ nsIEProfileMigrator::CopyFavoritesBatched(bool aReplace)
      nsAutoString linksFolderName;
      if (NS_SUCCEEDED(regKey->ReadStringValue(
                         NS_LITERAL_STRING("LinksFolderName"),
                         linksFolderName)))
                         linksFolderName))) {
        personalToolbarFolderName = linksFolderName;
      }
      else {
        personalToolbarFolderName.AssignLiteral("Links");
      }
    }

    folder = bookmarksMenuFolderId;
  }

+15 −0
Original line number Diff line number Diff line
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

DEPTH		  = ../../../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		  = @srcdir@
relativesrcdir = browser/components/migration/tests

include $(DEPTH)/config/autoconf.mk

XPCSHELL_TESTS = unit

include $(topsrcdir)/config/rules.mk
+16 −0
Original line number Diff line number Diff line
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
     It will be read and overwritten.
     DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks Menu</H1>

<DL><p>
    <DT><A HREF="http://example.com/" ADD_DATE="1233157972" LAST_MODIFIED="1233157984">example</A>
    <DT><H3 ADD_DATE="1233157910" LAST_MODIFIED="1233157972" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
    <DL><p>
        <DT><A HREF="http://example.com/" ADD_DATE="1233157972" LAST_MODIFIED="1233157984">example</A>
    </DL><p>
</DL><p>
+28 −0
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;

const IMIGRATOR = Ci.nsIBrowserProfileMigrator;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
                                  "resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
                                  "resource://gre/modules/FileUtils.jsm");

// Initialize profile.
let gProfD = do_get_profile();

function newMigratorFor(aKey) {
  let cid = "@mozilla.org/profile/migrator;1?app=browser&type=" + aKey;
  return Cc[cid].createInstance(Ci.nsIBrowserProfileMigrator);
}

let (bookmarkshtml = do_get_file("bookmarks.html")) {
  bookmarkshtml.copyTo(gProfD, "bookmarks.html");
}
Loading