fx-compat: OS.File.read()IOUtils.read() in getContentsAsync()

https://firefox-source-docs.mozilla.org/dom/ioutils_migration.html

This also fixes a bug when `getContentsAsync()` is passed an
`nsIInputStream` or `nsIChannel` where raw bytes were returned instead
of a string. Not sure if we're doing that anywhere. If we are, this
would presumably break that code, but the function is supposed to return
a decoded string.
This commit is contained in:
Dan Stillman 2023-04-29 18:44:23 -04:00
parent 2f6f2feade
commit 296c0142f2
2 changed files with 10 additions and 12 deletions

View file

@ -36,7 +36,7 @@ describe("Zotero.File", function () {
OS.Path.join(getTestDataDirectory().path, "charsets", "invalid.txt")
);
assert.lengthOf(contents, 3);
assert.equal(contents, "A\uFFFDB");
assert.equal(contents, "A" + Zotero.File.REPLACEMENT_CHARACTER + "B");
})
it("should respect maxLength", function* () {