Closed
Bug 552829
Opened 15 years ago
Closed 15 years ago
e10s - Online and offline events
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: dougt, Assigned: dougt)
References
Details
Attachments
(1 file, 4 obsolete files)
(deleted),
patch
|
fred23
:
review+
|
Details | Diff | Splinter Review |
We need to forward online and offline events from chrome to content.
Comment 1•15 years ago
|
||
Doug, please point out the relevant code files/functions where this happens, and I'll try to get someone on this ASAP.
Comment 2•15 years ago
|
||
I'm starting to be very familiar with forwarding stuff over IPC... I can tackle this if you want.
Assignee | ||
Comment 3•15 years ago
|
||
+1
Comment 4•15 years ago
|
||
hehe... I don't exactly know what your "+1" refers to, but in Comment 2, I meant I could tackle this bug, once you're finished pointing out the relevant code files/functions where it happens...
just wanted to make sure we understand each other, thanks.
Comment 5•15 years ago
|
||
Frederic,
I mentioned this to Jae-Seong as a possible bug for him to work on, but if you have cycles free, you could take it. Perhaps you can work that out between yourselves. I'm sure there's enough necko work to go around...
Comment 6•15 years ago
|
||
Assigning to Frederic--I'm giving bug 555514 to Jae-Seong.
Dougt: please point us at the function/file where online/offline events are currently send.
Assignee: nobody → bugzillaFred
Comment 7•15 years ago
|
||
Attachment #435935 -
Flags: feedback?(dougt)
Assignee | ||
Comment 8•15 years ago
|
||
Comment on attachment 435935 [details]
initial planning
Looks fine. I think we might have to get rid of the two notifications:
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIIOService.idl#154
I am worried that they will have synchronization issues. The listeners (in C++) are few and they probably can just use this new event.
Comment 9•15 years ago
|
||
(In reply to comment #8)
>I think we might have to get rid of the two notifications:
>
> I am worried that they will have synchronization issues. The listeners (in
> C++) are few and they probably can just use this new event.
atm, we've got :
- 2 NS_IOSERVICE_GOING_OFFLINE_TOPIC listeners
(nsDownloadManager and nsXPInstallManager).
- 2 NS_IOSERVICE_OFFLINE_STATUS_TOPIC listeners
(nsDownloadManager and nsGlobalWindow that fires
DOM online/offline events)
I'm not sure I understand your sync concern here... Do you mean you're concerned about chrome and content offline states somehow getting out of sync ?
Assignee | ||
Comment 10•15 years ago
|
||
after thinking about it a bit more, it isn't a worry. Those consumers are in the chrome process and can continue doing what they are doing. for e10s, there will only be one event which broadcasts offline state information to content. My worry was that if we had to propagate the "i am about to go offline" event to content, content really couldn't do anything since by the time it got the event, chrome probably would already be offline.
Updated•15 years ago
|
Attachment #435935 -
Flags: feedback?(dougt)
Comment 11•15 years ago
|
||
Comment on attachment 435935 [details]
initial planning
agreed!
So will patch soon and r? somebody... Jduell ?
Comment 12•15 years ago
|
||
Have both dougt and I review. I don't know this code at all, so I'm mainly useful for general e10s review.
Comment 13•15 years ago
|
||
Attachment #436253 -
Flags: review?(jduell.mcbugs)
Updated•15 years ago
|
Attachment #436253 -
Flags: review?(dougt)
Assignee | ||
Comment 14•15 years ago
|
||
Comment on attachment 436253 [details] [diff] [review]
patch v.1
>diff --git a/dom/ipc/ContentProcessChild.cpp b/dom/ipc/ContentProcessChild.cpp
>--- a/dom/ipc/ContentProcessChild.cpp
>+++ b/dom/ipc/ContentProcessChild.cpp
>@@ -152,6 +152,17 @@ ContentProcessChild::RecvRegisterChrome(
> return true;
> }
>
>+bool
>+ContentProcessChild::RecvSetOffline(const PRBool& offline)
>+{
>+ nsCOMPtr<nsIIOService> io (do_GetIOService());
>+ if (io) {
>+ io->SetOffline(offline);
>+ }
Lose the curly braces.
NS_ASSERTION(io, "IO Service can not be null");
I am not sure you really need to test for |io|.
>diff --git a/dom/ipc/ContentProcessParent.cpp b/dom/ipc/ContentProcessParent.cpp
>--- a/dom/ipc/ContentProcessParent.cpp
>+++ b/dom/ipc/ContentProcessParent.cpp
>@@ -61,6 +61,8 @@ PRBool gSingletonDied = PR_FALSE;
> namespace mozilla {
> namespace dom {
>
>+#define NS_IOSERVICE_SET_OFFLINE_TOPIC "history-notify-visited"
This is probably the wrong string for this topic. why not "offline-topic-changed" or something like that? This is also defined below in a header?
>+
>+#ifdef MOZ_IPC
>+ if (XRE_GetProcessType() == GeckoProcessType_Default) {
>+ nsCOMPtr<nsIObserverService> observerService =
>+ do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
>+ if (observerService) {
>+ (void)observerService->NotifyObservers(aURI,
>+ HISTORY_NOTIFY_VISITED_TOPIC,
>+ offline ?
>+ NS_LITERAL_STRING("true").get() :
>+ NS_LITERAL_STRING("false").get());
not sure about the rest of the file, but, in general, you should line up parameters to this method call.
Also, add an NS_ASSERTION() We should always have the observer service.
Attachment #436253 -
Flags: review?(jduell.mcbugs)
Attachment #436253 -
Flags: review?(dougt)
Attachment #436253 -
Flags: review-
Comment 15•15 years ago
|
||
Patch corrected per review comments
Attachment #436253 -
Attachment is obsolete: true
Attachment #437034 -
Flags: review?(dougt)
Updated•15 years ago
|
Attachment #437034 -
Flags: review?(jduell.mcbugs)
Assignee | ||
Updated•15 years ago
|
Attachment #437034 -
Flags: review?(jduell.mcbugs)
Attachment #437034 -
Flags: review?(dougt)
Attachment #437034 -
Flags: review-
Assignee | ||
Comment 16•15 years ago
|
||
Comment on attachment 437034 [details] [diff] [review]
patch v.2
drop the whitespace at the end of:
+ parent, NS_IOSERVICE_SET_OFFLINE_TOPIC, PR_FALSE);
+ NS_IOSERVICE_SET_OFFLINE_TOPIC, offline ?
I tested this in Fennec on device using:
http://starkravingfinkle.org/projects/offline/todo.html
And did not see the expected result. Any ideas?
Comment 17•15 years ago
|
||
> I tested this in Fennec on device using:
>
> http://starkravingfinkle.org/projects/offline/todo.html
>
> And did not see the expected result. Any ideas?
What were you looking for as an expected behavior for this on Fennec ? I'm afraid me don't currently have any offline/online support on the fennec chrome, right?
Assignee | ||
Comment 18•15 years ago
|
||
hey fred23,
basically I disconnect the phone from the connected network. this (on non-e10s builds) fires an offline notification which content can register for:
addEventListener("online", function...
Assignee | ||
Comment 19•15 years ago
|
||
Comment on attachment 437034 [details] [diff] [review]
patch v.2
okay... the problem here is that the #defines do not match:
+#define NS_IOSERVICE_SET_OFFLINE_TOPIC "network:set-offline"
+
+#define NS_IOSERVICE_SET_OFFLINE_TOPIC "ioservice-set-offline"
+
If they do match, things work as expected.
Given that you want to make this a private event between the for e10s purposes, how about:
#define NS_E10S_IOSERVICE_SET_OFFLINE_TOPIC "e10s:network:set-offline"
Fred, can you fix this up and post a new patch?
Assignee | ||
Comment 20•15 years ago
|
||
Assignee: bugzillaFred → dougt
Attachment #435935 -
Attachment is obsolete: true
Attachment #437034 -
Attachment is obsolete: true
Attachment #444153 -
Flags: review?
Assignee | ||
Comment 21•15 years ago
|
||
fwiw, to test on the desktop, just change one of the ui handlers (like the forward button), to do something like:
let (ios = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService2)) {
let a = ios.offline;
ios.manageOfflineStatus = !a;
ios.offline = !a;
}
Comment 22•15 years ago
|
||
I'll push as soon as trees are open, since it's working on desktop.
Assignee | ||
Updated•15 years ago
|
Attachment #444153 -
Flags: review? → review+
Assignee | ||
Comment 23•15 years ago
|
||
Comment on attachment 444153 [details] [diff] [review]
patch - with the #define change
all new instances of NS_IOSERVICE_SET_OFFLINE_TOPIC
should be
NS_E10S_IOSERVICE_SET_OFFLINE_TOPIC
Attachment #444153 -
Flags: review+ → review-
Comment 24•15 years ago
|
||
patch with last comments from Doug addressed.
Attachment #444153 -
Attachment is obsolete: true
Attachment #444638 -
Flags: review+
Updated•15 years ago
|
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 25•15 years ago
|
||
Comment 26•15 years ago
|
||
(In reply to comment #19)
> #define NS_E10S_IOSERVICE_SET_OFFLINE_TOPIC "e10s:network:set-offline"
Left field comment, but why introduce "e10s" into the source code? Isn't this "ipc" ?
Comment 27•15 years ago
|
||
Good catch from the left field : Makes sense. Doug ?
Assignee | ||
Comment 28•15 years ago
|
||
yeah mfinkle is right. don't introduce project names. frederic, can you push a change?
Comment 29•15 years ago
|
||
Pushed this quick fix :
http://hg.mozilla.org/projects/electrolysis/rev/31d2d548061a
You need to log in
before you can comment on or make changes to this bug.
Description
•