Closed Bug 598979 Opened 14 years ago Closed 14 years ago

change "widget" module to use EventEmitter event registration model

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: irakli, Assigned: irakli)

References

Details

Attachments

(1 file)

      No description provided.
Assignee: nobody → rFobic
Attached patch v1Splinter Review
Associated pull request: http://github.com/mozillalabs/jetpack-sdk/pull/17

This patch also includes fix for the widget test failures that occur with ff4b and f3.* now.
Attachment #482535 - Flags: review?(dietrich)
What part of the patch addresses the test failures? If possible, it'd be better to split those changes out. If that's not possible, then just comment here about what caused the failure, and how you addressed it.
Please look at the pull request link I've posted the last commit message explains the it also it includes only changes addressing that. Separating patch won't be easy since change is done on top of other changes in this patch.
Comment on attachment 482535 [details] [diff] [review]
v1


>@@ -224,9 +260,8 @@ let browserManager = {
>   // propagating the change to all windows.
>   updateItem: function browserManager_updateItem(item, property, value) {
>     let idx = this.items.indexOf(item);
>-    if (idx == -1)
>-      throw new Error("The widget " + item + " cannot be updated because it is not currently registered.");
>-    this.windows.forEach(function (w) w.updateItem(item, property, value));
>+    if (idx != -1)
>+      this.windows.forEach(function (w) w.updateItem(item, property, value));
>   },

why are you changing this to silently fail?

r=me otherwise on this patch.
Attachment #482535 - Flags: review?(dietrich) → review+
(In reply to comment #4)
> Comment on attachment 482535 [details] [diff] [review]
> v1
> 
> 
> >@@ -224,9 +260,8 @@ let browserManager = {
> >   // propagating the change to all windows.
> >   updateItem: function browserManager_updateItem(item, property, value) {
> >     let idx = this.items.indexOf(item);
> >-    if (idx == -1)
> >-      throw new Error("The widget " + item + " cannot be updated because it is not currently registered.");
> >-    this.windows.forEach(function (w) w.updateItem(item, property, value));
> >+    if (idx != -1)
> >+      this.windows.forEach(function (w) w.updateItem(item, property, value));
> >   },
> 
> why are you changing this to silently fail?
> 
> r=me otherwise on this patch.

The reason is the assignments that happen in the constructors. With this check exception will be always thrown. Another thing that I noticed that if you can set properties while constructing a Widget there is nothing wrong with changing them even if it's not added yet since actual values will be propagated only when widget is added.
Please let me know whether this reasoning is acceptable or not.
Yep, that's fine, thanks!
OS: Mac OS X → All
Hardware: x86 → All
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: