Bug 1269765 - Notify http-on-opening-request in content process. r=valentin
authorJarda Snajdr <jsnajdr@gmail.com>
Mon, 30 May 2016 01:24:00 +0200
changeset 338636 f962268dd6dcba2e1d0173e79fb6986d30636a87
parent 338635 6750817f09e1329b156b6572663fecb65fafcb97
child 338637 524bf899365de17f58e19e911a6c13967015d08f
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1269765
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1269765 - Notify http-on-opening-request in content process. r=valentin
netwerk/protocol/http/HttpChannelChild.cpp
xpcom/ds/nsObserverService.cpp
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1748,21 +1748,21 @@ HttpChannelChild::AsyncOpen(nsIStreamLis
 
   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)
--- a/xpcom/ds/nsObserverService.cpp
+++ b/xpcom/ds/nsObserverService.cpp
@@ -222,17 +222,20 @@ nsObserverService::AddObserver(nsIObserv
   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 1269765.
+  if (mozilla::net::IsNeckoChild() && !strncmp(aTopic, "http-on-", 8) &&
+      strcmp(aTopic, "http-on-opening-request")) {
     nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
     nsCOMPtr<nsIScriptError> 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;