Closed Bug 1287235 Opened 8 years ago Closed 8 years ago

sdk/event/utils.js WeakValueGetterSetter should use try/cache around Cu.getWeakReference

Categories

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

defect
Not set
normal

Tracking

(firefox49 fixed, firefox50 fixed)

RESOLVED FIXED
mozilla50
Tracking Status
firefox49 --- fixed
firefox50 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

Details

Attachments

(2 files)

In bug 1267693 I made input.value a weak reference in most cases.  This is done using Cu.getWeakReference when the event value is an object.

We should really put the getWeakReference() call in a try/catch, though.  If a native object that does not implement nsISupportsWeakReference is passed as the event then the current code will throw.

I don't know of any instance of this, but we should just do it proactively to be correct.

I'll fix this on Monday.
Boris, this is an issue we spoke about a few days ago.  I added a Cu.getWeakReference() to addon-sdk, but I can't guarantee the value I'm wrapping is safe to be a weak reference.  It can be a js value or a native object.  Per your suggestion I'm just wrapping it in a try/catch here.
Attachment #8772427 - Flags: review?(bzbarsky)
Comment on attachment 8772427 [details] [diff] [review]
Wrap addon-sdk's Cu.getWeakReference() in a try/catch in case native objects are passed. r=bz

r=me
Attachment #8772427 - Flags: review?(bzbarsky) → review+
Pushed by bkelly@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/402ae3d3dec6
Wrap addon-sdk's Cu.getWeakReference() in a try/catch in case native objects are passed. r=bz
https://hg.mozilla.org/mozilla-central/rev/402ae3d3dec6
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Comment on attachment 8772427 [details] [diff] [review]
Wrap addon-sdk's Cu.getWeakReference() in a try/catch in case native objects are passed. r=bz

Approval Request Comment
[Feature/regressing bug #]: Minor fix to bug 1267693 which is being uplifted.
[User impact if declined]: Avoid some rare, but potential addon compat issues with bug 1267693.
[Describe test coverage new/current, TreeHerder]: Existing tests.
[Risks and why]: None.
[String/UUID change made/needed]: None
Attachment #8772427 - Flags: approval-mozilla-aurora?
Comment on attachment 8772427 [details] [diff] [review]
Wrap addon-sdk's Cu.getWeakReference() in a try/catch in case native objects are passed. r=bz

sure, let's take it in aurora. Thanks
Attachment #8772427 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attached file alt-3.zip
Commons
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: