Closed Bug 1245141 Opened 8 years ago Closed 8 years ago

Use `new Proxy` for AddonManager.addonTypes

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

References

Details

Attachments

(1 file, 2 obsolete files)

      No description provided.
Attachment #8714863 - Flags: review?(dtownsend)
Assignee: nobody → evilpies
Comment on attachment 8714863 [details] [diff] [review]
v1 - Change Proxy.create to new Proxy in AddonManagerInternal

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

::: toolkit/mozapps/extensions/AddonManager.jsm
@@ +2675,5 @@
> +      setPrototypeOf(target, prototype) {
> +        // Not allowed to change prototype
> +        return false;
> +      }
> +    });

Why does this create a new proxy every time?
Because we need a reference to AddonManagerInternal.types, which we can't get during initialization. We can't cache the proxy on AddonManagerInternal, because that object seems to be frozen. However this would work:

let types = {}
let AddonManagerInternal = {
...
 types,
...
 typesProxy: new Proxy(types, {...})
...
}

Or we could move typesProxy to a global variable.
Comment on attachment 8714863 [details] [diff] [review]
v1 - Change Proxy.create to new Proxy in AddonManagerInternal

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

I guess it doesn't matter much
Attachment #8714863 - Flags: review?(dtownsend) → review+
Turns out that the previous Proxy actually modified that value returned for [[Get]]. (We always return the `type` property) Sorry about that, but I did a try push this time. https://treeherder.mozilla.org/#/jobs?repo=try&revision=cc284c8eb5b7
Attachment #8714863 - Attachment is obsolete: true
Attachment #8715004 - Flags: review?(dtownsend)
Ups, right patch this time.
Attachment #8715004 - Attachment is obsolete: true
Attachment #8715004 - Flags: review?(dtownsend)
Attachment #8715468 - Flags: review?(dtownsend)
Attachment #8715468 - Flags: review?(dtownsend) → review+
https://hg.mozilla.org/mozilla-central/rev/6515133eb252
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: