Bug 1364337 - Remove a deprecated RemovePages call from WindowsJumpLists.jsm. r=mak
authortiago <tiago.paez11@gmail.com>
Wed, 07 Jun 2017 04:21:18 -0300
changeset 410966 9721edbfbba3c928d3dee5a5abe9b5c9bb12fb05
parent 410965 3ccce79352609fa6604658e1b3fd80ae7f4b9f53
child 410967 3ca93081969bdb74ada3974ce36afa7dd327bbb2
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1364337
milestone55.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 1364337 - Remove a deprecated RemovePages call from WindowsJumpLists.jsm. r=mak MozReview-Commit-ID: ElQaYVRDpLj
browser/modules/WindowsJumpLists.jsm
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -1,22 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* 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/. */
 
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
+ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
 
-/**
- * Constants
- */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 // Stop updating jumplists after some idle time.
 const IDLE_TIMEOUT_SECONDS = 5 * 60;
 
 // Prefs
 const PREF_TASKBAR_BRANCH    = "browser.taskbar.lists.";
 const PREF_TASKBAR_ENABLED   = "enabled";
 const PREF_TASKBAR_ITEMCOUNT = "maxListItemCount";
@@ -47,38 +42,28 @@ XPCOMUtils.defineLazyGetter(this, "_pref
   return Services.prefs.getBranch(PREF_TASKBAR_BRANCH);
 });
 
 XPCOMUtils.defineLazyGetter(this, "_stringBundle", function() {
   return Services.strings
                  .createBundle("chrome://browser/locale/taskbar.properties");
 });
 
-XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
-  Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
-  return PlacesUtils;
-});
-
-XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
-  Components.utils.import("resource://gre/modules/NetUtil.jsm");
-  return NetUtil;
-});
-
 XPCOMUtils.defineLazyServiceGetter(this, "_idle",
                                    "@mozilla.org/widget/idleservice;1",
                                    "nsIIdleService");
-
 XPCOMUtils.defineLazyServiceGetter(this, "_taskbarService",
                                    "@mozilla.org/windows-taskbar;1",
                                    "nsIWinTaskbar");
-
 XPCOMUtils.defineLazyServiceGetter(this, "_winShellService",
                                    "@mozilla.org/browser/shell-service;1",
                                    "nsIWindowsShellService");
 
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+  "resource://gre/modules/PlacesUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 /**
  * Global functions
  */
 
 function _getString(name) {
@@ -432,17 +417,17 @@ this.WinTaskbarJumpList =
             aCallback.call(aScope,
                            { uri: row.getResultByIndex(1)
                            , title: row.getResultByIndex(2)
                            });
           } catch (e) {}
         }
       },
       handleError(aError) {
-        Components.utils.reportError(
+        Cu.reportError(
           "Async execution error (" + aError.result + "): " + aError.message);
       },
       handleCompletion(aReason) {
         aCallback.call(WinTaskbarJumpList, null);
       },
     });
   },
 
@@ -451,22 +436,22 @@ this.WinTaskbarJumpList =
       return;
     var URIsToRemove = [];
     var e = items.enumerate();
     while (e.hasMoreElements()) {
       let oldItem = e.getNext().QueryInterface(Ci.nsIJumpListShortcut);
       if (oldItem) {
         try { // in case we get a bad uri
           let uriSpec = oldItem.app.getParameter(0);
-          URIsToRemove.push(NetUtil.newURI(uriSpec));
+          URIsToRemove.push(Services.io.newURI(uriSpec));
         } catch (err) { }
       }
     }
     if (URIsToRemove.length > 0) {
-      PlacesUtils.bhistory.removePages(URIsToRemove, URIsToRemove.length, true);
+      PlacesUtils.history.remove(URIsToRemove).catch(Cu.reportError);
     }
   },
 
   /**
    * Prefs utilities
    */
 
   _refreshPrefs: function WTBJL__refreshPrefs() {