Bug 1377355 - Unable to load unpacked web extensions in about:debugging; content script cannot be loaded; r?jimm draft
authorHaik Aftandilian <haftandilian@mozilla.com>
Fri, 30 Jun 2017 12:36:00 -0700
changeset 602812 df61a85d5c86ad01a5588c70bc3794ae710dfa2f
parent 602670 d536973fe668c6c6046fc3fda82e24f3379e3713
child 635724 fd0dfcc45c74dff37b2b542412b35a77ad27eab6
push id66562
push userhaftandilian@mozilla.com
push dateFri, 30 Jun 2017 19:47:33 +0000
reviewersjimm
bugs1377355
milestone56.0a1
Bug 1377355 - Unable to load unpacked web extensions in about:debugging; content script cannot be loaded; r?jimm Remove the system principal check for unpacked (development) moz-extension loads and rely on the existing host, scheme, and filesystem checks. MozReview-Commit-ID: 7aI6dJsRJtP
netwerk/protocol/res/ExtensionProtocolHandler.cpp
--- a/netwerk/protocol/res/ExtensionProtocolHandler.cpp
+++ b/netwerk/protocol/res/ExtensionProtocolHandler.cpp
@@ -14,17 +14,16 @@
 #include "mozilla/ipc/URIParams.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/RefPtr.h"
 
 #include "FileDescriptor.h"
 #include "FileDescriptorFile.h"
 #include "LoadInfo.h"
-#include "nsContentUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIFile.h"
 #include "nsIFileChannel.h"
 #include "nsIFileStreams.h"
 #include "nsIFileURL.h"
 #include "nsIJARChannel.h"
 #include "nsIURL.h"
 #include "nsIChannel.h"
@@ -553,22 +552,16 @@ ExtensionProtocolHandler::NewStream(nsIU
     return Err(NS_ERROR_FILE_NOT_DIRECTORY);
   }
 
   /*
    * Now get a channel for the resolved child URI and make sure the
    * channel is a file channel.
    */
 
-  nsCOMPtr<nsIPrincipal> childPrincipal;
-  NS_TRY(aChildLoadInfo->GetLoadingPrincipal(getter_AddRefs(childPrincipal)));
-  if (nsContentUtils::IsSystemPrincipal(childPrincipal)) {
-    return Err(NS_ERROR_FILE_ACCESS_DENIED);
-  }
-
   nsCOMPtr<nsIChannel> channel;
   NS_TRY(NS_NewChannelInternal(getter_AddRefs(channel),
                                aChildURI,
                                aChildLoadInfo));
 
   // Channel should be a file channel. It should never be a JAR
   // channel because we only request remote streams for unpacked
   // extension resource loads where the URI resolves to a file.