> Ah! well, because it actually seems to make a difference on mobile -- > we have at least one case of a webapp using gears that has large > manifests, and the update seems to slow everything down until the > network connection attempts timeout... as we can know if we have > network access or not, it makes sense to take advantage of that > information to be more efficient when we can, I think.
I see. >>> Uh... I'm not sure I understand -- AsyncTasks can span multiple page >>> navigations ? >> >> NPN_GetValue takes an NPP instance as a parameter. AsyncTasks can run >> where there are no NPP instances. > > Yes, in that case we simply consider that we are online, and attempt > the connection. AsyncTasks started via one NPP instance can outlive the NPP instance that started it. I think NPN_GetValue may get called with a dangling pointer in that case? Some ideas... * Can android be modified to support NPN_GetValue(NULL, NPNVOnline_Android, &result) callable from any thread? * Sounds like ApacheHttpRequestAndroid doesn't know about online or not. Would it be possible to modify that class do know about this state? Would be closer to the root of the issue i think. * If android mods are possible... To test for navigator.online, which NPP instance is used to conduct the query doesn't matter. Maybe maintain a collection of live instances (gears for chrome does something along those lines) and and grab one of them to make this query when needed. If none is available, return true i suppose... (but gears will still be making requests in many cases so this ain't so great). * To avoid the SyncFunctor'ing back to the main thread, only conduct the test when called on the main thread. Conduct the test in HttpRequestAndroid::Send() which is always called on the main thread. Some words of caution about the class BrowserContext... This is the most vague and squishy abstraction we have. This was added to facilitate plumbing some obscure values around in the Chrome impl of Gears prior to Chrome being public knowlege. The class comments are not accurate... subterfuge alert. In chrome it sometimes corresponds with a chrome user profile (off-the-record is considered a different user-profile). At other times it corresponds to a window/tab for the purpose of positioning dialogs reasonably.
