mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 591884 - Make IE importer fallback to the default Links folder to support toolbar favorites in versions >= 7
r=felipe
This commit is contained in:
parent
5822a6d833
commit
3606a4771c
@ -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
|
||||
|
@ -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
browser/components/migration/tests/Makefile.in
Normal file
15
browser/components/migration/tests/Makefile.in
Normal file
@ -0,0 +1,15 @@
|
||||
# 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
browser/components/migration/tests/unit/bookmarks.html
Normal file
16
browser/components/migration/tests/unit/bookmarks.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!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
browser/components/migration/tests/unit/head_migration.js
Normal file
28
browser/components/migration/tests/unit/head_migration.js
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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");
|
||||
}
|
28
browser/components/migration/tests/unit/test_IE_bookmarks.js
Normal file
28
browser/components/migration/tests/unit/test_IE_bookmarks.js
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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/. */
|
||||
|
||||
function run_test() {
|
||||
let migrator = newMigratorFor("ie");
|
||||
|
||||
// Sanity check for the source.
|
||||
do_check_true(migrator.sourceExists);
|
||||
|
||||
// Ensure bookmarks migration is available.
|
||||
let availableSources = migrator.getMigrateData("FieldOfFlowers", false);
|
||||
do_check_true((availableSources & IMIGRATOR.BOOKMARKS) > 0);
|
||||
|
||||
// Needed to enforce bookmarks replacing.
|
||||
let startup = {
|
||||
doStartup: function () {},
|
||||
get directory() do_get_profile()
|
||||
}
|
||||
migrator.migrate(IMIGRATOR.BOOKMARKS, startup, "FieldOfFlowers");
|
||||
|
||||
// Check that at least two bookmark have been added to the menu and the
|
||||
// toolbar. The first one comes from bookmarks.html, the others from IE.
|
||||
do_check_true(PlacesUtils.bookmarks
|
||||
.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 1) > 0);
|
||||
do_check_true(PlacesUtils.bookmarks
|
||||
.getIdForItemAt(PlacesUtils.toolbarFolderId, 1) > 0);
|
||||
}
|
6
browser/components/migration/tests/unit/xpcshell.ini
Normal file
6
browser/components/migration/tests/unit/xpcshell.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
head = head_migration.js
|
||||
tail =
|
||||
|
||||
[test_IE_bookmarks.js]
|
||||
skip-if = os != "win"
|
@ -139,6 +139,7 @@ if [ "$ENABLE_TESTS" ]; then
|
||||
browser/components/shell/test/Makefile
|
||||
browser/components/feeds/test/Makefile
|
||||
browser/components/feeds/test/chrome/Makefile
|
||||
browser/components/migration/tests/Makefile
|
||||
browser/components/places/tests/Makefile
|
||||
browser/components/places/tests/chrome/Makefile
|
||||
browser/components/places/tests/browser/Makefile
|
||||
|
@ -72,6 +72,7 @@ skip-if = os == "android"
|
||||
skip-if = os == "android"
|
||||
[include:browser/components/dirprovider/tests/unit/xpcshell.ini]
|
||||
[include:browser/components/feeds/test/unit/xpcshell.ini]
|
||||
[include:browser/components/migration/tests/unit/xpcshell.ini]
|
||||
[include:browser/components/places/tests/unit/xpcshell.ini]
|
||||
[include:browser/components/privatebrowsing/test/unit/xpcshell.ini]
|
||||
[include:browser/components/shell/test/unit/xpcshell.ini]
|
||||
|
Loading…
Reference in New Issue
Block a user