Bug 1783501 - Convert JsTreeSelection.jsm to an ES Module. r=freaktechnik

... and modernise the test.

Differential Revision: https://phabricator.services.mozilla.com/D170041

--HG--
rename : mailnews/base/src/JsTreeSelection.jsm => mail/base/content/widgets/tree-selection.mjs
rename : mailnews/base/test/unit/test_jsTreeSelection.js => mail/base/test/unit/test_treeSelection.js
extra : rebase_source : 14ef23a72b147a52251dfa00ceba59c8517bc921
extra : amend_source : 10aef17987ef7253cc0bd4bd3737f0f884e1ec22
This commit is contained in:
Geoff Lankow 2023-01-24 17:25:05 +13:00
Родитель 7ffc7de18c
Коммит ebaa761884
13 изменённых файлов: 224 добавлений и 265 удалений

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

@ -22,11 +22,11 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
TreeSelection: "chrome://messenger/content/tree-selection.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
DBViewWrapper: "resource:///modules/DBViewWrapper.jsm",
JSTreeSelection: "resource:///modules/JsTreeSelection.jsm",
NetUtil: "resource://gre/modules/NetUtil.jsm",
});
@ -139,7 +139,7 @@ function displayMessage(uri, viewWrapper) {
gViewWrapper.open(gFolder);
}
gViewWrapper.dbView.selection = new JSTreeSelection();
gViewWrapper.dbView.selection = new TreeSelection();
gViewWrapper.dbView.selection.select(
gViewWrapper.dbView.findIndexOfMsgHdr(gMessage, true)
);

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

