Closed Bug 1547861 Opened 5 years ago Closed 5 years ago

sharedData.has doesn't seem to work correctly

Categories

(Core :: IPC, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1478787

People

(Reporter: mossop, Unassigned)

Details

I've been struggling to get my synchronisation of data between main and content process right so maybe I'm misunderstanding, but from what I can see sharedData.has doesn't work correctly.

I have a service in the main process which in result to API calls updates a property of sharedData and then flushes it. The content processes retrieve the data on startup and then listen for change events. They first call sharedData.has to see if there is any data and then sharedData.get to get it.

What I'm seeing is that when a content process first starts the sharedData.has call returns true and sharedData.get gets the correct data. However when already running processes receive the change event sharedData.has returns false. Dropping the sharedData.has check see sharedData.get return the correct data in all cases so sharedData.has seems broken in some way.

What I see from the code is that the first thing that sharedData.get does is call MaybeRebuild (https://searchfox.org/mozilla-central/rev/b756e6d00728dda4121f8278a744381d8643317a/dom/ipc/SharedMap.cpp#53) before going on to get the value of the key. sharedData.has doesn't do this, it just checks if the key exists immediately (https://searchfox.org/mozilla-central/rev/b756e6d00728dda4121f8278a744381d8643317a/dom/ipc/SharedMap.cpp#48).

So my guess is that sharedData.has needs to call MaybeRebuild before checking for key presence?

Given that the call to update the content processes shared data causes the entries to be cleared and as far as I can see not re-created until MaybeRebuild is called this seems like a reasonable guess.

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