Closed Bug 1478787 Opened 6 years ago Closed 5 years ago

sharedData.has() does not trigger an update

Categories

(Core :: IPC, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox63 --- wontfix
firefox68 --- fixed

People

(Reporter: Felipe, Assigned: kmag)

References

Details

Attachments

(2 files)

Something that tripped me up today as I was trying to use sharedData:

-- in the parent -- 

Services.ppmm.sharedData.set("foo", "bar");
Services.ppmm.sharedData.flush();

-- in content --

Services.cpmm.sharedData.has("foo"); // returns false



If .has is replaced by .get(), or something else caused it to decode (e.g. iterating over the entries*), then it works.


* good old "I added logging to dump all the entries to see if I had a typo somewhere and then it worked"
Comment on attachment 8995313 [details]
Bug 1478787: Rebuild stale SharedMap on Has() call.

https://reviewboard.mozilla.org/r/259776/#review266818

The fix looks fine, but please tests for `has`.

Also can you double check we're testing the full [interface](https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/dom/chrome-webidl/MozSharedMap.webidl#19-54). `get`, `set`, `delete`, and `flush` all seem to be covered in the [unit test](https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/dom/ipc/tests/test_sharedMap.js). I *think* [enumeration is covered](https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/dom/ipc/tests/test_sharedMap.js#29-37) but it would be good to double check.
Attachment #8995313 - Flags: review?(erahm) → review-
Assignee: nobody → kmaglione+bmo
Flags: needinfo?(kmaglione+bmo)
Priority: -- → P3
Flags: needinfo?(kmaglione+bmo)

Do we actually need the has method? I'm struggling to think of a case where you'd want to test if a key exists and then not get it.

(In reply to Dave Townsend [:mossop] (he/him) from comment #4)

Do we actually need the has method?

Probably not, but regular Map has one, so.

MozReview-Commit-ID: 5aFVBNQW4QR

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: