Bug 1260876 - Remove process switch code for signed package code (added by Bug 1186290). r=valentin.
authorHenry Chang <hchang@mozilla.com>
Tue, 12 Apr 2016 10:53:40 +0800
changeset 330646 465581fb7e66e4bd4dedd40262d03873583cb9e7
parent 330645 21ad62cfce1989cfb2881db01bacc236cc5917f6
child 330647 46a0648db82f51e4c09eebb96fe8df9f872f4f0d
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1260876, 1186290
milestone48.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 1260876 - Remove process switch code for signed package code (added by Bug 1186290). r=valentin.
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
netwerk/base/moz.build
netwerk/base/nsIPackagedAppChannelListener.idl
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
netwerk/protocol/http/HttpChannelParentListener.cpp
netwerk/protocol/http/HttpChannelParentListener.h
netwerk/protocol/http/PackagedAppService.cpp
netwerk/protocol/http/PackagedAppService.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChannel.h
netwerk/test/mochitests/mochitest.ini
netwerk/test/mochitests/signed_web_packaged_app_random.sjs
netwerk/test/mochitests/test_about_blank_to_signed_web_packaged_app.html
netwerk/test/mochitests/test_origin_attributes_conversion.html
netwerk/test/mochitests/test_signed_to_signed_web_packaged_app.html
netwerk/test/mochitests/test_signed_web_packaged_app.html
netwerk/test/mochitests/test_signed_web_packaged_app_origin.html
netwerk/test/unit/test_packaged_app_service.js
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -101,22 +101,16 @@
 using namespace mozilla::dom;
 using namespace mozilla::ipc;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
 using namespace mozilla::services;
 using namespace mozilla::widget;
 using namespace mozilla::jsipc;
 
-#if DEUBG
-  #define LOG(args...) printf_stderr(args)
-#else
-  #define LOG(...)
-#endif
-
 // The flags passed by the webProgress notifications are 16 bits shifted
 // from the ones registered by webProgressListeners.
 #define NOTIFY_FLAG_SHIFT 16
 
 class OpenFileAndSendFDRunnable : public nsRunnable
 {
     const nsString mPath;
     RefPtr<TabParent> mTabParent;
@@ -455,131 +449,16 @@ TabParent::IsVisible() const
     return false;
   }
 
   bool visible = false;
   frameLoader->GetVisible(&visible);
   return visible;
 }
 
-static void LogChannelRelevantInfo(nsIURI* aURI,
-                                   nsIPrincipal* aLoadingPrincipal,
-                                   nsIPrincipal* aChannelResultPrincipal,
-                                   nsContentPolicyType aContentPolicyType) {
-  nsCString loadingOrigin;
-  aLoadingPrincipal->GetOrigin(loadingOrigin);
-
-  nsCString uriString;
-  aURI->GetAsciiSpec(uriString);
-  LOG("Loading %s from origin %s (type: %d)\n", uriString.get(),
-                                                loadingOrigin.get(),
-                                                aContentPolicyType);
-
-  nsCString resultPrincipalOrigin;
-  aChannelResultPrincipal->GetOrigin(resultPrincipalOrigin);
-  LOG("Result principal origin: %s\n", resultPrincipalOrigin.get());
-}
-
-// This is similar to nsIScriptSecurityManager.getChannelResultPrincipal
-// but taking signedPkg into account. The reason we can't rely on channel
-// loadContext/loadInfo is it's dangerous to mutate them on parent process.
-static already_AddRefed<nsIPrincipal>
-GetChannelPrincipalWithSingedPkg(nsIChannel* aChannel, const nsACString& aSignedPkg)
-{
-  NeckoOriginAttributes neckoAttrs;
-  NS_GetOriginAttributes(aChannel, neckoAttrs);
-
-  PrincipalOriginAttributes attrs;
-  attrs.InheritFromNecko(neckoAttrs);
-  attrs.mSignedPkg = NS_ConvertUTF8toUTF16(aSignedPkg);
-
-  nsCOMPtr<nsIURI> uri;
-  nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
-  NS_ENSURE_SUCCESS(rv, nullptr);
-
-  nsCOMPtr<nsIPrincipal> principal =
-    BasePrincipal::CreateCodebasePrincipal(uri, attrs);
-
-  return principal.forget();
-}
-
-bool
-TabParent::ShouldSwitchProcess(nsIChannel* aChannel, const nsACString& aSignedPkg)
-{
-  // If we lack of any information which is required to decide the need of
-  // process switch, consider that we should switch process.
-
-  // Prepare the channel loading principal.
-  nsCOMPtr<nsILoadInfo> loadInfo;
-  aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
-  NS_ENSURE_TRUE(loadInfo, true);
-  nsCOMPtr<nsIPrincipal> loadingPrincipal;
-  loadInfo->GetLoadingPrincipal(getter_AddRefs(loadingPrincipal));
-  NS_ENSURE_TRUE(loadingPrincipal, true);
-
-  // Prepare the channel result principal.
-  nsCOMPtr<nsIPrincipal> channelPrincipal =
-    GetChannelPrincipalWithSingedPkg(aChannel, aSignedPkg);
-
-  // Log the debug info which is used to decide the need of proces switch.
-  nsCOMPtr<nsIURI> uri;
-  aChannel->GetURI(getter_AddRefs(uri));
-  LogChannelRelevantInfo(uri, loadingPrincipal, channelPrincipal,
-                         loadInfo->InternalContentPolicyType());
-
-  // Check if the signed package is loaded from the same origin.
-  bool sameOrigin = false;
-  loadingPrincipal->Equals(channelPrincipal, &sameOrigin);
-  if (sameOrigin) {
-    LOG("Loading singed package from the same origin. Don't switch process.\n");
-    return false;
-  }
-
-  // If this is not a top level document, there's no need to switch process.
-  if (nsIContentPolicy::TYPE_DOCUMENT != loadInfo->InternalContentPolicyType()) {
-    LOG("Subresource of a document. No need to switch process.\n");
-    return false;
-  }
-
-  DocShellOriginAttributes attrs = OriginAttributesRef();
-  if (attrs.mSignedPkg == NS_ConvertUTF8toUTF16(aSignedPkg)) {
-    // This tab is made for the incoming signed content.
-    return false;
-  }
-
-  return true;
-}
-
-void
-TabParent::OnStartSignedPackageRequest(nsIChannel* aChannel,
-                                       const nsACString& aPackageId)
-{
-  if (!ShouldSwitchProcess(aChannel, aPackageId)) {
-    return;
-  }
-
-  nsCOMPtr<nsIURI> uri;
-  aChannel->GetURI(getter_AddRefs(uri));
-
-  aChannel->Cancel(NS_BINDING_FAILED);
-
-  nsCString uriString;
-  uri->GetAsciiSpec(uriString);
-  LOG("We decide to switch process. Call nsFrameLoader::SwitchProcessAndLoadURIs: %s\n",
-       uriString.get());
-
-  RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
-  NS_ENSURE_TRUE_VOID(frameLoader);
-
-  nsresult rv = frameLoader->SwitchProcessAndLoadURI(uri, aPackageId);
-  if (NS_FAILED(rv)) {
-    NS_WARNING("Failed to switch process.");
-  }
-}
-
 void
 TabParent::DestroyInternal()
 {
   IMEStateManager::OnTabParentDestroying(this);
 
   RemoveWindowListeners();
 
   // If this fails, it's most likely due to a content-process crash,
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -539,21 +539,16 @@ public:
 
   void AddInitialDnDDataTo(DataTransfer* aDataTransfer);
 
   void TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
                              int32_t& aDragAreaX, int32_t& aDragAreaY);
 
   layout::RenderFrameParent* GetRenderFrame();
 
-  // Called by HttpChannelParent. The function may use a new process to
-  // reload the URI associated with the given channel.
-  void OnStartSignedPackageRequest(nsIChannel* aChannel,
-                                   const nsACString& aPackageId);
-
   void AudioChannelChangeNotification(nsPIDOMWindowOuter* aWindow,
                                       AudioChannel aAudioChannel,
                                       float aVolume,
                                       bool aMuted);
   bool SetRenderFrame(PRenderFrameParent* aRFParent);
   bool GetRenderFrameInfo(TextureFactoryIdentifier* aTextureFactoryIdentifier,
                           uint64_t* aLayersId);
 