@ -10,9 +10,12 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
ChromeUtils.defineESModuleGetters(this, {
TreeSelection: "chrome://messenger/content/tree-selection.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
DBViewWrapper: "resource:///modules/DBViewWrapper.jsm",
JSTreeSelection: "resource:///modules/JsTreeSelection.jsm",
});
var nsMsgKey_None = 0xffffffff;
@ -180,7 +183,7 @@ function FolderDisplayWidget() {
* tab. We'll get rid of this as soon as we've switched to the tab for the
* first time, and have a real tree selection.
*/
this._fakeTreeSelection = new JSTreeSelection(this._fakeTree);
this._fakeTreeSelection = new TreeSelection(this._fakeTree);
this._mostRecentSelectionCounts = [];
this._mostRecentCurrentIndices = [];

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

@ -5,11 +5,9 @@
/* import-globals-from folderDisplay.js */
/* import-globals-from SearchDialog.js */
ChromeUtils.defineModuleGetter(
this,
"JSTreeSelection",
"resource:///modules/JsTreeSelection.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
TreeSelection: "chrome://messenger/content/tree-selection.mjs",
});
var gLastMessageUriToLoad = null;
var gThreadPaneCommandUpdater = null;
@ -29,7 +27,7 @@ var gRightMouseButtonSavedSelection = null;
* When right-clicks happen, we do not want to corrupt the underlying
* selection. The right-click is a transient selection. So, unless the
* user is right-clicking on the current selection, we create a new
* selection object (thanks to JSTreeSelection) and set that as the
* selection object (thanks to TreeSelection) and set that as the
* current/transient selection.
*
* @param aSingleSelect Should the selection we create be a single selection?
@ -57,7 +55,7 @@ function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) {
}
}
let transientSelection = new JSTreeSelection(tree);
let transientSelection = new TreeSelection(tree);
transientSelection.logAdjustSelectionForReplay();
gRightMouseButtonSavedSelection = {

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

@ -2,40 +2,14 @@
* 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/. */
const EXPORTED_SYMBOLS = ["JSTreeSelection"];
/**
* Partial nsITreeSelection implementation so that we can have nsMsgDBViews that
* exist only for message display but do not need to be backed by a full
* tree view widget. This could also hopefully be used for more xpcshell unit
* testing of the FolderDisplayWidget. It might also be useful for creating
* transient selections when right-click selection happens.
*
* Our current limitations:
* - We do not support any single selection modes. This is mainly because we
* need to look at the box object for that and we don't want to do it.
* - Timed selection. Our expected consumers don't use it.
*
* Our current laziness:
* - We aren't very precise about invalidation when it would be potentially
* complicated. The theory is that if there is a tree box object, it's
* probably native and the XPConnect overhead is probably a lot more than
* any potential savings, at least for now when the tree display is
* generally C++ XPCOM backed rather than JS XPCOM backed. Also, we
* aren't intended to actually be used with a real tree display; you should
* be using the C++ object in that case!
*
* If documentation is omitted for something, it is because we have little to
* add to the documentation of nsITreeSelection and really hope that our
* documentation tool will copy-down that documentation.
*
* This implementation attempts to mimic the behavior of nsTreeSelection. In
* a few cases, this leads to potentially confusing actions. I attempt to note
* when we are doing this and why we do it.
*
* Unit test is in mailnews/base/util/test_jsTreeSelection.js
* Unit test is in mail/base/test/unit/test_treeSelection.js
*/
function JSTreeSelection(aTree) {
export function TreeSelection(aTree) {
this._tree = aTree;
this._currentIndex = null;
@ -45,7 +19,7 @@ function JSTreeSelection(aTree) {
this._selectEventsSuppressed = false;
}
JSTreeSelection.prototype = {
TreeSelection.prototype = {
/**
* The current XULTreeElement, appropriately QueryInterfaced. May be null.
*/

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

@ -5,9 +5,7 @@
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { JSTreeSelection } = ChromeUtils.import(
"resource:///modules/JsTreeSelection.jsm"
);
import { TreeSelection } from "chrome://messenger/content/tree-selection.mjs";
// Account for the mac OS accelerator key variation.
// Use these strings to check keyboard event properties.
@ -1011,7 +1009,7 @@ class TreeViewListbox extends HTMLTableSectionElement {
this._view = view;
if (view) {
try {
this._selection = new JSTreeSelection();
this._selection = new TreeSelection();
this._selection.tree = this;
this._selection.view = view;
@ -1390,7 +1388,7 @@ class TreeViewListbox extends HTMLTableSectionElement {
_selectSingle(index) {
let changeSelection =
this._selection.count != 1 || !this._selection.isSelected(index);
// Update the JSTreeSelection selection to trigger a tree invalidate().
// Update the TreeSelection selection to trigger a tree invalidate().
if (changeSelection) {
this._selection.select(index);
}
@ -1418,7 +1416,7 @@ class TreeViewListbox extends HTMLTableSectionElement {
*/
_toggleSelected(index) {
this._selection.toggleSelect(index);
// We hack the internals of the JSTreeSelection to clear the
// We hack the internals of the TreeSelection to clear the
// shiftSelectPivot.
this._selection._shiftSelectPivot = null;
this.currentIndex = index;

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

@ -109,6 +109,7 @@ messenger.jar:
content/messenger/tabmail-tabs.js (content/widgets/tabmail-tabs.js)
content/messenger/toolbarbutton-menu-button.js (content/widgets/toolbarbutton-menu-button.js)
content/messenger/tree-listbox.js (content/widgets/tree-listbox.js)
content/messenger/tree-selection.mjs (content/widgets/tree-selection.mjs)
content/messenger/tree-view-listbox.mjs (content/widgets/tree-view-listbox.mjs)
content/messenger/thread-pane-columns.mjs (content/modules/thread-pane-columns.mjs)

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

@ -2,8 +2,8 @@
* 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/. */
const { JSTreeSelection } = ChromeUtils.import(
"resource:///modules/JsTreeSelection.jsm"
const { TreeSelection } = ChromeUtils.importESModule(
"chrome://messenger/content/tree-selection.mjs"
);
var fakeView = {
@ -12,227 +12,192 @@ var fakeView = {
QueryInterface: ChromeUtils.generateQI(["nsITreeView"]),
};
var sel = new JSTreeSelection(null);
var sel = new TreeSelection(null);
sel.view = fakeView;
function bad_ranges(aMsg, aExpected) {
let s = "\x1b[1;31m!!! BAD RANGES: " + aMsg + "\n";
s += "Selection ranges: " + sel._ranges.length + ":";
for (let [low, high] of sel._ranges) {
s += " " + low + "-" + high;
}
s += "\nExpected ranges: " + aExpected.length + ":";
for (let i = 0; i < aExpected.length; i++) {
s += " " + aExpected[i][0] + "-" + aExpected[i][1];
}
s += "\x1b[0m\n";
dump(s);
do_throw(aMsg);
function assertSelectionRanges(expected) {
Assert.deepEqual(sel._ranges, expected, "selected ranges");
}
function assert_selection_ranges(...aArgs) {
if (sel._ranges.length != aArgs.length) {
bad_ranges("Wrong number of ranges!", aArgs);
}
let i = 0;
let ourCount = 0;
for (let [slow, shigh] of sel._ranges) {
let [dlow, dhigh] = aArgs[i++];
if (dlow != slow || dhigh != shigh) {
bad_ranges("Range mismatch on index " + i, aArgs);
}
ourCount += shigh - slow + 1;
}
if (ourCount != sel.count) {
bad_ranges(
"Count was wrong! We counted " + ourCount + " but they say " + sel.count,
aArgs
);
}
function assertCurrentIndex(index) {
Assert.equal(sel.currentIndex, index, `current index should be ${index}`);
}
var asr = assert_selection_ranges;
function assert_current_index(aIndex) {
if (sel.currentIndex != aIndex) {
do_throw(
"Current index is wrong! Is " +
sel.currentIndex +
" but should be " +
aIndex
);
}
function assertShiftPivot(index) {
Assert.equal(
sel.shiftSelectPivot,
index,
`shift select pivot should be ${index}`
);
}
var aci = assert_current_index;
function assert_shift_pivot(aIndex) {
if (sel.shiftSelectPivot != aIndex) {
do_throw(
"Current index is wrong! Is " +
sel._shiftSelectPivot +
" but should be " +
aIndex
);
}
function assertSelected(index) {
Assert.ok(sel.isSelected(index), `${index} should be selected`);
}
var asp = assert_shift_pivot;
function assert_selected(aIndex) {
if (!sel.isSelected(aIndex)) {
do_throw("Index is not selected but should be: " + aIndex);
}
function assertNotSelected(index) {
Assert.ok(!sel.isSelected(index), `${index} should not be selected`);
}
var asel = assert_selected;
function assert_not_selected(aIndex) {
if (sel.isSelected(aIndex)) {
do_throw("Index is selected but should not be: " + aIndex);
}
}
var ansel = assert_not_selected;
function run_test() {
// -- select
sel.select(1);
asel(1);
ansel(0);
ansel(2);
asr([1, 1]);
aci(1);
assertSelected(1);
assertNotSelected(0);
assertNotSelected(2);
assertSelectionRanges([[1, 1]]);
assertCurrentIndex(1);
sel.select(2);
asel(2);
ansel(1);
ansel(3);
asr([2, 2]);
aci(2);
assertSelected(2);
assertNotSelected(1);
assertNotSelected(3);
assertSelectionRanges([[2, 2]]);
assertCurrentIndex(2);
// -- clearSelection
sel.clearSelection();
asr();
aci(2); // should still be the same...
assertSelectionRanges([]);
assertCurrentIndex(2); // should still be the same...
// -- toggleSelect
// start from nothing
sel.clearSelection();
sel.toggleSelect(1);
asr([1, 1]);
aci(1);
assertSelectionRanges([[1, 1]]);
assertCurrentIndex(1);
// lower fusion
sel.select(2);
sel.toggleSelect(1);
asr([1, 2]);
aci(1);
assertSelectionRanges([[1, 2]]);
assertCurrentIndex(1);
// upper fusion
sel.toggleSelect(3);
asr([1, 3]);
aci(3);
assertSelectionRanges([[1, 3]]);
assertCurrentIndex(3);
// splitting
sel.toggleSelect(2);
asr([1, 1], [3, 3]);
asel(1);
asel(3);
ansel(0);
ansel(2);
ansel(4);
aci(2);
assertSelectionRanges([
[1, 1],
[3, 3],
]);
assertSelected(1);
assertSelected(3);
assertNotSelected(0);
assertNotSelected(2);
assertNotSelected(4);
assertCurrentIndex(2);
// merge
sel.toggleSelect(2);
asr([1, 3]);
aci(2);
assertSelectionRanges([[1, 3]]);
assertCurrentIndex(2);
// lower shrinkage
sel.toggleSelect(1);
asr([2, 3]);
aci(1);
assertSelectionRanges([[2, 3]]);
assertCurrentIndex(1);
// upper shrinkage
sel.toggleSelect(3);
asr([2, 2]);
aci(3);
assertSelectionRanges([[2, 2]]);
assertCurrentIndex(3);
// nukage
sel.toggleSelect(2);
asr();
aci(2);
assertSelectionRanges([]);
assertCurrentIndex(2);
// -- rangedSelect
// simple non-augment
sel.rangedSelect(0, 0, false);
asr([0, 0]);
asp(0);
aci(0);
assertSelectionRanges([[0, 0]]);
assertShiftPivot(0);
assertCurrentIndex(0);
// slightly less simple non-augment
sel.rangedSelect(2, 4, false);
asr([2, 4]);
asp(2);
aci(4);
assertSelectionRanges([[2, 4]]);
assertShiftPivot(2);
assertCurrentIndex(4);
// higher distinct range
sel.rangedSelect(7, 9, true);
asr([2, 4], [7, 9]);
asp(7);
aci(9);
assertSelectionRanges([
[2, 4],
[7, 9],
]);
assertShiftPivot(7);
assertCurrentIndex(9);
// lower distinct range
sel.rangedSelect(0, 0, true);
asr([0, 0], [2, 4], [7, 9]);
asp(0);
aci(0);
assertSelectionRanges([
[0, 0],
[2, 4],
[7, 9],
]);
assertShiftPivot(0);
assertCurrentIndex(0);
// lower fusion
sel.rangedSelect(6, 6, true);
asr([0, 0], [2, 4], [6, 9]);
asp(6);
aci(6);
assertSelectionRanges([
[0, 0],
[2, 4],
[6, 9],
]);
assertShiftPivot(6);
assertCurrentIndex(6);
// upper fusion
sel.rangedSelect(10, 11, true);
asr([0, 0], [2, 4], [6, 11]);
asp(10);
aci(11);
assertSelectionRanges([
[0, 0],
[2, 4],
[6, 11],
]);
assertShiftPivot(10);
assertCurrentIndex(11);
// notch merge
sel.rangedSelect(5, 5, true);
asr([0, 0], [2, 11]);
asp(5);
aci(5);
assertSelectionRanges([
[0, 0],
[2, 11],
]);
assertShiftPivot(5);
assertCurrentIndex(5);
// ambiguous consume with merge
sel.rangedSelect(0, 5, true);
asr([0, 11]);
asp(0);
aci(5);
assertSelectionRanges([[0, 11]]);
assertShiftPivot(0);
assertCurrentIndex(5);
// aligned consumption
sel.rangedSelect(0, 15, true);
asr([0, 15]);
asp(0);
aci(15);
assertSelectionRanges([[0, 15]]);
assertShiftPivot(0);
assertCurrentIndex(15);
// excessive consumption
sel.rangedSelect(5, 7, false);
sel.rangedSelect(3, 10, true);
asr([3, 10]);
asp(3);
aci(10);
assertSelectionRanges([[3, 10]]);
assertShiftPivot(3);
assertCurrentIndex(10);
// overlap merge
sel.rangedSelect(5, 10, false);
sel.rangedSelect(15, 20, true);
sel.rangedSelect(7, 17, true);
asr([5, 20]);
asp(7);
aci(17);
assertSelectionRanges([[5, 20]]);
assertShiftPivot(7);
assertCurrentIndex(17);
// big merge and consume
sel.rangedSelect(5, 10, false);
@ -240,70 +205,82 @@ function run_test() {
sel.rangedSelect(25, 30, true);
sel.rangedSelect(35, 40, true);
sel.rangedSelect(7, 37, true);
asr([5, 40]);
asp(7);
aci(37);
assertSelectionRanges([[5, 40]]);
assertShiftPivot(7);
assertCurrentIndex(37);
// broad lower fusion
sel.rangedSelect(10, 20, false);
sel.rangedSelect(3, 15, true);
asr([3, 20]);
asp(3);
aci(15);
assertSelectionRanges([[3, 20]]);
assertShiftPivot(3);
assertCurrentIndex(15);
// -- clearRange
sel.rangedSelect(10, 30, false);
// irrelevant low
sel.clearRange(0, 5);
asr([10, 30]);
assertSelectionRanges([[10, 30]]);
// irrelevant high
sel.clearRange(40, 45);
asr([10, 30]);
assertSelectionRanges([[10, 30]]);
// lower shrinkage tight
sel.clearRange(10, 10);
asr([11, 30]);
assertSelectionRanges([[11, 30]]);
// lower shrinkage broad
sel.clearRange(0, 13);
asr([14, 30]);
assertSelectionRanges([[14, 30]]);
// upper shrinkage tight
sel.clearRange(30, 30);
asr([14, 29]);
assertSelectionRanges([[14, 29]]);
// upper shrinkage broad
sel.clearRange(27, 50);
asr([14, 26]);
assertSelectionRanges([[14, 26]]);
// split tight
sel.clearRange(20, 20);
asr([14, 19], [21, 26]);
assertSelectionRanges([
[14, 19],
[21, 26],
]);
// split broad
sel.toggleSelect(20);
sel.clearRange(19, 21);
asr([14, 18], [22, 26]);
assertSelectionRanges([
[14, 18],
[22, 26],
]);
// hit two with tight shrinkage
sel.clearRange(18, 22);
asr([14, 17], [23, 26]);
assertSelectionRanges([
[14, 17],
[23, 26],
]);
// hit two with broad shrinkage
sel.clearRange(15, 25);
asr([14, 14], [26, 26]);
assertSelectionRanges([
[14, 14],
[26, 26],
]);
// obliterate
sel.clearRange(0, 100);
asr();
assertSelectionRanges([]);
// multi-obliterate
sel.rangedSelect(10, 20, true);
sel.rangedSelect(30, 40, true);
sel.clearRange(0, 100);
asr();
assertSelectionRanges([]);
// obliterate with shrinkage
sel.rangedSelect(5, 10, true);
@ -311,124 +288,130 @@ function run_test() {
sel.rangedSelect(25, 30, true);
sel.rangedSelect(35, 40, true);
sel.clearRange(7, 37);
asr([5, 6], [38, 40]);
assertSelectionRanges([
[5, 6],
[38, 40],
]);
// -- selectAll
sel.selectAll();
asr([0, 100]);
assertSelectionRanges([[0, 100]]);
// -- adjustSelection
// bump due to addition on simple select
sel.select(5);
sel.adjustSelection(5, 1);
asr([6, 6]);
aci(6);
assertSelectionRanges([[6, 6]]);
assertCurrentIndex(6);
sel.select(5);
sel.adjustSelection(0, 1);
asr([6, 6]);
aci(6);
assertSelectionRanges([[6, 6]]);
assertCurrentIndex(6);
// bump due to addition on ranged simple select
sel.rangedSelect(5, 5, false);
sel.adjustSelection(5, 1);
asr([6, 6]);
asp(6);
aci(6);
assertSelectionRanges([[6, 6]]);
assertShiftPivot(6);
assertCurrentIndex(6);
sel.rangedSelect(5, 5, false);
sel.adjustSelection(0, 1);
asr([6, 6]);
asp(6);
aci(6);
assertSelectionRanges([[6, 6]]);
assertShiftPivot(6);
assertCurrentIndex(6);
// bump due to addition on ranged select
sel.rangedSelect(5, 7, false);
sel.adjustSelection(5, 1);
asr([6, 8]);
asp(6);
aci(8);
assertSelectionRanges([[6, 8]]);
assertShiftPivot(6);
assertCurrentIndex(8);
// no-op with addition
sel.rangedSelect(0, 3, false);
sel.adjustSelection(10, 1);
asr([0, 3]);
asp(0);
aci(3);
assertSelectionRanges([[0, 3]]);
assertShiftPivot(0);
assertCurrentIndex(3);
// split due to addition
sel.rangedSelect(5, 6, false);
sel.adjustSelection(6, 1);
asr([5, 5], [7, 7]);
asp(5);
aci(7);
assertSelectionRanges([
[5, 5],
[7, 7],
]);
assertShiftPivot(5);
assertCurrentIndex(7);
// shift due to removal on simple select
sel.select(5);
sel.adjustSelection(0, -1);
asr([4, 4]);
aci(4);
assertSelectionRanges([[4, 4]]);
assertCurrentIndex(4);
// shift due to removal on ranged simple select
sel.rangedSelect(5, 5, false);
sel.adjustSelection(0, -1);
asr([4, 4]);
asp(4);
aci(4);
assertSelectionRanges([[4, 4]]);
assertShiftPivot(4);
assertCurrentIndex(4);
// nuked due to removal on simple select
sel.select(5);
sel.adjustSelection(5, -1);
asr();
aci(-1);
assertSelectionRanges([]);
assertCurrentIndex(-1);
// upper tight shrinkage due to removal
sel.rangedSelect(5, 10, false);
sel.adjustSelection(10, -1);
asr([5, 9]);
asp(5);
aci(-1);
assertSelectionRanges([[5, 9]]);
assertShiftPivot(5);
assertCurrentIndex(-1);
// upper broad shrinkage due to removal
sel.rangedSelect(5, 10, false);
sel.adjustSelection(6, -10);
asr([5, 5]);
asp(5);
aci(-1);
assertSelectionRanges([[5, 5]]);
assertShiftPivot(5);
assertCurrentIndex(-1);
// lower tight shrinkage due to removal
sel.rangedSelect(5, 10, false);
sel.adjustSelection(5, -1);
asr([5, 9]);
asp(-1);
aci(9);
assertSelectionRanges([[5, 9]]);
assertShiftPivot(-1);
assertCurrentIndex(9);
// lower broad shrinkage due to removal
sel.rangedSelect(5, 10, false);
sel.adjustSelection(0, -10);
asr([0, 0]);
asp(-1);
aci(0);
assertSelectionRanges([[0, 0]]);
assertShiftPivot(-1);
assertCurrentIndex(0);
// tight nuke due to removal
sel.rangedSelect(5, 10, false);
sel.adjustSelection(5, -6);
asr();
asp(-1);
aci(-1);
assertSelectionRanges([]);
assertShiftPivot(-1);
assertCurrentIndex(-1);
// broad nuke due to removal
sel.rangedSelect(5, 10, false);
sel.adjustSelection(0, -20);
asr();
asp(-1);
aci(-1);
assertSelectionRanges([]);
assertShiftPivot(-1);
assertCurrentIndex(-1);
// duplicateSelection (please keep this right at the end, as this modifies
// sel)
// no guarantees for the shift pivot yet, so don't test that
let oldSel = sel;
let newSel = new JSTreeSelection(null);
let newSel = new TreeSelection(null);
newSel.view = fakeView;
// multiple selections
oldSel.rangedSelect(1, 3, false);
@ -439,18 +422,22 @@ function run_test() {
oldSel.duplicateSelection(newSel);
// from now on we're only going to be checking newSel
sel = newSel;
asr([1, 3], [5, 7], [10, 10]);
aci(7);
assertSelectionRanges([
[1, 3],
[5, 7],
[10, 10],
]);
assertCurrentIndex(7);
// single selection
oldSel.select(4);
oldSel.duplicateSelection(newSel);
asr([4, 4]);
aci(4);
assertSelectionRanges([[4, 4]]);
assertCurrentIndex(4);
// nothing selected
oldSel.clearSelection();
oldSel.duplicateSelection(newSel);
asr();
aci(4);
assertSelectionRanges([]);
assertCurrentIndex(4);
}

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

@ -19,5 +19,6 @@ reason = osx shippable perma failures
run-sequentially = Avoid bustage.
[test_oauth_migration.js]
[test_mailGlue_distribution.js]
[test_treeSelection.js]
[include:xpcshell_maildir.ini]

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

@ -111,7 +111,6 @@ EXTRA_JS_MODULES += [
"FolderLookupService.jsm",
"FolderUtils.jsm",
"hostnameUtils.jsm",
"JsTreeSelection.jsm",
"JXON.jsm",
"LineReader.jsm",
"MailAuthenticator.jsm",

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

@ -8,8 +8,8 @@
* James using test_nsMsgDBView.js as a base.
*/
const { JSTreeSelection } = ChromeUtils.import(
"resource:///modules/JsTreeSelection.jsm"
const { TreeSelection } = ChromeUtils.importESModule(
"chrome://messenger/content/tree-selection.mjs"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
@ -31,7 +31,7 @@ var nsIMFNService = Ci.nsIMsgFolderNotificationService;
// calls to these objects in nsMsgDBView and friends, it will also
// be necessary to add fake versions of those calls here.
var gFakeSelection = new JSTreeSelection(null);
var gFakeSelection = new TreeSelection(null);
// Items used to add messages to the folder

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

@ -20,8 +20,8 @@ var {
} = ChromeUtils.import(
"resource://testing-common/mailnews/MessageGenerator.jsm"
);
const { JSTreeSelection } = ChromeUtils.import(
"resource:///modules/JsTreeSelection.jsm"
const { TreeSelection } = ChromeUtils.importESModule(
"chrome://messenger/content/tree-selection.mjs"
);
var { MessageInjection } = ChromeUtils.import(
"resource://testing-common/mailnews/MessageInjection.jsm"
@ -250,7 +250,7 @@ var ViewFlags = Ci.nsMsgViewFlagsType;
var MSG_VIEW_FLAG_DUMMY = 0x20000000;
var gFakeSelection = new JSTreeSelection(null);
var gFakeSelection = new TreeSelection(null);
function setup_view(aViewType, aViewFlags, aTestFolder) {
let dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=" + aViewType;

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

@ -36,7 +36,6 @@ support-files = nodelist_test.xml data/*
[test_imapPump.js]
[test_incomingServer.js]
[test_inheritedFolderProperties.js]
[test_jsTreeSelection.js]
[test_junkingWhenDisabled.js]
[test_loadVirtualFolders.js]
[test_MsgIncomingServer.js]

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

@ -167,7 +167,6 @@
"resource:///modules/ImapUtils.jsm": "comm/mailnews/imap/src/ImapUtils.jsm",
"resource:///modules/InteractiveBrowser.jsm": "comm/chat/modules/InteractiveBrowser.jsm",
"resource:///modules/JXON.jsm": "comm/mailnews/base/src/JXON.jsm",
"resource:///modules/JsTreeSelection.jsm": "comm/mailnews/base/src/JsTreeSelection.jsm",
"resource:///modules/LDAPClient.jsm": "comm/mailnews/addrbook/modules/LDAPClient.jsm",
"resource:///modules/LDAPConnection.jsm": "comm/mailnews/addrbook/modules/LDAPConnection.jsm",
"resource:///modules/LDAPDirectory.jsm": "comm/mailnews/addrbook/modules/LDAPDirectory.jsm",