Closed
Bug 893609
Opened 11 years ago
Closed 11 years ago
CustomizableUI.getPlacementOfWidget () should return null for non-existent widgets
Categories
(Firefox :: Toolbars and Customization, defect)
Firefox
Toolbars and Customization
Tracking
()
RESOLVED
FIXED
Firefox 28
People
(Reporter: Unfocused, Assigned: Gijs)
References
(Blocks 1 open bug)
Details
(Whiteboard: [Australis:M9][Australis:P3])
Attachments
(1 file, 3 obsolete files)
2.71 KB,
patch
|
Unfocused
:
review+
|
Details | Diff | Splinter Review |
From bug 892955 comment 4:
> (In reply to :Gijs Kruitbosch from comment #0)
> > Note further that after step 2, getPlacementOfWidget still returns a
> > placement, even though the widget itself doesn't exist. I'm not convinced we
> > should expose that
>
> Agreed - seems like it should just return null. The saved positions of
> non-existent widgets should be invisible from the API (at least by default -
> dunno if we'll want a separate API for that in the future).
Reporter | ||
Comment 1•11 years ago
|
||
Not super important, but it should help with bugs similar to bug 892955.
Whiteboard: [Australis:M?] → [Australis:M?][Australis:P3]
Assignee | ||
Comment 2•11 years ago
|
||
So, something like this would probably work...
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → gijskruitbosch+bugs
Assignee | ||
Comment 3•11 years ago
|
||
(In reply to :Gijs Kruitbosch from comment #2)
> Created attachment 795395 [details] [diff] [review]
> getPlacementOfWidget should return null for non-existent widgets
>
> So, something like this would probably work...
... except, of course, it'll return null for lazily loaded areas like the panel if they haven't been constructed yet.
I'm wondering if this is worth the trouble. Blair, what do you think? :-(
Flags: needinfo?(bmcbride)
Assignee | ||
Comment 4•11 years ago
|
||
On second thought, why don't we make it behave that way just for API-based widgets? That's more foolproof and that way we don't break anyone's expectations, and still avoid the original problems.
Attachment #795411 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Attachment #795395 -
Attachment is obsolete: true
Updated•11 years ago
|
Status: NEW → ASSIGNED
Reporter | ||
Comment 6•11 years ago
|
||
Comment on attachment 795411 [details] [diff] [review]
getPlacementOfWidget should return null for non-existent widgets
Review of attachment 795411 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/components/customizableui/src/CustomizableUI.jsm
@@ +1103,5 @@
>
> return [...widgets];
> },
>
> + getPlacementOfWidget: function(aWidgetId, aNeedsToExist) {
Nit: Got confused by 'aNeedsToExist'. How about something like 'aOnlyRegistered' or 'aExcludeDead' or something ?
@@ +1108,3 @@
> for (let [area, placements] of gPlacements) {
> let index = placements.indexOf(aWidgetId);
> + if (index != -1 && (!aNeedsToExist || this.widgetExists(aWidgetId, area))) {
widgetExists() doesn't seem to use |area|, so that call doesn't need to be inside the loop. Or did you mean it to use |area|?
@@ +1124,5 @@
> + if (gSeenWidgets.has(aWidgetId)) {
> + return false;
> + }
> +
> + return true;
Should add a comment here stating the assumption that since it's a XUL widget and we're querying it, we're assuming it exists.
Attachment #795411 -
Flags: review?(bmcbride) → review-
Assignee | ||
Comment 7•11 years ago
|
||
Yeah, the aArea thing was a leftover from my previous iteration. You're right that without it, we can check things immediately.
Attachment #795933 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Attachment #795411 -
Attachment is obsolete: true
Assignee | ||
Comment 8•11 years ago
|
||
Of course, testing it should have happened before putting this up... (missing bracket, fixed in this patch) :-\
Attachment #795959 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Attachment #795933 -
Attachment is obsolete: true
Attachment #795933 -
Flags: review?(bmcbride)
Reporter | ||
Updated•11 years ago
|
Attachment #795959 -
Flags: review?(bmcbride) → review+
Assignee | ||
Comment 9•11 years ago
|
||
Whiteboard: [Australis:M?][Australis:P3] → [Australis:M9][Australis:P3][fixed-in-ux]
Assignee | ||
Comment 10•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:M9][Australis:P3][fixed-in-ux] → [Australis:M9][Australis:P3]
Target Milestone: --- → Firefox 28
You need to log in
before you can comment on or make changes to this bug.
Description
•