# HG changeset patch # User Tom Tromey Bug 1134073 - Part 1: notify http-on-opening-request observers in content process diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index da2936c..5801ce2 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -1748,21 +1748,21 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext) AddCookiesToRequest(); // // NOTE: From now on we must return NS_OK; all errors must be handled via // OnStart/OnStopRequest // - // Note: this is where we would notify "http-on-modify-request" observers. - // We have deliberately disabled this for child processes (see bug 806753) - // - // notify "http-on-modify-request" observers - //CallOnModifyRequestObservers(); + // We notify "http-on-opening-request" observers in the child + // process so that devtools can capture a stack trace at the + // appropriate spot. See bug 806753 for some information about why + // other http-* notifications are disabled in child processes. + gHttpHandler->OnOpeningRequest(this); mIsPending = true; mWasOpened = true; mListener = listener; mListenerContext = aContext; // add ourselves to the load group. if (mLoadGroup) diff --git a/xpcom/ds/nsObserverService.cpp b/xpcom/ds/nsObserverService.cpp index 42bcff5..89bb687 100644 --- a/xpcom/ds/nsObserverService.cpp +++ b/xpcom/ds/nsObserverService.cpp @@ -224,17 +224,20 @@ nsObserverService::AddObserver(nsIObserver* aObserver, const char* aTopic, LOG(("nsObserverService::AddObserver(%p: %s)", (void*)aObserver, aTopic)); NS_ENSURE_VALIDCALL if (NS_WARN_IF(!aObserver) || NS_WARN_IF(!aTopic)) { return NS_ERROR_INVALID_ARG; } - if (mozilla::net::IsNeckoChild() && !strncmp(aTopic, "http-on-", 8)) { + // Specifically allow http-on-opening-request in the child process; + // see bug 906239. + if (mozilla::net::IsNeckoChild() && !strncmp(aTopic, "http-on-", 8) && + strcmp(aTopic, "http-on-opening-request")) { nsCOMPtr console(do_GetService(NS_CONSOLESERVICE_CONTRACTID)); nsCOMPtr error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); error->Init(NS_LITERAL_STRING("http-on-* observers only work in the parent process"), EmptyString(), EmptyString(), 0, 0, nsIScriptError::warningFlag, "chrome javascript"); console->LogMessage(error); return NS_ERROR_NOT_IMPLEMENTED;