@@ -587,20 +582,16 @@ protected:
                                  const int32_t& aCx, const int32_t& aCy) override;
 
   virtual bool RecvAudioChannelActivityNotification(const uint32_t& aAudioChannel,
                                                     const bool& aActive) override;
 
   bool InitBrowserConfiguration(const nsCString& aURI,
                                 BrowserConfiguration& aConfiguration);
 
-  // Decide whether we have to use a new process to reload the URI associated
-  // with the given channel.
-  bool ShouldSwitchProcess(nsIChannel* aChannel, const nsACString& aSignedPkg);
-
   ContentCacheInParent mContentCache;
 
   nsIntRect mRect;
   ScreenIntSize mDimensions;
   ScreenOrientationInternal mOrientation;
   float mDPI;
   CSSToLayoutDeviceScale mDefaultScale;
   bool mUpdatedDimensions;
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -67,17 +67,16 @@ XPIDL_SOURCES += [
     'nsINetworkInterceptController.idl',
     'nsINetworkLinkService.idl',
     'nsINetworkPredictor.idl',
     'nsINetworkPredictorVerifier.idl',
     'nsINetworkProperties.idl',
     'nsINSSErrorsService.idl',
     'nsINullChannel.idl',
     'nsIPACGenerator.idl',
-    'nsIPackagedAppChannelListener.idl',
     'nsIPackagedAppService.idl',
     'nsIPackagedAppUtils.idl',
     'nsIPackagedAppVerifier.idl',
     'nsIParentChannel.idl',
     'nsIParentRedirectingChannel.idl',
     'nsIPermission.idl',
     'nsIPermissionManager.idl',
     'nsIPrivateBrowsingChannel.idl',
deleted file mode 100644
--- a/netwerk/base/nsIPackagedAppChannelListener.idl
+++ /dev/null
@@ -1,25 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-/**
- * nsIPackagedAppChannelListener
- */
-[scriptable, uuid(27caf7d0-3c0e-11e5-b970-0800200c9a66)]
-interface nsIPackagedAppChannelListener : nsISupports
-{
-  /**
-   * @param aPackageId
-   *    the package identifier of the signed package that we are going
-   *    to load. The identifier will be defined in the manifest of the
-   *    package.
-   *
-   * This callback is to notify a signed package is about to load. Some
-   * component else will be in charge of responding to this fact properly.
-   * The procotol layer should have no idea what to do with this.
-   *
-   */
-  void onStartSignedPackageRequest(in ACString aPackageId);
-};
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -152,17 +152,16 @@ HttpChannelParent::Init(const HttpChanne
 
 NS_IMPL_ADDREF(HttpChannelParent)
 NS_IMPL_RELEASE(HttpChannelParent)
 NS_INTERFACE_MAP_BEGIN(HttpChannelParent)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink)
   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-  NS_INTERFACE_MAP_ENTRY(nsIPackagedAppChannelListener)
   NS_INTERFACE_MAP_ENTRY(nsIParentChannel)
   NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
   NS_INTERFACE_MAP_ENTRY(nsIParentRedirectingChannel)
   NS_INTERFACE_MAP_ENTRY(nsIDeprecationWarner)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIParentRedirectingChannel)
   if (aIID.Equals(NS_GET_IID(HttpChannelParent))) {
     foundInterface = static_cast<nsIInterfaceRequestor*>(this);
   } else
@@ -980,29 +979,16 @@ HttpChannelParent::RecvRemoveCorsPreflig
     return false;
   }
   nsCORSListenerProxy::RemoveFromCorsPreflightCache(deserializedURI,
                                                     principal);
   return true;
 }
 
 //-----------------------------------------------------------------------------
-// HttpChannelParent::nsIPackagedAppChannelListener
-//-----------------------------------------------------------------------------
-
-NS_IMETHODIMP
-HttpChannelParent::OnStartSignedPackageRequest(const nsACString& aPackageId)
-{
-  if (mTabParent) {
-    mTabParent->OnStartSignedPackageRequest(mChannel, aPackageId);
-  }
-  return NS_OK;
-}
-
-//-----------------------------------------------------------------------------
 // HttpChannelParent::nsIRequestObserver
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
 {
   LOG(("HttpChannelParent::OnStartRequest [this=%p, aRequest=%p]\n",
        this, aRequest));
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -16,17 +16,16 @@
 #include "OfflineObserver.h"
 #include "nsIObserver.h"
 #include "nsIParentRedirectingChannel.h"
 #include "nsIProgressEventSink.h"
 #include "nsHttpChannel.h"
 #include "nsIAuthPromptProvider.h"
 #include "mozilla/dom/ipc/IdType.h"
 #include "nsIDeprecationWarner.h"
-#include "nsIPackagedAppChannelListener.h"
 
 class nsICacheEntry;
 class nsIAssociatedContentSecurity;
 
 #define HTTP_CHANNEL_PARENT_IID \
   { 0x982b2372, 0x7aa5, 0x4e8a, \
       { 0xbd, 0x9f, 0x89, 0x74, 0xd7, 0xf0, 0x58, 0xeb } }
 
@@ -49,26 +48,24 @@ class ChannelEventQueue;
 class HttpChannelParent final : public nsIInterfaceRequestor
                               , public PHttpChannelParent
                               , public nsIParentRedirectingChannel
                               , public nsIProgressEventSink
                               , public ADivertableParentChannel
                               , public nsIAuthPromptProvider
                               , public nsIDeprecationWarner
                               , public DisconnectableParent
-                              , public nsIPackagedAppChannelListener
                               , public HttpChannelSecurityWarningReporter
 {
   virtual ~HttpChannelParent();
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
-  NS_DECL_NSIPACKAGEDAPPCHANNELLISTENER
   NS_DECL_NSIPARENTCHANNEL
   NS_DECL_NSIPARENTREDIRECTINGCHANNEL
   NS_DECL_NSIPROGRESSEVENTSINK
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSIAUTHPROMPTPROVIDER
   NS_DECL_NSIDEPRECATIONWARNER
 
   NS_DECLARE_STATIC_IID_ACCESSOR(HTTP_CHANNEL_PARENT_IID)
--- a/netwerk/protocol/http/HttpChannelParentListener.cpp
+++ b/netwerk/protocol/http/HttpChannelParentListener.cpp
@@ -7,17 +7,16 @@
 // HttpLog.h should generally be included first
 #include "HttpLog.h"
 
 #include "HttpChannelParentListener.h"
 #include "mozilla/net/HttpChannelParent.h"
 #include "mozilla/unused.h"
 #include "nsIRedirectChannelRegistrar.h"
 #include "nsIHttpEventSink.h"
-#include "nsIPackagedAppChannelListener.h"
 #include "nsIHttpHeaderVisitor.h"
 #include "nsQueryObject.h"
 
 using mozilla::Unused;
 
 namespace mozilla {
 namespace net {
 
@@ -40,17 +39,16 @@ HttpChannelParentListener::~HttpChannelP
 
 NS_IMPL_ADDREF(HttpChannelParentListener)
 NS_IMPL_RELEASE(HttpChannelParentListener)
 NS_INTERFACE_MAP_BEGIN(HttpChannelParentListener)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
   NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
-  NS_INTERFACE_MAP_ENTRY(nsIPackagedAppChannelListener)
   NS_INTERFACE_MAP_ENTRY(nsIRedirectResultListener)
   NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInterfaceRequestor)
   if (aIID.Equals(NS_GET_IID(HttpChannelParentListener))) {
     foundInterface = static_cast<nsIInterfaceRequestor*>(this);
   } else
 NS_INTERFACE_MAP_END
 
@@ -107,32 +105,16 @@ HttpChannelParentListener::OnDataAvailab
   if (!mNextListener)
     return NS_ERROR_UNEXPECTED;
 
   LOG(("HttpChannelParentListener::OnDataAvailable [this=%p]\n", this));
   return mNextListener->OnDataAvailable(aRequest, aContext, aInputStream, aOffset, aCount);
 }
 
 //-----------------------------------------------------------------------------
-// HttpChannelParentListener::nsIPackagedAppChannelListener
-//-----------------------------------------------------------------------------
-NS_IMETHODIMP
-HttpChannelParentListener::OnStartSignedPackageRequest(const nsACString& aPackageId)
-{
-  nsCOMPtr<nsIPackagedAppChannelListener> listener = do_QueryInterface(mNextListener);
-  if (listener) {
-    listener->OnStartSignedPackageRequest(aPackageId);
-  } else {
-    NS_WARNING("mNextListener is not nsIPackagedAppChannelListener");
-  }
-
-  return NS_OK;
-}
-
-//-----------------------------------------------------------------------------
 // HttpChannelParentListener::nsIInterfaceRequestor
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelParentListener::GetInterface(const nsIID& aIID, void **result)
 {
   if (aIID.Equals(NS_GET_IID(nsIChannelEventSink)) ||
       aIID.Equals(NS_GET_IID(nsIHttpEventSink))  ||
--- a/netwerk/protocol/http/HttpChannelParentListener.h
+++ b/netwerk/protocol/http/HttpChannelParentListener.h
@@ -6,17 +6,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_net_HttpChannelCallbackWrapper_h
 #define mozilla_net_HttpChannelCallbackWrapper_h
 
 #include "nsIInterfaceRequestor.h"
 #include "nsIChannelEventSink.h"
 #include "nsIRedirectResultListener.h"
-#include "nsIPackagedAppChannelListener.h"
 #include "nsINetworkInterceptController.h"
 #include "nsIStreamListener.h"
 
 namespace mozilla {
 namespace net {
 
 class HttpChannelParent;
 
@@ -26,25 +25,23 @@ class HttpChannelParent;
 
 // Note: nsIInterfaceRequestor must be the first base so that do_QueryObject()
 // works correctly on this object, as it's needed to compute a void* pointing to
 // the beginning of this object.
 
 class HttpChannelParentListener final : public nsIInterfaceRequestor
                                       , public nsIChannelEventSink
                                       , public nsIRedirectResultListener
-                                      , public nsIPackagedAppChannelListener
                                       , public nsIStreamListener
                                       , public nsINetworkInterceptController
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSICHANNELEVENTSINK
-  NS_DECL_NSIPACKAGEDAPPCHANNELLISTENER
   NS_DECL_NSIREDIRECTRESULTLISTENER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSINETWORKINTERCEPTCONTROLLER
 
   NS_DECLARE_STATIC_IID_ACCESSOR(HTTP_CHANNEL_PARENT_LISTENER_IID)
 
   explicit HttpChannelParentListener(HttpChannelParent* aInitialChannel);
--- a/netwerk/protocol/http/PackagedAppService.cpp
+++ b/netwerk/protocol/http/PackagedAppService.cpp
@@ -362,36 +362,16 @@ PackagedAppService::PackagedAppChannelLi
   nsCOMPtr<nsICacheInfoChannel> cacheChan = do_QueryInterface(aRequest);
   if (cacheChan) {
       cacheChan->IsFromCache(&isFromCache);
   }
 
   mDownloader->SetIsFromCache(isFromCache);
   LOG(("[%p] Downloader isFromCache: %d\n", mDownloader.get(), isFromCache));
 
-  // If the package is loaded from cache, check the meta data in the cache
-  // to know if it's a signed package. Notify requesters if it's signed.
-  if (isFromCache) {
-    bool isPackageSigned = false;
-    nsCString signedPackageId;
-    nsCOMPtr<nsICacheEntry> packageCacheEntry = GetPackageCacheEntry(aRequest);
-    if (packageCacheEntry) {
-      const char* key = PackagedAppVerifier::kSignedPakIdMetadataKey;
-      nsXPIDLCString value;
-      nsresult rv = packageCacheEntry->GetMetaDataElement(key,
-                                                          getter_Copies(value));
-      isPackageSigned = (NS_SUCCEEDED(rv) && !value.IsEmpty());
-      signedPackageId = value;
-    }
-    if (isPackageSigned) {
-      LOG(("The cached package is signed. Notify the requesters."));
-      mDownloader->NotifyOnStartSignedPackageRequest(signedPackageId);
-    }
-  }
-
   // XXX: This is the place to suspend the channel, doom existing cache entries
   // for previous resources, and then resume the channel.
   return mListener->OnStartRequest(aRequest, aContext);
 }
 
 NS_IMETHODIMP
 PackagedAppService::PackagedAppChannelListener::OnStopRequest(nsIRequest *aRequest,
                                                     nsISupports *aContext,
@@ -747,45 +727,34 @@ PackagedAppService::PackagedAppDownloade
                                                            uint32_t aCount)
 {
   uint32_t n;
   return aInputStream->ReadSegments(ConsumeData, this, aCount, &n);
 }
 
 nsresult
 PackagedAppService::PackagedAppDownloader::AddCallback(nsIURI *aURI,
-                                                       nsICacheEntryOpenCallback *aCallback,
-                                                       nsIChannel* aRequester)
+                                                       nsICacheEntryOpenCallback *aCallback)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread(), "mCallbacks hashtable is not thread safe");
   nsAutoCString spec;
   aURI->GetSpecIgnoringRef(spec);
 
   LogURI("PackagedAppDownloader::AddCallback", this, aURI);
   LOG(("[%p]    > callback: %p\n", this, aCallback));
 
-  nsCOMPtr<nsIPackagedAppChannelListener> listener = do_QueryInterface(aRequester);
-
   // Check if we already have a resource waiting for this resource
   nsCOMArray<nsICacheEntryOpenCallback>* array = mCallbacks.Get(spec);
   if (array) {
     if (array->Length() == 0) {
       // The download of this resource has already completed, hence we don't
       // need to wait for it to be inserted in the cache and we can serve it
       // right now, directly.  See also the CallCallbacks method bellow.
       LOG(("[%p]    > already downloaded\n", this));
 
-      // This is the case where a package downloader is still running and we
-      // peek data from it.
-      if (mVerifier && mVerifier->GetIsPackageSigned()) {
-        // TODO: Bug 1178526 will deal with the package identifier things.
-        //       For now we just use the origin as the identifier.
-        listener->OnStartSignedPackageRequest(mVerifier->GetPackageIdentifier());
-        listener = nullptr; // So that the request will not be added to the queue.
-      }
       mCacheStorage->AsyncOpenURI(aURI, EmptyCString(),
                                   nsICacheStorage::OPEN_READONLY, aCallback);
     } else {
       LOG(("[%p]    > adding to array\n", this));
       // Add this resource to the callback array
       array->AppendObject(aCallback);
     }
   } else {
@@ -793,21 +762,16 @@ PackagedAppService::PackagedAppDownloade
     // This is the first callback for this URI.
     // Create a new array and add the callback
     nsCOMArray<nsICacheEntryOpenCallback>* newArray =
       new nsCOMArray<nsICacheEntryOpenCallback>();
     newArray->AppendObject(aCallback);
     mCallbacks.Put(spec, newArray);
   }
 
-  // Add the outer channel for notifying OnStartSignedPackageRequest.
-  if (listener) {
-    mRequesters.AppendObject(listener);
-  }
-
   return NS_OK;
 }
 
 nsresult
 PackagedAppService::PackagedAppDownloader::CallCallbacks(nsIURI *aURI,
                                                          nsICacheEntry *aEntry,
                                                          nsresult aResult)
 {
@@ -889,34 +853,16 @@ PackagedAppService::PackagedAppDownloade
 
     // Finally, we remove this entry from the hashtable.
     iter.Remove();
   }
 
   return NS_OK;
 }
 
-void
-PackagedAppService::PackagedAppDownloader::NotifyOnStartSignedPackageRequest(const nsACString& aPackageOrigin)
-{
-  MOZ_RELEASE_ASSERT(NS_IsMainThread(), "mRequesters is not thread safe");
-
-  LOG(("Ready to notify OnStartSignedPackageRequest to all requesters."));
-  // Notify all requesters that a signed package is about to download and let
-  // TabParent to decide if the request needs to be re-made in a new process.
-  for (uint32_t i = 0; i < mRequesters.Length(); i++) {
-    nsCOMPtr<nsIPackagedAppChannelListener> requester = mRequesters.ObjectAt(i);
-    LOG(("Notifying %p OnStartSignedPackageRequest. New origin: %s", requester.get(),
-          nsCString(aPackageOrigin).get()));
-    requester->OnStartSignedPackageRequest(aPackageOrigin);
-  }
-
-  mRequesters.Clear();
-}
-
 static bool
 AddPackageIdToOrigin(nsACString& aOrigin, const nsACString& aPackageId)
 {
   nsAutoCString originNoSuffix;
   mozilla::NeckoOriginAttributes attrs;
   if (!attrs.PopulateFromOrigin(aOrigin, originNoSuffix)) {
     return false;
   }
@@ -1012,37 +958,27 @@ PackagedAppService::PackagedAppDownloade
   bool isPackagedSigned;
   mVerifier->GetIsPackageSigned(&isPackagedSigned);
   if (!isPackagedSigned) {
     // A verified but unsigned manifest means this package has no signature.
     LOG(("No signature in the package. Just run normally."));
     return;
   }
 
-  NotifyOnStartSignedPackageRequest(mVerifier->GetPackageIdentifier());
   InstallSignedPackagedApp(aInfo);
 }
 
 void
 PackagedAppService::PackagedAppDownloader::OnResourceVerified(const ResourceCacheInfo* aInfo,
                                                               bool aSuccess)
 {
   if (!aSuccess) {
     return OnError(ERROR_RESOURCE_VERIFIED_FAILED);
   }
 
-  // If this package is signed and there is any pending requests, we just notify
-  // right now no matter if this is the requested resource. Doing this can
-  // have the potential process switch be done as early as possible.
-  if (mVerifier->GetIsPackageSigned()) {
-    // TODO: Bug 1178526 will deal with the package identifier things.
-    //       For now we just use the origin as the identifier.
-    NotifyOnStartSignedPackageRequest(mVerifier->GetPackageIdentifier());
-  }
-
   // Serve this resource to all listeners.
   CallCallbacks(aInfo->mURI, aInfo->mCacheEntry, aInfo->mStatusCode);
 
   if (aInfo->mIsLastPart) {
     LOG(("This is the last part. FinalizeDownload (%d)", aInfo->mStatusCode));
     FinalizeDownload(aInfo->mStatusCode);
   }
 }
@@ -1163,17 +1099,17 @@ PackagedAppService::GetResource(nsIChann
   }
 
   RefPtr<PackagedAppDownloader> downloader;
   if (mDownloadingPackages.Get(key, getter_AddRefs(downloader))) {
     // We have determined that the file is not in the cache.
     // If we find that the package that the file belongs to is currently being
     // downloaded, we will add the callback to the package's queue, and it will
     // be called once the file is processed and saved in the cache.
-    downloader->AddCallback(uri, aCallback, aChannel);
+    downloader->AddCallback(uri, aCallback);
     return NS_OK;
   }
 
   nsCOMPtr<nsIChannel> channel;
   rv = NS_NewChannelInternal(
     getter_AddRefs(channel), packageURI,
     loadInfo,
     nullptr, nullptr, loadFlags);
@@ -1193,17 +1129,17 @@ PackagedAppService::GetResource(nsIChann
   downloader = new PackagedAppDownloader();
   nsCString packageOrigin;
   principal->GetOrigin(packageOrigin);
   rv = downloader->Init(loadContextInfo, key, packageOrigin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  downloader->AddCallback(uri, aCallback, aChannel);
+  downloader->AddCallback(uri, aCallback);
 
   nsCOMPtr<nsIStreamConverterService> streamconv =
     do_GetService("@mozilla.org/streamConverters;1", &rv);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsCOMPtr<nsIStreamListener> mimeConverter;
--- a/netwerk/protocol/http/PackagedAppService.h
+++ b/netwerk/protocol/http/PackagedAppService.h
@@ -8,17 +8,16 @@
 #define mozilla_net_PackagedAppService_h
 
 #include "nsIPackagedAppService.h"
 #include "nsILoadContextInfo.h"
 #include "nsICacheStorage.h"
 #include "PackagedAppVerifier.h"
 #include "nsIMultiPartChannel.h"
 #include "PackagedAppVerifier.h"
-#include "nsIPackagedAppChannelListener.h"
 #include "nsCOMArray.h"
 #include "nsRefPtrHashtable.h"
 
 namespace mozilla {
 namespace net {
 
 class nsHttpResponseHead;
 
@@ -124,18 +123,17 @@ private:
     // - aKey is a string which uniquely identifies this package within the
     //   packagedAppService
     nsresult Init(nsILoadContextInfo* aInfo, const nsCString &aKey,
                                              const nsACString& aPackageOrigin);
     // Registers a callback which gets called when the given nsIURI is downloaded
     // aURI is the full URI of a subresource, composed of packageURI + !// + subresourcePath
     // aRequester is the outer channel who makes the request for aURI.
     nsresult AddCallback(nsIURI *aURI,
-                         nsICacheEntryOpenCallback *aCallback,
-                         nsIChannel* aRequester);
+                         nsICacheEntryOpenCallback *aCallback);
 
     // Remove the callback from the resource callback list.
     nsresult RemoveCallbacks(nsICacheEntryOpenCallback* aCallback);
 
     // Called by PackagedAppChannelListener to note the fact that the package
     // is coming from the cache, and no subresources are to be expected as only
     // package metadata is saved in the cache.
     void SetIsFromCache(bool aFromCache) { mIsFromCache = aFromCache; }
@@ -210,19 +208,16 @@ private:
     nsCString mPackageKey;
 
     // Whether the package is from the cache
     bool mIsFromCache;
 
     // Deal with verification and delegate callbacks to the downloader.
     RefPtr<PackagedAppVerifier> mVerifier;
 
-    // The outer channels which have issued the request to the downloader.
-    nsCOMArray<nsIPackagedAppChannelListener> mRequesters;
-
     // The package origin without signed package origin identifier.
     // If you need the origin with the signity taken into account, use
     // PackagedAppVerifier::GetPackageOrigin().
     nsCString mPackageOrigin;
 
     //The app id of the package loaded from the LoadContextInfo
     uint32_t mAppId;
 
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -325,17 +325,17 @@ nsHttpChannel::Connect()
                                nsIContentPolicy::TYPE_OTHER;
 
     if (type == nsIContentPolicy::TYPE_DOCUMENT ||
         type == nsIContentPolicy::TYPE_SUBDOCUMENT) {
         rv = SetRequestHeader(NS_LITERAL_CSTRING("Upgrade-Insecure-Requests"),
                               NS_LITERAL_CSTRING("1"), false);
         NS_ENSURE_SUCCESS(rv, rv);
     }
- 
+
     bool isHttps = false;
     rv = mURI->SchemeIs("https", &isHttps);
     NS_ENSURE_SUCCESS(rv,rv);
     nsCOMPtr<nsIPrincipal> resultPrincipal;
     if (!isHttps && mLoadInfo) {
         nsContentUtils::GetSecurityManager()->
           GetChannelResultPrincipal(this, getter_AddRefs(resultPrincipal));
     }
@@ -4979,17 +4979,16 @@ NS_IMETHODIMP nsHttpChannel::OnAuthCance
 NS_IMPL_ADDREF_INHERITED(nsHttpChannel, HttpBaseChannel)
 NS_IMPL_RELEASE_INHERITED(nsHttpChannel, HttpBaseChannel)
 
 NS_INTERFACE_MAP_BEGIN(nsHttpChannel)
     NS_INTERFACE_MAP_ENTRY(nsIRequest)
     NS_INTERFACE_MAP_ENTRY(nsIChannel)
     NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
     NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-    NS_INTERFACE_MAP_ENTRY(nsIPackagedAppChannelListener)
     NS_INTERFACE_MAP_ENTRY(nsIHttpChannel)
     NS_INTERFACE_MAP_ENTRY(nsICacheInfoChannel)
     NS_INTERFACE_MAP_ENTRY(nsICachingChannel)
     NS_INTERFACE_MAP_ENTRY(nsIClassOfService)
     NS_INTERFACE_MAP_ENTRY(nsIUploadChannel)
     NS_INTERFACE_MAP_ENTRY(nsIFormPOSTActionChannel)
     NS_INTERFACE_MAP_ENTRY(nsIUploadChannel2)
     NS_INTERFACE_MAP_ENTRY(nsICacheEntryOpenCallback)
@@ -5821,35 +5820,16 @@ nsHttpChannel::GetLoadGroup(nsILoadGroup
 
 NS_IMETHODIMP
 nsHttpChannel::GetRequestMethod(nsACString& aMethod)
 {
     return HttpBaseChannel::GetRequestMethod(aMethod);
 }
 
 //-----------------------------------------------------------------------------
-// nsHttpChannel::nsIPackagedAppChannelListener
-//-----------------------------------------------------------------------------
-
-NS_IMETHODIMP
-nsHttpChannel::OnStartSignedPackageRequest(const nsACString& aPackageId)
-{
-    nsCOMPtr<nsIPackagedAppChannelListener> listener;
-    NS_QueryNotificationCallbacks(this, listener);
-
-    if (listener) {
-        listener->OnStartSignedPackageRequest(aPackageId);
-    } else {
-        LOG(("nsHttpChannel::OnStartSignedPackageRequest [this=%p], no listener on %p", this, mListener.get()));
-    }
-
-    return NS_OK;
-}
-
-//-----------------------------------------------------------------------------
 // nsHttpChannel::nsIRequestObserver
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpChannel::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
 {
     nsresult rv;
 
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsHttpChannel_h__
 #define nsHttpChannel_h__
 
 #include "HttpBaseChannel.h"
 #include "nsTArray.h"
-#include "nsIPackagedAppChannelListener.h"
 #include "nsICachingChannel.h"
 #include "nsICacheEntry.h"
 #include "nsICacheEntryOpenCallback.h"
 #include "nsIDNSListener.h"
 #include "nsIApplicationCacheChannel.h"
 #include "nsIChannelWithDivertableParentListener.h"
 #include "nsIProtocolProxyCallback.h"
 #include "nsIHttpAuthenticableChannel.h"
@@ -57,17 +56,16 @@ public:
   0x7bb3,                                          \
   0x4ae1,                                          \
   {0xa9, 0x71, 0x40, 0xbc, 0xfa, 0x81, 0xde, 0x12} \
 }
 
 class nsHttpChannel final : public HttpBaseChannel
                           , public HttpAsyncAborter<nsHttpChannel>
                           , public nsIStreamListener
-                          , public nsIPackagedAppChannelListener
                           , public nsICachingChannel
                           , public nsICacheEntryOpenCallback
                           , public nsITransportEventSink
                           , public nsIProtocolProxyCallback
                           , public nsIHttpAuthenticableChannel
                           , public nsIApplicationCacheChannel
                           , public nsIAsyncVerifyRedirectCallback
                           , public nsIThreadRetargetableRequest
@@ -76,17 +74,16 @@ class nsHttpChannel final : public HttpB
                           , public nsSupportsWeakReference
                           , public nsICorsPreflightCallback
                           , public nsIChannelWithDivertableParentListener
 {
 public:
     NS_DECL_ISUPPORTS_INHERITED
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
-    NS_DECL_NSIPACKAGEDAPPCHANNELLISTENER
     NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
     NS_DECL_NSICACHEINFOCHANNEL
     NS_DECL_NSICACHINGCHANNEL
     NS_DECL_NSICACHEENTRYOPENCALLBACK
     NS_DECL_NSITRANSPORTEVENTSINK
     NS_DECL_NSIPROTOCOLPROXYCALLBACK
     NS_DECL_NSIPROXIEDCHANNEL
     NS_DECL_NSIAPPLICATIONCACHECONTAINER
--- a/netwerk/test/mochitests/mochitest.ini
+++ b/netwerk/test/mochitests/mochitest.ini
@@ -3,18 +3,16 @@ skip-if = buildapp == 'b2g'
 
 support-files =
   method.sjs
   partial_content.sjs
   rel_preconnect.sjs
   user_agent.sjs
   user_agent_update.sjs
   web_packaged_app.sjs
-  signed_web_packaged_app.sjs
-  signed_web_packaged_app_random.sjs
   file_loadinfo_redirectchain.sjs
   redirect_idn.html^headers^
   redirect_idn.html
   empty.html
   redirect.sjs
   !/dom/apps/tests/file_app.sjs
 
 [test_arraybufferinputstream.html]
@@ -23,24 +21,14 @@ support-files =
 [test_uri_scheme.html]
 [test_user_agent_overrides.html]
 skip-if = e10s
 [test_user_agent_updates.html]
 skip-if = e10s
 [test_user_agent_updates_reset.html]
 [test_viewsource_unlinkable.html]
 [test_xhr_method_case.html]
-[test_signed_web_packaged_app.html]
-skip-if = e10s || buildapp != 'browser'
-[test_signed_web_packaged_app_origin.html]
-skip-if = e10s || buildapp != 'browser'
-[test_signed_to_signed_web_packaged_app.html]
-skip-if = e10s || buildapp != 'browser' || os != 'linux'
 [test_web_packaged_app.html]
 skip-if = buildapp != 'mulet'
 [test_loadinfo_redirectchain.html]
 skip-if = buildapp == 'b2g' #no ssl support
 [test_idn_redirect.html]
-[test_origin_attributes_conversion.html]
-skip-if = e10s || buildapp != 'browser'
-[test_about_blank_to_signed_web_packaged_app.html]
-skip-if = e10s || buildapp != 'browser'
 [test_redirect_ref.html]
deleted file mode 100644
--- a/netwerk/test/mochitests/signed_web_packaged_app_random.sjs
+++ /dev/null
@@ -1,92 +0,0 @@
-// Same as signed_web_packaged_app.sjs except this one would return a random
-// package-identifer.
-
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
-
-var uuid = Cc["@mozilla.org/uuid-generator;1"].
-             getService(Ci.nsIUUIDGenerator).
-             generateUUID().
-             toString().replace(/[{}]/g, "");
-
-function handleRequest(request, response)
-{
-  response.setHeader("Content-Type", "application/package", false);
-  response.write(signedPackage);
-  return;
-}
-
-// The package content
-// getData formats it as described at http://www.w3.org/TR/web-packaging/#streamable-package-format
-var signedPackage = `manifest-signature: MIIF1AYJKoZIhvcNAQcCoIIFxTCCBcECAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCCA54wggOaMIICgqADAgECAgECMA0GCSqGSIb3DQEBCwUAMHMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEkMCIGA1UEChMbRXhhbXBsZSBUcnVzdGVkIENvcnBvcmF0aW9uMRkwFwYDVQQDExBUcnVzdGVkIFZhbGlkIENBMB4XDTE1MDkxMDA4MDQzNVoXDTM1MDkxMDA4MDQzNVowdDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MSQwIgYDVQQKExtFeGFtcGxlIFRydXN0ZWQgQ29ycG9yYXRpb24xGjAYBgNVBAMTEVRydXN0ZWQgQ29ycCBDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAts8whjOzEbn/w1xkFJ67af7F/JPujBK91oyJekh2schIMzFau9pY8S1AiJQoJCulOJCJfUc8hBLKBZiGAkii+4Gpx6cVqMLe6C22MdD806Soxn8Dg4dQqbIvPuI4eeVKu5CEk80PW/BaFMmRvRHO62C7PILuH6yZeGHC4P7dTKpsk4CLxh/jRGXLC8jV2BCW0X+3BMbHBg53NoI9s1Gs7KGYnfOHbBP5wEFAa00RjHnubUaCdEBlC8Kl4X7p0S4RGb3rsB08wgFe9EmSZHIgcIm+SuVo7N4qqbI85qo2ulU6J8NN7ZtgMPHzrMhzgAgf/KnqPqwDIxnNmRNJmHTUYwIDAQABozgwNjAMBgNVHRMBAf8EAjAAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMDMA4GA1UdDwEB/wQEAwIHgDANBgkqhkiG9w0BAQsFAAOCAQEAukH6cJUUj5faa8CuPCqrEa0PoLY4SYNnff9NI+TTAHkB9l+kOcFl5eo2EQOcWmZKYi7QLlWC4jy/KQYattO9FMaxiOQL4FAc6ZIbNyfwWBzZWyr5syYJTTTnkLq8A9pCKarN49+FqhJseycU+8EhJEJyP5pv5hLvDNTTHOQ6SXhASsiX8cjo3AY4bxA5pWeXuTZ459qDxOnQd+GrOe4dIeqflk0hA2xYKe3SfF+QlK8EO370B8Dj8RX230OATM1E3OtYyALe34KW3wM9Qm9rb0eViDnVyDiCWkhhQnw5yPg/XQfloug2itRYuCnfUoRt8xfeHgwz2Ymz8cUADn3KpTGCAf4wggH6AgEBMHgwczELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MSQwIgYDVQQKExtFeGFtcGxlIFRydXN0ZWQgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFRydXN0ZWQgVmFsaWQgQ0ECAQIwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE1MTAyODExMTIwMlowIwYJKoZIhvcNAQkEMRYEFENKTXRUkdej+EPd/oKRhz0Cp13zMA0GCSqGSIb3DQEBAQUABIIBAFCr+i8cwTiwzzCVjzZZI2NAqu8dnYOAJjkhD02tJjBCbvehEhXW6pP/Gk8+oyx2zoV87zbw9xBGcEU9b3ulbggdFR56S3C3w+eTbeOXMcx7A8mn9vvsoMJm+/rkT4DgEUU1iaM7pdwH48CKJOnAZP5FkjRvpRBh8TgfcDbusXveYTwG5LVpDp8856+9FBzvZ7wLz9iWDvlT/EFxfWOnGduAJunQ9qQm+pWu5cvSTwWasCMYmiPRlsuBhU9Fx7LtlXIHtE2nYYQVMTMDE58z/mzT34W0bnneecrghHREhb90UvdlUZJ2q3Jahsa3718WUGPTp7ZYwYaPBy7ryoOoWSA=\r
---7IYGY9UDJB\r
-Content-Location: manifest.webapp\r
-Content-Type: application/x-web-app-manifest+json\r
-\r
-{
-  "moz-package-origin": "http://mochi.test:8888",
-  "name": "My App",
-  "moz-resources": [
-    {
-      "src": "page2.html",
-      "integrity": "JREF3JbXGvZ+I1KHtoz3f46ZkeIPrvXtG4VyFQrJ7II="
-    },
-    {
-      "src": "index.html",
-      "integrity": "IjQ2S/V9qsC7wW5uv/Niq40M1aivvqH5+1GKRwUnyRg="
-    },
-    {
-      "src": "scripts/script.js",
-      "integrity": "6TqtNArQKrrsXEQWu3D9ZD8xvDRIkhyV6zVdTcmsT5Q="
-    },
-    {
-      "src": "scripts/library.js",
-      "integrity": "TN2ByXZiaBiBCvS4MeZ02UyNi44vED+KjdjLInUl4o8="
-    }
-  ],
-  "moz-permissions": [
-    {
-      "systemXHR": {
-        "description": "Needed to download stuff"
-      },
-      "devicestorage:pictures": {
-        "description": "Need to load pictures"
-      }
-    }
-  ],
-
-`
-  + '  "package-identifier": "' +  uuid + '",\n\r' +
-`
-  "description": "A great app!"
-}\r
---7IYGY9UDJB\r
-Content-Location: page2.html\r
-Content-Type: text/html\r
-\r
-<html>
-  page2.html
-</html>
-\r
---7IYGY9UDJB\r
-Content-Location: index.html\r
-Content-Type: text/html\r
-\r
-<html>
-  Last updated: 2015/10/28
-</html>
-\r
---7IYGY9UDJB\r
-Content-Location: scripts/script.js\r
-Content-Type: text/javascript\r
-\r
-// script.js
-\r
---7IYGY9UDJB\r
-Content-Location: scripts/library.js\r
-Content-Type: text/javascript\r
-\r
-// library.js
-\r
---7IYGY9UDJB--`;
deleted file mode 100644
--- a/netwerk/test/mochitests/test_about_blank_to_signed_web_packaged_app.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title> Web packaged app </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="application/javascript;version=1.7">
-
-var Cc = SpecialPowers.Cc;
-var Ci = SpecialPowers.Ci;
-var Cu = SpecialPowers.Cu;
-var Cr = SpecialPowers.Cr;
-
-SpecialPowers.pushPrefEnv(
-  { "set": [["network.http.enable-packaged-apps", true],
-            ["dom.ipc.processPriorityManager.testMode", true],
-            ["network.http.signed-packages.enabled", true],
-            ["dom.ipc.processPriorityManager.enabled", true],
-            ["dom.ipc.tabs.disabled", false],
-            ["dom.ipc.processCount", 3],
-            ["dom.mozBrowserFramesEnabled", true]] },
-  () => SpecialPowers.pushPermissions([
-    { "type": "browser", "allow": 1, "context": document }
-  ], function() {
-    runTest();
-  }));
-
-SimpleTest.waitForExplicitFinish();
-
-// Ideally we can only create one process to load a signed content
-// when using a brand new remote iframe. However, due to Bug 1239902,
-// there would still be 2 process to be created.
-var kProcessCreatedTopic = "process-priority-manager:TEST-ONLY:process-created";
-var processCreatedCnt = 0;
-SpecialPowers.addObserver(() => {
-  processCreatedCnt++;
-  if (processCreatedCnt == 1) {
-    ok(true, "We have one more process to create.");
-  } else if (processCreatedCnt == 2) {
-    SimpleTest.finish();
-  }
-}, kProcessCreatedTopic, /* weak = */ false);
-
-function runTest() {
-  var iframe = document.createElement("iframe");
-  iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('remote', 'true');
-  iframe.setAttribute("src", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app.sjs!//scripts/app.js");
-
-  document.body.appendChild(iframe);
-}
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/netwerk/test/mochitests/test_origin_attributes_conversion.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title> Bug 1209162 - Test Origin Attributes Conversion </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script class="testbody" type="application/javascript;version=1.7">
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv(
-  { "set": [["network.http.enable-packaged-apps", true],
-            ["network.http.signed-packages.enabled", true],
-            ["network.http.signed-packages.trusted-origin", "http://mochi.test:8888"],
-            ["dom.mozBrowserFramesEnabled", true]] },
-  () => SpecialPowers.pushPermissions([
-    { "type": "browser", "allow": 1, "context": document }
-  ], function() {
-    runTest();
-}));
-
-var Ci = SpecialPowers.Ci;
-
-function runTest() {
-  var iframe = document.createElement("iframe");
-  iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('remote', 'true');
-  iframe.setAttribute("src", "http://example.org:80");
-
-  iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-    iframe.removeEventListener("mozbrowserloadend", loadend);
-    info("Got mozbrowserloadend");
-    iframe.setAttribute("src", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app.sjs!//index.html");
-
-    iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-      iframe.removeEventListener("mozbrowserloadend", loadend);
-      info("Got 2nd mozbrowserloadend");
-
-      // Expected origin attributes for signed package.
-      var expectedSignedOA = {inIsolatedMozBrowser: true,
-                              signedPkg: "09bc9714-7ab6-4320-9d20-fde4c237522c"};
-
-      // Expected origin attributes for network request.
-      var expectedOA = {inIsolatedMozBrowser: true};
-
-      function checkOriginAttributes(attrs, expected) {
-        for (var p in expected) {
-          is(attrs[p], expected[p]);
-        }
-      }
-
-      var mm = SpecialPowers.wrap(iframe)
-                            .QueryInterface(Ci.nsIFrameLoaderOwner)
-                            .frameLoader
-                            .messageManager;
-      mm.addMessageListener("test-document-origin-attributes", function (message) {
-        info("checking origin attributes from document");
-        checkOriginAttributes(message.data.originAttributes, expectedSignedOA);
-      });
-
-      mm.addMessageListener("test-tabchild-origin-attributes", function (message) {
-        info("checking origin attributes from TabChild");
-        checkOriginAttributes(message.data.originAttributes, expectedSignedOA);
-      });
-
-      mm.addMessageListener("test-child-docshell-origin-attributes", function (message) {
-        info("checking origin attributes from inner iframe");
-        checkOriginAttributes(message.data.originAttributes, expectedSignedOA);
-      });
-
-      mm.addMessageListener("test-necko-origin-attributes", function (message) {
-        checkOriginAttributes(message.data.originAttributes, expectedOA);
-
-        SimpleTest.finish();
-      });
-
-      var scriptLoader = mm.QueryInterface(Ci.nsIFrameScriptLoader);
-      getOriginAttributes(scriptLoader, iframe);
-      sendNetworkRequest(scriptLoader, iframe);
-    });
-  });
-
-  document.body.appendChild(iframe);
-}
-
-function getOriginAttributes(scriptLoader, iframe) {
-  var frameScript =
-    `
-    function sendOA() {
-      sendAsyncMessage("test-document-origin-attributes",
-                       {originAttributes: content.document.nodePrincipal.originAttributes});
-
-      var loadContext = content.QueryInterface(Ci.nsIInterfaceRequestor)
-                               .getInterface(Ci.nsIWebNavigation)
-                               .QueryInterface(Ci.nsIDocShell)
-                               .QueryInterface(Ci.nsILoadContext);
-      sendAsyncMessage("test-tabchild-origin-attributes",
-                       {originAttributes: loadContext.originAttributes});
-
-      var frameWindow = content.document.getElementById("innerFrame").contentWindow;
-      var childLoadContext = frameWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                                        .getInterface(Ci.nsIWebNavigation)
-                                        .QueryInterface(Ci.nsIDocShell)
-                                        .QueryInterface(Ci.nsILoadContext);
-      sendAsyncMessage("test-child-docshell-origin-attributes",
-                       {originAttributes: childLoadContext.originAttributes});
-    }
-    `;
-  scriptLoader.loadFrameScript("data:,(" + frameScript + ")()", true);
-}
-
-function sendNetworkRequest(scriptLoader, iframe) {
-  var frameScript =
-    `
-    function sendNetworkerOA() {
-      var myXHR = new content.XMLHttpRequest();
-      myXHR.open("GET", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app.sjs!//page2.html");
-      myXHR.send();
-      myXHR.onload = function() {
-        var loadInfo = myXHR.channel.loadInfo;
-        sendAsyncMessage("test-necko-origin-attributes",
-                         {originAttributes: loadInfo.originAttributes});
-      };
-    }
-    `;
-  scriptLoader.loadFrameScript("data:,(" + frameScript + ")()", true)
-}
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/netwerk/test/mochitests/test_signed_to_signed_web_packaged_app.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title> Web packaged app </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="application/javascript;version=1.7">
-
-var Cc = SpecialPowers.Cc;
-var Ci = SpecialPowers.Ci;
-var Cu = SpecialPowers.Cu;
-var Cr = SpecialPowers.Cr;
-
-SpecialPowers.pushPrefEnv(
-  { "set": [["network.http.enable-packaged-apps", true],
-            ["dom.ipc.processPriorityManager.testMode", true],
-            ["network.http.signed-packages.enabled", true],
-            ["network.http.signed-packages.trusted-origin", "http://mochi.test:8888"],
-            ["dom.ipc.processPriorityManager.enabled", true],
-            ["dom.ipc.tabs.disabled", false],
-            ["dom.ipc.processCount", 30],
-            ["dom.mozBrowserFramesEnabled", true]] },
-  () => SpecialPowers.pushPermissions([
-    { "type": "browser", "allow": 1, "context": document }
-  ], function() {
-    runTest();
-  }));
-
-SimpleTest.waitForExplicitFinish();
-
-// Listen for and count process-created event. There should be 3 processes
-// to be created:
-// 1) The remote tab
-// 2) While navigating to http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app_random.sjs!//scripts/app.js
-// 3) While navigating to http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app_random.sjs!//index.html
-//
-// Note that signed_web_packaged_app_random.sjs will return different package identifier
-// in each request. Therefore, step (3) should trigger process switch.
-var kProcessCreatedTopic = "process-priority-manager:TEST-ONLY:process-created";
-var processCreatedCnt = 0;
-SpecialPowers.addObserver(() => {
-  processCreatedCnt++;
-  if (processCreatedCnt == 3) {
-    SimpleTest.finish();
-  } else {
-    ok(true, "We have " + (3 - processCreatedCnt) + " processes to create.");
-  }
-}, kProcessCreatedTopic, /* weak = */ false);
-
-function runTest() {
-  var iframe = document.createElement("iframe");
-  iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('remote', 'true');
-  iframe.setAttribute("src", "http://example.org:80");
-
-  iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-    iframe.removeEventListener("mozbrowserloadend", loadend);
-    ok(true, "Got mozbrowserloadend 1");
-    iframe.setAttribute("src", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app_random.sjs!//scripts/app.js");
-
-    iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-      iframe.removeEventListener("mozbrowserloadend", loadend);
-      ok(true, "Got mozbrowserloadend 2");
-      iframe.setAttribute("src", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app_random.sjs!//index.html");
-    });
-
-  });
-
-  document.body.appendChild(iframe);
-}
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/netwerk/test/mochitests/test_signed_web_packaged_app.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title> Web packaged app </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="application/javascript;version=1.7">
-
-var Cc = SpecialPowers.Cc;
-var Ci = SpecialPowers.Ci;
-var Cu = SpecialPowers.Cu;
-var Cr = SpecialPowers.Cr;
-
-SpecialPowers.pushPrefEnv(
-  { "set": [["network.http.enable-packaged-apps", true],
-            ["dom.ipc.processPriorityManager.testMode", true],
-            ["network.http.signed-packages.enabled", true],
-            ["dom.ipc.processPriorityManager.enabled", true],
-            ["dom.ipc.tabs.disabled", false],
-            ["dom.ipc.processCount", 3],
-            ["dom.mozBrowserFramesEnabled", true]] },
-  () => SpecialPowers.pushPermissions([
-    { "type": "browser", "allow": 1, "context": document }
-  ], function() {
-    runTest();
-  }));
-
-SimpleTest.waitForExplicitFinish();
-
-// Listen for and count process-created event. Since we are loading a
-// signed content from a remote tab, there shouls be two processes created.
-// One is for remote tab and one for the signed package.
-var kProcessCreatedTopic = "process-priority-manager:TEST-ONLY:process-created";
-var processCreatedCnt = 0;
-SpecialPowers.addObserver(() => {
-  processCreatedCnt++;
-  if (processCreatedCnt == 1) {
-    ok(true, "We have one more process to create.");
-  } else if (processCreatedCnt == 2) {
-    SimpleTest.finish();
-  }
-}, kProcessCreatedTopic, /* weak = */ false);
-
-function runTest() {
-  var iframe = document.createElement("iframe");
-  iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('remote', 'true');
-  iframe.setAttribute("src", "http://example.org:80");
-
-  iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-    iframe.removeEventListener("mozbrowserloadend", loadend);
-    ok(true, "Got mozbrowserloadend");
-    iframe.setAttribute("src", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app.sjs!//scripts/app.js");
-  });
-
-  document.body.appendChild(iframe);
-}
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/netwerk/test/mochitests/test_signed_web_packaged_app_origin.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title> Web packaged app </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="application/javascript;version=1.7">
-
-// The test is mainly to verify whether the packageId is populated
-// to the child side when loading a signed packaged content.
-// Since we have to have chrome priviledge to test if the node principal
-// has the expected origin attributes, we have to load and run a script
-// in content to get the nodePrincipal and send back to the opener
-// to check the origin.
-
-var Cc = SpecialPowers.Cc;
-var Ci = SpecialPowers.Ci;
-var Cu = SpecialPowers.Cu;
-var Cr = SpecialPowers.Cr;
-
-SpecialPowers.pushPrefEnv(
-  { "set": [["network.http.enable-packaged-apps", true],
-            ["network.http.signed-packages.enabled", true],
-            ["dom.mozBrowserFramesEnabled", true]] },
-  () => SpecialPowers.pushPermissions([
-    { "type": "browser", "allow": 1, "context": document }
-  ], function() {
-    runTest();
-  }));
-
-SimpleTest.waitForExplicitFinish();
-
-function runTest() {
-  var iframe = document.createElement("iframe");
-
-  // 1. We open a remote browser and navigate to a regular content first.
-  iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('remote', 'true');
-  iframe.setAttribute("src", "http://example.org:80");
-
-  iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-    iframe.removeEventListener("mozbrowserloadend", loadend);
-    ok(true, "Got mozbrowserloadend");
-
-    // 2. Then we navigate to a signed packaged content.
-    iframe.setAttribute("src", "http://mochi.test:8888/tests/netwerk/test/mochitests/signed_web_packaged_app.sjs!//index.html");
-
-    iframe.addEventListener("mozbrowserloadend", function loadend(e) {
-      iframe.removeEventListener("mozbrowserloadend", loadend);
-
-        // 3. Inject a script with chrome priviledge to content to get the nodePrincipal.
-        //    We communicate via message manager with event 'my-e10s-extension-message'.
-        var mm = SpecialPowers.wrap(iframe)
-                              .QueryInterface(Ci.nsIFrameLoaderOwner)
-                              .frameLoader
-                              .messageManager;
-
-        var fsl = mm.QueryInterface(Ci.nsIFrameScriptLoader);
-
-        mm.addMessageListener("get-node-principal-origin", function(message) {
-          let contentOrigin = message.objects.origin;
-          // The expected signedPkg is defined in 'signed_web_packaged_app.sjs'.
-          let kExpectedOrigin =
-            'http://mochi.test:8888^inBrowser=1&signedPkg=09bc9714-7ab6-4320-9d20-fde4c237522c';
-          is(contentOrigin, kExpectedOrigin, 'content origin check: ' + contentOrigin);
-          SimpleTest.finish();
-        });
-
-        // The script we are going to inject to the content.
-        let frameScript =
-`
-function getNodePrincipalOrigin() {
-  sendAsyncMessage("get-node-principal-origin", {}, { origin: content.document.nodePrincipal.origin });
-}
-`;
-        fsl.loadFrameScript("data:,(" + frameScript + ")()", true);
-    });
-  });
-
-  document.body.appendChild(iframe);
-}
-
-</script>
-</pre>
-</body>
-</html>
--- a/netwerk/test/unit/test_packaged_app_service.js
+++ b/netwerk/test/unit/test_packaged_app_service.js
@@ -214,45 +214,35 @@ function run_test()
   httpserver.registerPathHandler("/badPackage", packagedAppBadContentHandler);
 
   let worsePackageNum = 6;
   for (let i = 0; i < worsePackageNum; i++) {
     httpserver.registerPathHandler("/worsePackage_" + i,
                                    packagedAppWorseContentHandler.bind(null, i));
   }
 
