Closed
Bug 1279562
Opened 9 years ago
Closed 9 years ago
WebExtensions: chrome.windows.update does not accept negative values for 'left' and 'top' positions
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(firefox50 fixed)
RESOLVED
FIXED
mozilla50
Tracking | Status | |
---|---|---|
firefox50 | --- | fixed |
People
(Reporter: dw-dev, Assigned: freaktechnik, Mentored)
References
Details
(Whiteboard: [good first bug])
Attachments
(1 file, 3 obsolete files)
1.74 KB,
patch
|
kmag
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160604131506
Steps to reproduce:
I am migrating my 'Tile Tabs' add-on to the new WebExtensions API.
I tried executing the following code:
chrome.windows.update(windowId, { left: -8, top: -8, width: (1920+8+8), height: (1080+8+8) },
function(win)
{
.....
.....
});
Actual results:
chrome.windows.update() failed with the following message in the console:
"Type error for parameter updateInfo (Error processing left:
Integer -8 is too small (must be at least 0)) for windows.update."
Further testing showed that chrome.windows.update() always fails if the 'left' or 'top' parameters are negative.
Expected results:
chrome.windows.update() should have positioned the window at the requested position (left: -8, top: -8).
The behaviour in Firefox is incompatible with the behaviour in Chrome.
Chrome allows negative 'left' and 'top' parameters in chrome.windows.update(), although not in chrome.windows.create().
For add-ons that need to precisely position windows to the left or top edges of the screen, it is essential to be able to specify negative values for the 'left' and 'top' parameters.
For example, when using Windows 10, a window can only be positioned to the top-left corner of the screen by setting 'left: -8' and 'top: -1'.
Comment 1•9 years ago
|
||
We just need to change the default minimum value for integers from 0 to -Infinity (or Number.MIN_SAFE_INTEGER):
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/Schemas.jsm#1272
Mentor: kmaglione+bmo
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [good first bug]
Assignee | ||
Comment 2•9 years ago
|
||
Fix as suggested in the comment above and a test that tries to move a window to negative coordinates.
Attachment #8762680 -
Flags: review?(kmaglione+bmo)
Updated•9 years ago
|
Assignee: nobody → martin
Comment 3•9 years ago
|
||
Comment 4•9 years ago
|
||
Comment on attachment 8762680 [details] [diff] [review]
bug1279562-v1.patch
Review of attachment 8762680 [details] [diff] [review]:
-----------------------------------------------------------------
It looks good, but it also looks like you're going to have to skip this test on Linux. It's failing on try because there are constraints on where the window can be moved.
Attachment #8762680 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 5•9 years ago
|
||
Added check to decide if the test should be executed.
Attachment #8762680 -
Attachment is obsolete: true
Attachment #8762915 -
Flags: review?(kmaglione+bmo)
Comment 6•9 years ago
|
||
Comment on attachment 8762915 [details] [diff] [review]
bug1279562-v2.patch
Review of attachment 8762915 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/components/extensions/test/browser/browser_ext_windows_size.js
@@ +85,5 @@
> +
> + return browser.windows.update(windowId, geom);
> + }
> + }).then(() => {
> + return checkWindow(geom);
This handler should be attached to the `.update()` call above. Otherwise, looks good.
Attachment #8762915 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 7•9 years ago
|
||
Chained the window size check directly to the update call.
Attachment #8762915 -
Attachment is obsolete: true
Attachment #8763060 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 8•9 years ago
|
||
Fix commit message to include r=kmag.
Attachment #8763060 -
Attachment is obsolete: true
Attachment #8763060 -
Flags: review?(kmaglione+bmo)
Attachment #8763185 -
Flags: review?(kmaglione+bmo)
Updated•9 years ago
|
Attachment #8763185 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Comment 10•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 11•9 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0f7a2b698b7a
Accept negative 'left' and 'top' values in chrome.windows.update. r=kmag
Keywords: checkin-needed
Comment 12•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•