「Places/トランザクション」の編集履歴(バックアップ)一覧に戻る
Places/トランザクション」を以下のとおり復元します。
-[[トランザクションとは 【 transaction 】 - 意味/解説/説明/定義 : IT用語辞典>http://e-words.jp/w/E38388E383A9E383B3E382B6E382AFE382B7E383A7E383B3.html]]
-[[nsITransactionManager - Mozilla | MDN>https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsITransactionManager]]

*ブックマークの作成
#highlight(javascript){{
var aURI, aParentId, aTitle, aKeyword, aDescription;

Cu.import("resource://gre/modules/PlacesUtils.jsm");
// ブックマークに付けるアノテーションのトランザクション
var childTxns = [];
var annoObj = { name  : PlacesUIUtils.DESCRIPTION_ANNO,
                value : aDescription };
var annoTxn = new PlacesSetItemAnnotationTransaction(-1, annoObj);
childTxns.push(annoTxn);
// ブックマーク作成のトランザクション
var txn = new PlacesCreateBookmarkTransaction(aURI, aParentId,
    PlacesUtils.bookmarks.DEFAULT_INDEX, aTitle, aKeyword, null, childTxns);
// 実行
PlacesUtils.transactionManager.doTransaction(txn); }}
aURI は nsIURI

*フォルダの作成
#highlight(javascript){{
var aTitle, aParentId (, aBmURI, aBmTitle);

Cu.import("resource://gre/modules/PlacesUtils.jsm");
// フォルダ内にブックマークも一緒に作成するなら
var childTxns = [];
var bmTxn = new PlacesCreateBookmarkTransaction(aBmURI, -1,
    PlacesUtils.bookmarks.DEFAULT_INDEX, aBmTitle);
childTxns.push(bmTxn);
// フォルダ作成のトランザクション
var txn = new PlacesCreateFolderTransaction(aTitle, aParentId,
    PlacesUtils.bookmarks.DEFAULT_INDEX, null, childBookmarkTxns);
// 実行
PlacesUtils.transactionManager.doTransaction(txn); }}

*複数のトランザクションの纏め
#highlight(javascript){{
var aTransactions;

Cu.import("resource://gre/modules/PlacesUtils.jsm");
var txn = new PlacesAggregatedTransaction("Create AggregatedTxn", aTransactions);
// 実行
PlacesUtils.transactionManager.doTransaction(txn); }}
aTransactions は複数のトランザクションからなる配列

復元してよろしいですか?