Bug 983623 - Implement cmd_un/redo for the new async TM. r=mak

This commit is contained in:
Asaf Romano 2014-04-08 08:55:46 +03:00
Родитель 4409a18fbe
Коммит 1b69fb67cd
2 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -3,7 +3,6 @@
* 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");
XPCOMUtils.defineLazyModuleGetter(this, "ForgetAboutSite",
"resource://gre/modules/ForgetAboutSite.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
@ -224,10 +223,18 @@ PlacesController.prototype = {
doCommand: function PC_doCommand(aCommand) {
switch (aCommand) {
case "cmd_undo":
PlacesUtils.transactionManager.undoTransaction();
if (!PlacesUIUtils.useAsyncTransactions) {
PlacesUtils.transactionManager.undoTransaction();
return;
}
PlacesTransactions.undo().then(null, Cu.reportError);
break;
case "cmd_redo":
PlacesUtils.transactionManager.redoTransaction();
if (!PlacesUIUtils.useAsyncTransactions) {
PlacesUtils.transactionManager.redoTransaction();
return;
}
PlacesTransactions.redo().then(null, Cu.reportError);
break;
case "cmd_cut":
case "placesCmd_cut":

Просмотреть файл

@ -24,8 +24,13 @@
var Ci = Components.interfaces;
var Cr = Components.results;
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource:///modules/PlacesUIUtils.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(window,
"PlacesUtils", "resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(window,
"PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(window,
"PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm");
]]></script>
<script type="application/javascript"
src="chrome://browser/content/places/controller.js"/>