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
parent 25bc521098
commit 4831333e6b
2 changed files with 17 additions and 5 deletions

View File

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ForgetAboutSite", XPCOMUtils.defineLazyModuleGetter(this, "ForgetAboutSite",
"resource://gre/modules/ForgetAboutSite.jsm"); "resource://gre/modules/ForgetAboutSite.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
@ -224,10 +223,18 @@ PlacesController.prototype = {
doCommand: function PC_doCommand(aCommand) { doCommand: function PC_doCommand(aCommand) {
switch (aCommand) { switch (aCommand) {
case "cmd_undo": case "cmd_undo":
PlacesUtils.transactionManager.undoTransaction(); if (!PlacesUIUtils.useAsyncTransactions) {
PlacesUtils.transactionManager.undoTransaction();
return;
}
PlacesTransactions.undo().then(null, Cu.reportError);
break; break;
case "cmd_redo": case "cmd_redo":
PlacesUtils.transactionManager.redoTransaction(); if (!PlacesUIUtils.useAsyncTransactions) {
PlacesUtils.transactionManager.redoTransaction();
return;
}
PlacesTransactions.redo().then(null, Cu.reportError);
break; break;
case "cmd_cut": case "cmd_cut":
case "placesCmd_cut": case "placesCmd_cut":

View File

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