Closed Bug 952963 Opened 7 years ago Closed 7 years ago

areaType getter in widget wrapper assumes area exists

Categories

(Firefox :: Toolbars and Customization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 29

People

(Reporter: quicksaver, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

(Whiteboard: [Australis:P4][qa-])

Attachments

(1 file)

At http://mxr.mozilla.org/mozilla-central/source/browser/components/customizableui/src/CustomizableUI.jsm#2891:

> 2891   this.__defineGetter__("areaType", function() {
> 2892     return gAreas.get(aWidget.currentArea).get("type");
> 2893   });

If I call CUI.getWidget(someID).areaType, it will throw a TypeError if the widget has no area (is in the palette) or is "placed" in a custom toolbar that has been unregistered.

Simple example, make that call from the browser console, using an id from any widget in the palette.

There should be a fail-safe that returns either null for this, just like the one in http://mxr.mozilla.org/mozilla-central/source/browser/components/customizableui/src/CustomizableUI.jsm#2987:

> 2987   this.__defineGetter__("areaType", function() {
> 2988     let placement = CustomizableUIInternal.getPlacementOfWidget(aWidgetId);
> 2989     if (!placement) {
> 2990       return null;
> 2991     }
> 2992 
> 2993     return gAreas.get(placement.area).get("type");
> 2994   });
Addendum: There should be a fail-safe that returns null in this case [...]
Version: unspecified → 29 Branch
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Whiteboard: [Australis:P4]
Version: 29 Branch → Trunk
This should do.
Attachment #8355157 - Flags: review?(jaws)
Comment on attachment 8355157 [details] [diff] [review]
areaType getter in widget wrapper shouldn't assume area exists,

Review of attachment 8355157 [details] [diff] [review]:
-----------------------------------------------------------------

A test here would be nice.
Attachment #8355157 - Flags: review?(jaws) → review+
Landed with test:

https://hg.mozilla.org/integration/fx-team/rev/4bc1cf097ca1

and then promptly backed out and relanded to fix the commit msg to have "Australis":

https://hg.mozilla.org/integration/fx-team/rev/52d2bc346659
https://hg.mozilla.org/integration/fx-team/rev/3f3b0a504f65
Whiteboard: [Australis:P4] → [Australis:P4][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/4bc1cf097ca1
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:P4][fixed-in-fx-team] → [Australis:P4]
Target Milestone: --- → Firefox 29
Whiteboard: [Australis:P4] → [Australis:P4][qa-]
You need to log in before you can comment on or make changes to this bug.