-  httpserver.registerPathHandler("/signedPackage", signedPackagedAppContentHandler);
   httpserver.start(-1);
 
-  do_register_cleanup(function() {
-    gPrefs.clearUserPref("network.http.signed-packages.enabled");
-  });
-
   paservice = Cc["@mozilla.org/network/packaged-app-service;1"]
                      .getService(Ci.nsIPackagedAppService);
   ok(!!paservice, "test service exists");
 
-  gPrefs.setBoolPref("network.http.signed-packages.enabled", true);
-
   add_test(test_bad_args);
 
   add_test(test_callback_gets_called);
   add_test(test_same_content);
   add_test(test_request_number);
   add_test(test_updated_package);
 
   add_test(test_package_does_not_exist);
   add_test(test_file_does_not_exist);
 
   add_test(test_bad_package);
   add_test(test_bad_package_404);
 
-  add_test(test_signed_package_callback);
-  add_test(test_unsigned_package_callback);
-
   // Channels created by addons could have no load info.
   // In debug mode this triggers an assertion, but we still want to test that
   // it works in optimized mode. See bug 1196021 comment 17
   if (Components.classes["@mozilla.org/xpcom/debug;1"]
                 .getService(Components.interfaces.nsIDebug2)
                 .isDebugBuild == false) {
     add_test(test_channel_no_loadinfo);
   }
