Bug 1906043 - Remove redundant nsIMsgPluggableStore.sliceStream(). r=darktrojan
Differential Revision: https://phabricator.services.mozilla.com/D215599 --HG-- extra : amend_source : 1912d546519917acdbf8832f0f49d0bb2821d7e2
This commit is contained in:
Родитель
135ced33a9
Коммит
e5ad6fc7dd
|
@ -199,23 +199,6 @@ interface nsIMsgPluggableStore : nsISupports {
|
|||
nsIInputStream getMsgInputStream(in nsIMsgFolder aFolder,
|
||||
in ACString aMsgToken);
|
||||
|
||||
/**
|
||||
* This is a hack to expose to allow JsAccount folders to implement a
|
||||
* working getLocalMsgStream().
|
||||
* It just provides a way to construct a SlicedInputStream from JS.
|
||||
* It'll be removed once Bug 1733849 is complete.
|
||||
*
|
||||
* @param inStream The stream providing the data to be sliced.
|
||||
* Should not be read after calling this function.
|
||||
* @param start Where slice begins, from current position of inStream.
|
||||
* @param length The size of the slice.
|
||||
*
|
||||
* @return A new input stream which produces the data slice when read from.
|
||||
*/
|
||||
nsIInputStream sliceStream(in nsIInputStream inStream,
|
||||
in unsigned long long start,
|
||||
in unsigned long length);
|
||||
|
||||
/**
|
||||
* Delete the passed in messages. These message should all be in the
|
||||
* same folder.
|
||||
|
|
|
@ -1643,16 +1643,6 @@ nsresult nsMsgBrkMBoxStore::CreateDirectoryForFolder(nsIFile* path) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgBrkMBoxStore::SliceStream(nsIInputStream* inStream, uint64_t start,
|
||||
uint32_t length, nsIInputStream** result) {
|
||||
nsCOMPtr<nsIInputStream> in(inStream);
|
||||
RefPtr<mozilla::SlicedInputStream> slicedStream =
|
||||
new mozilla::SlicedInputStream(in.forget(), start, uint64_t(length));
|
||||
slicedStream.forget(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// For mbox store, we'll just use mbox file size as our estimate.
|
||||
NS_IMETHODIMP nsMsgBrkMBoxStore::EstimateFolderSize(nsIMsgFolder* folder,
|
||||
int64_t* size) {
|
||||
|
|
|
@ -1355,16 +1355,6 @@ nsresult nsMsgMaildirStore::CreateDirectoryForFolder(nsIFile* path,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMaildirStore::SliceStream(nsIInputStream* inStream, uint64_t start,
|
||||
uint32_t length, nsIInputStream** result) {
|
||||
nsCOMPtr<nsIInputStream> in(inStream);
|
||||
RefPtr<mozilla::SlicedInputStream> slicedStream =
|
||||
new mozilla::SlicedInputStream(in.forget(), start, uint64_t(length));
|
||||
slicedStream.forget(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// For maildir store, our estimate is just the total of the file sizes.
|
||||
NS_IMETHODIMP nsMsgMaildirStore::EstimateFolderSize(nsIMsgFolder* folder,
|
||||
int64_t* size) {
|
||||
|
|
|
@ -15,28 +15,6 @@ function test_discoverSubFolders() {
|
|||
mailbox.msgStore.discoverSubFolders(mailbox, true);
|
||||
}
|
||||
|
||||
function test_sliceStream() {
|
||||
const mailbox = setup_mailbox("none", create_temporary_directory());
|
||||
|
||||
const str = "Just a test string.";
|
||||
const strStream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
|
||||
Ci.nsIStringInputStream
|
||||
);
|
||||
strStream.setData(str, str.length);
|
||||
|
||||
const sliced = mailbox.msgStore.sliceStream(strStream, 7, 4);
|
||||
|
||||
const s = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
|
||||
Ci.nsIScriptableInputStream
|
||||
);
|
||||
s.init(sliced);
|
||||
|
||||
const chunk = s.read(1024);
|
||||
Assert.equal(chunk, "test", "Check we got the expected subset.");
|
||||
Assert.equal(s.available(), 0, "Check no more bytes available.");
|
||||
Assert.equal(s.read(1024), "", "Check read() returns EOF.");
|
||||
}
|
||||
|
||||
// Load messages into a msgStore and make sure we can read
|
||||
// them back correctly using asyncScan().
|
||||
async function test_AsyncScan() {
|
||||
|
@ -90,6 +68,5 @@ function withStore(store, fn) {
|
|||
|
||||
for (const store of localAccountUtils.pluggableStores) {
|
||||
add_task(withStore(store, test_discoverSubFolders));
|
||||
add_task(withStore(store, test_sliceStream));
|
||||
add_task(withStore(store, test_AsyncScan));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче