Backed out changesets 1620bf9f8f2a and 0d75db15b6ed (bug 1119692) for nsZipReaderCache::GetFd crashes.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 26 Aug 2015 11:20:54 -0400
changeset 288068 7fc523df399dd5e9d464d4bce2cc5e0d86035004
parent 288067 b15e2623ea80c2135494aab965e624c8f23b74f6
child 288069 01e811dbd44d28240f3c1bae9decca4f96a1292c
push id4792
push useryura.zenevich@gmail.com
push dateWed, 26 Aug 2015 20:00:52 +0000
bugs1119692
milestone43.0a1
backs out1620bf9f8f2a28b8e965e885754dc5e27fc2658c
0d75db15b6ed6db4fdfcc1fd0775736f09995d25
Backed out changesets 1620bf9f8f2a and 0d75db15b6ed (bug 1119692) for nsZipReaderCache::GetFd crashes. CLOSED TREE
dom/ipc/TabParent.cpp
dom/ipc/moz.build
netwerk/ipc/RemoteOpenFileChild.cpp
netwerk/protocol/app/AppProtocolHandler.cpp
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -61,17 +61,16 @@
 #include "nsIWindowCreator2.h"
 #include "nsIXULBrowserWindow.h"
 #include "nsIXULWindow.h"
 #include "nsIRemoteBrowser.h"
 #include "nsViewManager.h"
 #include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 #include "nsIWindowWatcher.h"
-#include "nsJARProtocolHandler.h"
 #include "nsOpenURIInFrameParams.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowWatcher.h"
 #include "nsPresShell.h"
 #include "nsPrintfCString.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsWindowWatcher.h"
@@ -894,28 +893,19 @@ TabParent::LoadURL(nsIURI* aURI)
 
                 rv = packageFile->Append(NS_LITERAL_STRING("application.zip"));
                 NS_ENSURE_SUCCESS_VOID(rv);
 
                 nsString path;
                 rv = packageFile->GetPath(path);
                 NS_ENSURE_SUCCESS_VOID(rv);
 
-                PRFileDesc* cachedFd = nullptr;
-                gJarHandler->JarCache()->GetFd(packageFile, &cachedFd);
-
-                if (cachedFd) {
-                    FileDescriptor::PlatformHandleType handle =
-                        FileDescriptor::PlatformHandleType(PR_FileDesc2NativeHandle(cachedFd));
-                    unused << SendCacheFileDescriptor(path, FileDescriptor(handle));
-                } else {
-                    nsRefPtr<OpenFileAndSendFDRunnable> openFileRunnable =
-                        new OpenFileAndSendFDRunnable(path, this);
-                    openFileRunnable->Dispatch();
-                }
+                nsRefPtr<OpenFileAndSendFDRunnable> openFileRunnable =
+                    new OpenFileAndSendFDRunnable(path, this);
+                openFileRunnable->Dispatch();
             }
         }
     }
 }
 
 void
 TabParent::Show(const ScreenIntSize& size, bool aParentIsActive)
 {
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -142,17 +142,16 @@ LOCAL_INCLUDES += [
     '/editor/libeditor',
     '/embedding/components/printingui/ipc',
     '/extensions/cookie',
     '/extensions/spellcheck/src',
     '/gfx/2d',
     '/hal/sandbox',
     '/layout/base',
     '/media/webrtc',
-    '/modules/libjar',
     '/netwerk/base',
     '/toolkit/xre',
     '/uriloader/exthandler',
     '/widget',
     '/xpcom/base',
     '/xpcom/threads',
 ]
 
--- a/netwerk/ipc/RemoteOpenFileChild.cpp
+++ b/netwerk/ipc/RemoteOpenFileChild.cpp
@@ -224,18 +224,16 @@ RemoteOpenFileChild::AsyncRemoteFileOpen
   mAsyncOpenCalled = true;
   return NS_OK;
 #else
   nsString path;
   if (NS_FAILED(mFile->GetPath(path))) {
     MOZ_CRASH("Couldn't get path from file!");
   }
 
-  mListener = aListener;
-
   if (mTabChild) {
     if (mTabChild->GetCachedFileDescriptor(path, this)) {
       // The file descriptor was found in the cache and OnCachedFileDescriptor()
       // will be called with it.
       return NS_OK;
     }
   }
 
@@ -245,16 +243,17 @@ RemoteOpenFileChild::AsyncRemoteFileOpen
   SerializeURI(mAppURI, appUri);
 
   IPC::SerializedLoadContext loadContext(aLoadContext);
   gNeckoChild->SendPRemoteOpenFileConstructor(this, loadContext, uri, appUri);
 
   // The chrome process now has a logical ref to us until it calls Send__delete.
   AddIPDLReference();
 
+  mListener = aListener;
   mAsyncOpenCalled = true;
   return NS_OK;
 #endif
 }
 
 nsresult
 RemoteOpenFileChild::SetNSPRFileDesc(PRFileDesc* aNSPRFileDesc)
 {
--- a/netwerk/protocol/app/AppProtocolHandler.cpp
+++ b/netwerk/protocol/app/AppProtocolHandler.cpp
@@ -460,21 +460,22 @@ AppProtocolHandler::NewChannel2(nsIURI* 
       nsRefPtr<nsIChannel> dummyChannel = new DummyChannel();
       dummyChannel->SetLoadInfo(aLoadInfo);
       dummyChannel.forget(aResult);
       return NS_OK;
     }
     mAppInfoCache.Put(host, appInfo);
   }
 
-  // Even core apps are on /system partition and can be accessed directly, but
-  // to ease sandboxing code not to handle the special case of core apps, only
-  // use scheme jar:file in parent, see bug 1119692 comment 20.
-  nsAutoCString jarSpec(XRE_IsParentProcess() ? "jar:file://"
-                                              : "jar:remoteopenfile://");
+  bool noRemote = (appInfo->mIsCoreApp ||
+                   XRE_IsParentProcess());
+
+  // In-parent and CoreApps can directly access files, so use jar:file://
+  nsAutoCString jarSpec(noRemote ? "jar:file://"
+                                 : "jar:remoteopenfile://");
   jarSpec += NS_ConvertUTF16toUTF8(appInfo->mPath) +
              NS_LITERAL_CSTRING("/application.zip!") +
              fileSpec;
 
   nsCOMPtr<nsIURI> jarURI;
   rv = NS_NewURI(getter_AddRefs(jarURI),
                  jarSpec, nullptr, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);