@@ -574,23 +564,16 @@ function test_worse_package_4() {
 }
 
 function test_worse_package_5() {
   test_worse_package(5, true);
 }
 
 //-----------------------------------------------------------------------------
 
-function signedPackagedAppContentHandler(metadata, response)
-{
-  response.setHeader("Content-Type", 'application/package');
-  var body = signedPackage(uri);
-  response.bodyOutputStream.write(body, body.length);
-}
-
 // Used as a stub when the cache listener is not important.
 var dummyCacheListener = {
   QueryInterface: function (iid) {
     if (iid.equals(Ci.nsICacheEntryOpenCallback) ||
         iid.equals(Ci.nsISupports))
       return this;
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
@@ -604,71 +587,8 @@ function setTrustedOrigin() {
   let origin = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
   origin.data = uri;
   gPrefs.setComplexValue(pref, Ci.nsISupportsString, origin);
 }
 
 function resetTrustedOrigin() {
   gPrefs.clearUserPref("network.http.signed-packages.trusted-origin");
 }
-
-function test_signed_package_callback()
-{
-  setTrustedOrigin();
-
-  packagePath = "/signedPackage";
-  let url = uri + packagePath + "!//index.html";
-  let channel = getChannelForURL(url, {
-    onStartSignedPackageRequest: function(aPackageId) {
-      ok(true, "onStartSignedPackageRequest is notifited as expected");
-      resetTrustedOrigin();
-      run_next_test();
-    },
-
-    getInterface: function (iid) {
-      return this.QueryInterface(iid);
-    },
-
-    QueryInterface: function (iid) {
-      if (iid.equals(Ci.nsISupports) ||
-          iid.equals(Ci.nsIInterfaceRequestor) ||
-          iid.equals(Ci.nsIPackagedAppChannelListener)) {
-        return this;
-      }
-      if (iid.equals(Ci.nsILoadContext)) {
-        return new LoadContextCallback(1024, false, false, false);
-      }
-      throw Cr.NS_ERROR_NO_INTERFACE;
-    },
-  });
-
-  paservice.getResource(channel, dummyCacheListener);
-}
-
-function test_unsigned_package_callback()
-{
-  packagePath = "/package";
-  let url = uri + packagePath + "!//index.html";
-  let channel = getChannelForURL(url, {
-    onStartSignedPackageRequest: function(aPackageId) {
-      ok(false, "Unsigned package shouldn't be called.");
-    },
-
-    getInterface: function (iid) {
-      return this.QueryInterface(iid);
-    },
-
-    QueryInterface: function (iid) {
-      if (iid.equals(Ci.nsISupports) ||
-          iid.equals(Ci.nsIInterfaceRequestor) ||
-          iid.equals(Ci.nsIPackagedAppChannelListener)) {
-        return this;
-      }
-      if (iid.equals(Ci.nsILoadContext)) {
-        return new LoadContextCallback(1024, false, false, false);
-      }
-      throw Cr.NS_ERROR_NO_INTERFACE;
-    },
-  });
-
-  // Pass cacheListener since we rely on 'run_next_test' in it.
-  paservice.getResource(channel, cacheListener);
-}
\ No newline at end of file