Opened on 11/17/2018 at 07:24:18 AM
Closed on 12/10/2018 at 03:06:10 PM
#7130 closed defect (fixed)
FileSystem.Read() error is not handled
Reported by: | asmirnov | Assignee: | |
---|---|---|---|
Priority: | P2 | Milestone: | |
Module: | Libadblockplus | Keywords: | |
Cc: | sergz | Blocked By: | |
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
https://gitlab.com/eyeo/adblockplus/libadblockplus/merge_requests/31 |
Description
Environment
libadblockplus has FileSystem abstraction.
Read() call can result in error callback called:
https://gitlab.com/eyeo/adblockplus/libadblockplus/blob/master/include/AdblockPlus/IFileSystem.h#L85
There is a test for this (read with error):
https://gitlab.com/eyeo/adblockplus/libadblockplus/blob/master/test/FileSystemJsObject.cpp#L154
However it does not check if error is equal to undefined, but just checks if it's not equal to empty string.
The affected revision of libadblockplus is f2df538b1d66b982fba18a0bc36cf27c1b3bc716 and the most recent most likely.
How to reproduce
- Modify the test as follows:
$git diff diff --git a/test/FileSystemJsObject.cpp b/test/FileSystemJsObject.cpp index 051febd..c2ca271 100644 --- a/test/FileSystemJsObject.cpp +++ b/test/FileSystemJsObject.cpp @@ -158,6 +158,7 @@ TEST_F(FileSystemJsObjectTest, ReadError) std::string error; ReadFile(GetJsEngine(), content, error); ASSERT_NE("", error); + ASSERT_NE("undefined", error); ASSERT_EQ("undefined", content); }
- Run the test with make test FILTER=FileSystemJsObject*
- Make sure the test fails
Observed behaviour
The test fails: error is equal to undefined.
Expected behaviour
The test does not fail and error is not equal to undefined.