Closed
Bug 769191
Opened 12 years ago
Closed 12 years ago
[OS.File] read and write should accept a default length
Categories
(Toolkit Graveyard :: OS.File, defect)
Toolkit Graveyard
OS.File
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla18
People
(Reporter: Yoric, Assigned: Yoric)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
Common scenario:
let a = new ArrayBuffer(21);
let file = OS.File.open(...)
file.read(a, a.byteLength);
If no length is given, we should use the length of the array buffer.
Assignee | ||
Comment 1•12 years ago
|
||
Assignee: nobody → dteller
Attachment #637423 -
Flags: review?(taras.mozilla)
Comment 2•12 years ago
|
||
Comment on attachment 637423 [details] [diff] [review]
Default arguments of OS.File.prototype.read/write
bugzilla is failing so I can't see the patch, but this makes sense
Attachment #637423 -
Flags: review?(taras.mozilla) → review+
Assignee | ||
Comment 3•12 years ago
|
||
Doing this differently.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #637423 -
Attachment is obsolete: true
Attachment #656581 -
Flags: review?(nfroyd)
Assignee | ||
Updated•12 years ago
|
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Updated•12 years ago
|
Component: Networking: File → OS.File
Product: Core → Toolkit
Comment 5•12 years ago
|
||
Comment on attachment 656581 [details] [diff] [review]
Default arguments for AbstractFile.prototype.{readTo, write}
Review of attachment 656581 [details] [diff] [review]:
-----------------------------------------------------------------
Somewhere in worker_test_osfile_front.js it would be good to add a test for C pointer without options.bytes, for both readTo and write, to check that the error is thrown correctly.
::: toolkit/components/osfile/osfile_shared_front.jsm
@@ +166,5 @@
> throw new TypeError("Expecting a non-null pointer");
> }
> ptr = exports.OS.Shared.Type.uint8_t.out_ptr.cast(candidate);
> + if (bytes == null) {
> + throw new TypeError("This function expects either an ArrayBuffer or a C pointer and a number of bytes.");
I think this error message should indicate that |bytes| is required with a C pointer and shouldn't talk about ArrayBuffers; this is the pointer case, after all.
Attachment #656581 -
Flags: review?(nfroyd) → review+
Assignee | ||
Comment 6•12 years ago
|
||
Added default arguments and changed error message.
Attachment #656581 -
Attachment is obsolete: true
Attachment #656996 -
Flags: review+
Assignee | ||
Comment 7•12 years ago
|
||
Hum, I meant "added *test* for default arguments".
Assignee | ||
Updated•12 years ago
|
Depends on: 780483
Keywords: checkin-needed
Assignee | ||
Updated•12 years ago
|
Whiteboard: [land after bug 780483]
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
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
•