Bug 1094864 - Remove unnecessary checks from browser/components/places. r=mak
authorMark Banner <standard8@mozilla.com>
Fri, 22 Sep 2017 10:29:26 +0100
changeset 382890 b8d59e74c0bbffc3c7728b708ea77ecd1b7fa1c7
parent 382889 cd1c3f84f3ec96ace1c361d249b80214fe52f672
child 382891 c2131082228a24d8ae74c12ac846e49ad950c169
push id52036
push usermbanner@mozilla.com
push dateTue, 26 Sep 2017 08:49:33 +0000
treeherderautoland@c2131082228a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1094864
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1094864 - Remove unnecessary checks from browser/components/places. r=mak MozReview-Commit-ID: 46I7XUrmN9V
browser/components/places/tests/browser/browser_0_library_left_pane_migration.js
browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
browser/components/places/tests/browser/browser_bookmarksProperties.js
browser/components/places/tests/browser/browser_copy_folder_tree.js
browser/components/places/tests/browser/browser_cutting_bookmarks.js
browser/components/places/tests/browser/browser_library_left_pane_fixnames.js
browser/components/places/tests/browser/browser_library_views_liveupdate.js
browser/components/places/tests/browser/browser_views_liveupdate.js
browser/components/places/tests/chrome/test_0_multiple_left_pane.xul
--- a/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js
+++ b/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js
@@ -10,19 +10,16 @@
  *  Test we correctly migrate Library left pane to the latest version.
  *  Note: this test MUST be the first between browser chrome tests, or results
  *        of next tests could be unexpected due to PlacesUIUtils getters.
  */
 
 const TEST_URI = "http://www.mozilla.org/";
 
 add_task(async function() {
-  // Sanity checks.
-  ok(PlacesUtils, "PlacesUtils is running in chrome context");
-  ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
   ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0,
      "Left pane version in chrome context, current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION );
 
   // Check if we have any left pane folder already set, remove it eventually.
   let leftPaneItems = PlacesUtils.annotations
                                  .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
   if (leftPaneItems.length > 0) {
     // The left pane has already been created, touching it now would cause
--- a/browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
+++ b/browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
@@ -1,19 +1,14 @@
 /* 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/. */
 
 function test() {
-  // sanity check
-  ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
-  ok(PlacesUIUtils, "checking PlacesUIUtils, running in chrome context?");
-  ok(PlacesControllerDragHelper, "checking PlacesControllerDragHelper, running in chrome context?");
-
   const IDX = PlacesUtils.bookmarks.DEFAULT_INDEX;
 
   // setup
   var rootId = PlacesUtils.bookmarks.createFolder(PlacesUtils.toolbarFolderId, "", IDX);
   var rootNode = PlacesUtils.getFolderContents(rootId, false, true).root;
   is(rootNode.childCount, 0, "confirm test root is empty");
 
   var tests = [];
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -355,20 +355,16 @@ gTests.push({
 });
 
 // ------------------------------------------------------------------------------
 
 add_task(async function test_setup() {
   // This test can take some time, if we timeout too early it could run
   // in the middle of other tests, or hang them.
   requestLongerTimeout(2);
-
-  // Sanity checks.
-  Assert.ok(PlacesUtils, "PlacesUtils in context");
-  Assert.ok(PlacesUIUtils, "PlacesUIUtils in context");
 });
 
 add_task(async function test_run() {
   for (let test of gTests) {
     info(`Start of test: ${test.desc}`);
     await test.setup();
 
     await execute_test_in_sidebar(test);
--- a/browser/components/places/tests/browser/browser_copy_folder_tree.js
+++ b/browser/components/places/tests/browser/browser_copy_folder_tree.js
@@ -13,20 +13,16 @@
  - validate folder B
  - undo copy transaction
  - validate folder B (empty)
  - redo copy transaction
  - validate folder B's contents
 */
 
 add_task(async function() {
-  // sanity check
-  ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
-  ok(PlacesUIUtils, "checking PlacesUIUtils, running in chrome context?");
-
   let toolbarId = PlacesUtils.toolbarFolderId;
   let toolbarNode = PlacesUtils.getFolderContents(toolbarId).root;
 
   let oldCount = toolbarNode.childCount;
   let testRoot = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     type: PlacesUtils.bookmarks.TYPE_FOLDER,
     title: "test root"
--- a/browser/components/places/tests/browser/browser_cutting_bookmarks.js
+++ b/browser/components/places/tests/browser/browser_cutting_bookmarks.js
@@ -12,22 +12,16 @@ add_task(async function() {
   registerCleanupFunction(async function() {
     await promiseLibraryClosed(organizer);
     await PlacesUtils.bookmarks.eraseEverything();
   });
 
   let PlacesOrganizer = organizer.PlacesOrganizer;
   let ContentTree = organizer.ContentTree;
 
-  // Sanity checks.
-  ok(PlacesUtils, "PlacesUtils in scope");
-  ok(PlacesUIUtils, "PlacesUIUtils in scope");
-  ok(PlacesOrganizer, "PlacesOrganizer in scope");
-  ok(ContentTree, "ContentTree is in scope");
-
   // Test with multiple entries to ensure they retain their order.
   let bookmarks = [];
   bookmarks.push(await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: TEST_URL,
     title: "0"
   }));
--- a/browser/components/places/tests/browser/browser_library_left_pane_fixnames.js
+++ b/browser/components/places/tests/browser/browser_library_left_pane_fixnames.js
@@ -29,22 +29,16 @@ function onLibraryReady(organizer) {
       // Close Library window.
       organizer.close();
       // No need to cleanup anything, we have a correct left pane now.
       finish();
 }
 
 function test() {
   waitForExplicitFinish();
-  // Sanity checks.
-  ok(PlacesUtils, "PlacesUtils is running in chrome context");
-  ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
-  ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0,
-     "Left pane version in chrome context, current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION );
-
   // Ensure left pane is initialized.
   ok(PlacesUIUtils.leftPaneFolderId > 0, "left pane folder is initialized");
 
   // Get the left pane folder.
   var leftPaneItems = PlacesUtils.annotations
                                  .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
 
   is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
--- a/browser/components/places/tests/browser/browser_library_views_liveupdate.js
+++ b/browser/components/places/tests/browser/browser_library_views_liveupdate.js
@@ -10,20 +10,16 @@ var gLibrary = null;
 
 function test() {
   waitForExplicitFinish();
   // This test takes quite some time, and timeouts frequently, so we require
   // more time to run.
   // See Bug 525610.
   requestLongerTimeout(2);
 
-  // Sanity checks.
-  ok(PlacesUtils, "PlacesUtils in context");
-  ok(PlacesUIUtils, "PlacesUIUtils in context");
-
   // Open Library, we will check the left pane.
   openLibrary(function(library) {
     gLibrary = library;
     startTest();
   });
 }
 
 /**
--- a/browser/components/places/tests/browser/browser_views_liveupdate.js
+++ b/browser/components/places/tests/browser/browser_views_liveupdate.js
@@ -16,20 +16,16 @@ function test() {
   if (wasCollapsed) {
     promiseSetToolbarVisibility(toolbar, true).then(openBookmarksSidebar);
   } else {
     openBookmarksSidebar();
   }
 }
 
 function openBookmarksSidebar() {
-  // Sanity checks.
-  ok(PlacesUtils, "PlacesUtils in context");
-  ok(PlacesUIUtils, "PlacesUIUtils in context");
-
   // Open bookmarks menu.
   var popup = document.getElementById("bookmarksMenuPopup");
   ok(popup, "Menu popup element exists");
   fakeOpenPopup(popup);
 
   // Open bookmarks sidebar.
   var sidebar = document.getElementById("sidebar");
   sidebar.addEventListener("load", function() {
--- a/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul
+++ b/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul
@@ -32,23 +32,16 @@
 
   <script type="application/javascript">
   <![CDATA[
 
     function runTest() {
       SimpleTest.waitForExplicitFinish();
 
       (async function() {
-        // Sanity checks.
-        ok(PlacesUtils, "PlacesUtils is running in chrome context");
-        ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
-        ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0,
-           "Left pane version in chrome context, " +
-             "current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION );
-
         let fakeLeftPanes = [];
         // We need 2 left pane folders to simulate a corrupt profile.
         do {
           let leftPaneItems = PlacesUtils.annotations.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
 
           // Create a fake left pane folder.
           let folder = await PlacesUtils.bookmarks.insert({
             parentGuid: PlacesUtils.bookmarks.rootGuid,