Closed Bug 1164822 Opened 9 years ago Closed 9 years ago

OS.File.remove does not honor the ignoreAbsent option

Categories

(Toolkit Graveyard :: OS.File, defect)

defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: Dexter, Assigned: Dexter)

Details

Attachments

(2 files, 1 obsolete file)

Calling |OS.File.remove(NON_EXISTING_FILE_PATH, {ignoreAbsent: false})| on a non existing file path does not throw (it should, as ignoreAbsent was introduced by bug 857077).
Attached patch bug1164822.patchSplinter Review
This fixes the problem: the options were not being passed around.

Also, I've noticed that "\toolkit\components\osfile\tests\mochi\worker_test_osfile_front.js" contains the |test_remove_file()| test which appears to be broken: without this patch, the first check doesn't fail.

Yoric, do you have any clue why that test doesn't fail?
Assignee: nobody → alessio.placitelli
Status: NEW → ASSIGNED
Attachment #8605826 - Flags: review?(dteller)
Comment on attachment 8605826 [details] [diff] [review]
bug1164822.patch

Review of attachment 8605826 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. Could you add a test in the xpcshell/ directory?
Attachment #8605826 - Flags: review?(dteller) → review+
(In reply to Alessio Placitelli [:Dexter] from comment #1)
> Yoric, do you have any clue why that test doesn't fail?

Well, your fix fixes the main thread API. That test tests the worker API, which already worked.
Attached patch part 2 - add test coverage (obsolete) — Splinter Review
Thanks Yoric, this adds test coverage for the ignoreAbsent flag.
Attachment #8607012 - Flags: review?(dteller)
Comment on attachment 8607012 [details] [diff] [review]
part 2 - add test coverage

Review of attachment 8607012 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/components/osfile/tests/xpcshell/test_remove.js
@@ +25,5 @@
> +  try {
> +    yield OS.File.remove(absent_file_name, {ignoreAbsent: false});
> +  } catch (ex) {
> +    exception = ex;
> +  }

You should use `Assert.rejects`.
Attachment #8607012 - Flags: review?(dteller) → review+
Thank you Yoric!

Here's the try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d970dac3bbee
Attachment #8607012 - Attachment is obsolete: true
Attachment #8607199 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2f729ee97af9
https://hg.mozilla.org/mozilla-central/rev/c40ca2a73105
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
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: