Closed Bug 539586 Opened 16 years ago Closed 16 years ago

changes to settings not propagated across SettingsStore instances

Categories

(Mozilla Labs :: Jetpack Prototype, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: myk, Assigned: myk)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch patch v1: fixes problem (obsolete) — Splinter Review
If a feature makes a change to a setting through an instance of SettingsStore, and another instance of SettingsStore exists for the feature, the change doesn't propagate to the other instance. We could fix this by writing code to do the propagation, either by sending a signal to reload the settings from disk (after syncing the change to disk) or by sending a signal with the property name and new value. Another option is to cache and reuse instances, so there is only one instance per feature. This seems preferable, because it is simpler, cheaper (both to implement and in terms of memory consumption) and because there is no utility to having multiple instances of the object for a given feature. Here's a patch that implements the latter approach. It uses a JavaScript module for cache persistence across JavaScript contexts.
Attachment #421533 - Flags: review?(adw)
This version suppresses a bogus memory leak error that the test harness generates and removes the SettingsStore instance from the cache when the feature gets unloaded.
Attachment #421533 - Attachment is obsolete: true
Attachment #421557 - Flags: review?(adw)
Attachment #421533 - Flags: review?(adw)
Here's patch v2 with one additional assertion that Drew asked for over IRC to make sure that the values in the two stores are equal after both set operations.
Attachment #421557 - Attachment is obsolete: true
Attachment #421558 - Flags: review?(adw)
Attachment #421557 - Flags: review?(adw)
Comment on attachment 421558 [details] [diff] [review] patch v3: one additional assertion r=adw
Attachment #421558 - Flags: review?(adw) → review+
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: