GoogleChrome / developer.chrome.com

The frontend, backend, and content source code for developer.chrome.com
https://developer.chrome.com
Other
1.67k stars 1.58k forks source link

chrome.windows.create createData should warn about type for offsets #7901

Closed GaurangTandon closed 7 months ago

GaurangTandon commented 9 months ago

Describe the bug

Link to documentation: https://developer.chrome.com/docs/extensions/reference/windows/#type-CreateType

It states the offset properties left and top can be number type. But, passing a fractional value will create an error.

To Reproduce

For example, passing window.screen.width / 2 to the left offset property is a common pattern. I did the same as this SO poster - and we both got the same error:

Error in invocation of windows.create(optional object createData, optional function callback): Error at parameter 'createData': Error at property 'left': Invalid type: expected integer, found number.

Expected behavior

The documentation should show an explicit warning for integer types.

GaurangTandon commented 9 months ago

Looking at the source of this repository, I cannot find the phrase The number of pixels to position in any file. It seems the entire "Summary" component is created from https://github.com/GoogleChrome/chrome-types which is created by parsing the Chromium repo.

Please let me know what is the best way to address this gap in documentation. This seems to be a common pitfall for extension developers.

dstmarthe commented 7 months ago

Hi, thanks for raising this. We've moved to a different issue reporting platform. You can reproduce this issue here if you'd like: https://issuetracker.google.com/issues/new?component=1400036&template=1897236