New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 617435 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Extensions API: chrome.downloads.search filter is buggy

Reported by hrg....@gmail.com, Jun 5 2016

Issue description

Chrome Version       : 49.0.2623.112 (Official Build) m (32-bit)
OS Version: 6.0 (Windows Vista, Windows Server 2008)

What steps will reproduce the problem?
1. Create an extension with the "downloads" permission
2. Inside the extension run any of the following lines:

chrome.downloads.search({totalBytesGreater:10000},list=>console.log(list))

chrome.downloads.search({totalBytesLess:10000},list=>console.log(list))

chrome.downloads.search({startedAfter:+new Date-60*1000+''},list=>console.log(list))

chrome.downloads.search({startedBefore:+new Date+''},list=>console.log(list))


What is the expected result?
First line: An array with downloads bigger than 10000 bytes
Second line: An array with downloads smaller than 10000 bytes
Third line: An array with doanloads started in the last minute
Fourth line: An array with downloads started before now (i.e. all of them)

What happens instead?
First line: "Uncaught Error: Invalid value for argument 1"
Second line: "Uncaught Error: Invalid value for argument 1"
Third line: An array with all downloads ever made
Fourth line: An empty array

 
Labels: Needs-Feedback
Could you please provide a sample extension to reproduce the issue from test team end.
Cc: tkonch...@chromium.org

Comment 3 by hrg....@gmail.com, Jun 6 2016

No problem. File attached.
It's an unpacked extension. Once loaded, inspect with DevTools the background page and you'll see the output in the console.

Test extension.zip
457 bytes Download
Project Member

Comment 4 by sheriffbot@chromium.org, Jun 7 2016

Labels: -Needs-Feedback Needs-Review
Owner: tkonch...@chromium.org
Thank you for providing more feedback. Adding requester "tkonchada@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: rdevlin....@chromium.org
Components: Platform>Extensions>API
Project Member

Comment 6 by bugdroid1@chromium.org, Jun 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a61f420b0706b67e305cd98d0f59da32d81d0cc0

commit a61f420b0706b67e305cd98d0f59da32d81d0cc0
Author: lazyboy <lazyboy@chromium.org>
Date: Mon Jun 27 23:48:18 2016

downloads.query: parse numerical query properties as double, not int.

In r244404, we changed these from ints to doubles. However, we still
seem to parse these through Value::GetAsInteger. This always fails.
Change it to use Value::GetAsDouble instead.

BUG= 617435 
Test=See bug description for repro test case.

Review-Url: https://codereview.chromium.org/2092963002
Cr-Commit-Position: refs/heads/master@{#402332}

[modify] https://crrev.com/a61f420b0706b67e305cd98d0f59da32d81d0cc0/chrome/browser/download/download_query.cc
[modify] https://crrev.com/a61f420b0706b67e305cd98d0f59da32d81d0cc0/chrome/browser/download/download_query.h
[modify] https://crrev.com/a61f420b0706b67e305cd98d0f59da32d81d0cc0/chrome/browser/download/download_query_unittest.cc
[add] https://crrev.com/a61f420b0706b67e305cd98d0f59da32d81d0cc0/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
[modify] https://crrev.com/a61f420b0706b67e305cd98d0f59da32d81d0cc0/chrome/chrome_tests_unit.gypi

Owner: lazyboy@chromium.org
Status: Fixed (was: Unconfirmed)
Labels: -Needs-Review TE-Verified-M53 TE-Verified-53.0.2782.0
Tested the same on win8.1 chrome version 53.0.2782.0 and observed 4 arrays without any errors

Please find the screenshot

Fix works as expected
617435.png
16.0 KB View Download

Comment 9 by hrg....@gmail.com, Jun 28 2016

Keep in mind, though, that this bug is not just about errors being thrown.
For the 3rd and 4th line in the test case, they don't throw any errors but rather their result is wrong.

Sign in to add a comment