Bug 1364337 - Remove a deprecated RemovePages call from WindowsJumpLists.jsm. r=mak
MozReview-Commit-ID: ElQaYVRDpLj
--- 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() {