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)

defect
Not set
major

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.
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 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+
1024 bytes is considered large these days?
- function*() ;) - Replaced 1<<11 with 2048 and so on, to make it more clear what the sizes are.
Assignee: nobody → maierman
Attachment #816891 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Keywords: checkin-needed
For some reason, I had seen 1 << 20. My bad.
Keywords: checkin-needed
Flags: in-testsuite+
Whiteboard: [fixed-in-fx-team]
(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...
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla27
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: