OS.File.remove does not honor the ignoreAbsent option

RESOLVED FIXED in Firefox 41

Status

()

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Dexter, Assigned: Dexter)

Tracking

Trunk
mozilla41
Points:
---

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

4 years ago
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).
(Assignee)

Comment 1

4 years ago
Created attachment 8605826 [details] [diff] [review]
bug1164822.patch

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.
(Assignee)

Comment 4

4 years ago
Created attachment 8607012 [details] [diff] [review]
part 2 - add test coverage

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+
(Assignee)

Comment 6

4 years ago
Created attachment 8607199 [details] [diff] [review]
part 2 - add test coverage - v2

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+
(Assignee)

Updated

4 years ago
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2f729ee97af9
https://hg.mozilla.org/mozilla-central/rev/c40ca2a73105
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
status-firefox41: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.