Closed Bug 1147747 Opened 9 years ago Closed 9 years ago

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

Categories

(Add-on SDK Graveyard :: Documentation, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: arai, Assigned: arai)

Details

Attachments

(1 file)

> 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: 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+
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+
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
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: