Closed
Bug 926691
Opened 11 years ago
Closed 11 years ago
[OS.File] |file.write(buffer, {bytes: bytes}| does not work anymore.
Categories
(Toolkit Graveyard :: OS.File, defect)
Toolkit Graveyard
OS.File
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla27
People
(Reporter: nmaier, Assigned: nmaier)
References
Details
(Keywords: regression)
Attachments
(1 file, 1 obsolete file)
Bug 865387 introduced the following change, causing |options.byteLength| to be always overriden by |buffer.byteLength|:
- if (isTypedArray(buffer) && (!options || !("bytes" in options))) {
- // Preserve the reference to |outExecutionDuration| option if it is
- // passed.
+ if (isTypedArray(buffer)) {
+ // Preserve reference to option |outExecutionDuration|, if it is passed.
options = clone(options, ["outExecutionDuration"]);
options.bytes = buffer.byteLength;
}
Bug 865387 comment 33.
Assignee | ||
Comment 1•11 years ago
|
||
Alrighty, re-added the check, also re-added the "options is nullish" check and added a simple xpc-shell test.
Attachment #816891 -
Flags: review?(dteller)
Comment 2•11 years ago
|
||
Comment on attachment 816891 [details] [diff] [review]
OS.File API must preverse |bytes| options to .readTo() and .write().
Review of attachment 816891 [details] [diff] [review]:
-----------------------------------------------------------------
r=me, but I believe that we should keep our files smaller :)
::: toolkit/components/osfile/tests/xpcshell/test_osfile_async_bytes.js
@@ +20,5 @@
> + try {
> + // 1. Test write, by supplying {bytes:} options smaller than the actual
> + // buffer.
> + yield file.write(new Uint8Array(1<<11), {bytes: 1<<10});
> + do_check_eq((yield file.stat()).size, 1<<10);
Do you really need your files to be that large?
I know that it's going to do no harm under Unix, but I have no such confidence in Windows.
Attachment #816891 -
Flags: review?(dteller) → review+
Assignee | ||
Comment 3•11 years ago
|
||
1024 bytes is considered large these days?
Assignee | ||
Comment 4•11 years ago
|
||
- function*() ;)
- Replaced 1<<11 with 2048 and so on, to make it more clear what the sizes are.
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 5•11 years ago
|
||
For some reason, I had seen 1 << 20. My bad.
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 6•11 years ago
|
||
Flags: in-testsuite+
Whiteboard: [fixed-in-fx-team]
Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #6)
> https://hg.mozilla.org/integration/fx-team/rev/ef3ac303c242
Sorry, this will cause failures on linux. Was too eager with the checkin-needed after receiving try greens for android, OSX and Windows...
Comment 8•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla27
Updated•2 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•