isArray fallback function and isArguments in lib/sdk/lang/type.js don't return a value.

RESOLVED FIXED

Status

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: arai, Assigned: arai)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
> var isArray = Array.isArray || function isArray(value) {
>   Object.prototype.toString.call(value) === "[object Array]";
> }
> function isArguments(value) {
>   Object.prototype.toString.call(value) === "[object Arguments]";
> }

missing "return"s.
(Assignee)

Comment 1

4 years ago
Created attachment 8583602 [details] [review]
Fix isArray fallback function and isArgument to return correct value.
Attachment #8583602 - Flags: review?(evold)
(Assignee)

Updated

4 years ago
Assignee: nobody → arai.unmht
Comment on attachment 8583602 [details] [review]
Fix isArray fallback function and isArgument to return correct value.

Nice catch!  It looks like this code landed in Bug 632572 and there was no test included.

We should have tests if we want to make changes.  Also Array.isArray will always be defined in the versions of Fx that this patched code is used, so we can remove the backup definition for isArray.

the isArgument change is fine but it needs a test.
Attachment #8583602 - Flags: review?(evold) → feedback+
(Assignee)

Comment 3

4 years ago
Thank you for feedback :)
Updated PR to remove isArray backup definition and add tests for both of them.
Comment on attachment 8583602 [details] [review]
Fix isArray fallback function and isArgument to return correct value.

Thanks!
Attachment #8583602 - Flags: review+

Comment 5

4 years ago
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/1dcf65b1294eee877bb1c04cfd7a07ef331e47b9
Bug 1147747 - Fix isArray fallback function and isArgument to return correct value.

https://github.com/mozilla/addon-sdk/commit/9417fbb2fe76f59e871aa786d6bf0b5ae68bd29c
Bug 1147747 - Part 2: Remove isArray backup definition.

https://github.com/mozilla/addon-sdk/commit/194f091a7b6ec61505758ddf3c9a50284095ea6b
Bug 1147747 - Part 3: Add tests for isArray and isArguments.

https://github.com/mozilla/addon-sdk/commit/3e6c7a56c54d78109b19c1b1a55e19a510083a10
Merge pull request #1921 from arai-a/bug1147747

Bug 1147747 - Fix isArray fallback function and isArgument to return correct value r=erikvold
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.