Commits

Virgil Dupras committed e651430 Draft

Made adjustments suggested by :mak after review.

  • Participants
  • Parent commits 6b3da56

Comments (0)

Files changed (6)

toolkit/components/places/BookmarkHTMLUtils.jsm

     // This special frame popping business, of course, only happens when our
     // frame array has more than one element so we can avoid situations where
     // we don't have a frame to parse into anymore.
-    if ((frame.containerNesting == 0) && (this._frames.length > 1)) {
+    if (frame.containerNesting == 0 && this._frames.length > 1) {
       this._frames.pop();
     }
 

toolkit/components/places/tests/unit/bookmarks_html_singleframe.html

+<!DOCTYPE NETSCAPE-Bookmark-file-1>
+	<HTML>
+	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+	<Title>Bookmarks</Title>
+	<H1>Bookmarks</H1>
+    <DT><H3>Subtitle</H3>
+	<DL><p>
+		<DT><A HREF="http://www.mozilla.org/">Mozilla</A>
+    </DL><p>
+</HTML>

toolkit/components/places/tests/unit/bug801450.html

-<!DOCTYPE NETSCAPE-Bookmark-file-1>
-	<HTML>
-	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
-	<Title>Bookmarks</Title>
-	<H1>Bookmarks</H1>
-    <DT><H3>Subtitle</H3>
-	<DL><p>
-		<DT><A HREF="http://www.mozilla.org/">Mozilla</A>
-    </DL><p>
-</HTML>

toolkit/components/places/tests/unit/test_801450.js

-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* 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/. */
-
-// Get Services
-Cu.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
-
-function run_test() {
-  do_test_pending();
-  var bookmarksFile = do_get_file("bug801450.html");
-  try {
-    BookmarkHTMLUtils.importFromFile(bookmarksFile, true, after_import);
-  } catch(ex) { do_throw("couldn't import bookmarks file: " + ex); }
-}
-
-function after_import(success) {
-  do_check_true(success);
-  root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
-  root.containerOpen = true;
-  do_check_eq(root.childCount, 1);
-  var folder = root.getChild(0);
-  folder = folder.QueryInterface(Ci.nsINavHistoryContainerResultNode);
-  folder.containerOpen = true;
-  do_check_eq(folder.title, "Subtitle");
-  do_check_eq(folder.childCount, 1);
-  var bookmark = folder.getChild(0);
-  do_check_eq(bookmark.uri, "http://www.mozilla.org/")
-  do_check_eq(bookmark.title, "Mozilla")
-  do_test_finished();
-}

toolkit/components/places/tests/unit/test_bookmarks_html_singleframe.js

+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* 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/. */
+
+// Test for bug #801450
+
+// Get Services
+Cu.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
+
+function run_test() {
+  do_test_pending();
+  let bookmarksFile = do_get_file("bookmarks_html_singleframe.html");
+  BookmarkHTMLUtils.importFromFile(bookmarksFile, true, after_import);
+}
+
+function after_import(success) {
+  do_check_true(success);
+  let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
+  root.containerOpen = true;
+  do_check_eq(root.childCount, 1);
+  let folder = root.getChild(0);
+  PlacesUtils.asContainer(folder).containerOpen = true;
+  do_check_eq(folder.title, "Subtitle");
+  do_check_eq(folder.childCount, 1);
+  let bookmark = folder.getChild(0);
+  do_check_eq(bookmark.uri, "http://www.mozilla.org/");
+  do_check_eq(bookmark.title, "Mozilla");
+  PlacesUtils.asContainer(folder).containerOpen = false;
+  root.containerOpen = false;
+  do_test_finished();
+}

toolkit/components/places/tests/unit/xpcshell.ini

 [test_485442_crash_bug_nsNavHistoryQuery_GetUri.js]
 [test_486978_sort_by_date_queries.js]
 [test_536081.js]
-[test_801450.js]
 [test_adaptive.js]
 # Bug 676989: test hangs consistently on Android
 skip-if = os == "android"
 [test_bookmarks_html.js]
 [test_bookmarks_html_corrupt.js]
 [test_bookmarks_restore_notification.js]
+[test_bookmarks_html_singleframe.js]
 [test_bookmarks_setNullTitle.js]
 [test_broken_folderShortcut_result.js]
 [test_browserhistory.js]