Bug 882186 - Whitelist the neterror url in NeckoParent r=jduell
authorFabrice Desré <fabrice@mozilla.com>
Tue, 24 Sep 2013 14:21:12 -0700
changeset 148386 f5e14b213c0f2a76abe61b1d8c90d93af5b59118
parent 148385 c8bdac9164aec33431f4ccdf7b8fa3d4997c2956
child 148387 cdb0446bdf00979169b26301be87891af0caf25c
push id1164
push userfdesre@mozilla.com
push dateTue, 24 Sep 2013 21:23:26 +0000
treeherderb2g-inbound@f5e14b213c0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs882186
milestone27.0a1
Bug 882186 - Whitelist the neterror url in NeckoParent r=jduell
netwerk/ipc/NeckoParent.cpp
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -392,17 +392,31 @@ NeckoParent::AllocPRemoteOpenFileParent(
     if (!haveValidBrowser) {
       return nullptr;
     }
 
     nsAutoCString requestedPath;
     fileURL->GetPath(requestedPath);
     NS_UnescapeURL(requestedPath);
 
-    if (hasManage) {
+    // Check if we load the whitelisted app uri for the neterror page.
+    bool netErrorWhiteList = false;
+
+    nsCOMPtr<nsIURI> appUri = DeserializeURI(aAppURI);
+    if (appUri) {
+      nsAdoptingString netErrorURI;
+      netErrorURI = Preferences::GetString("b2g.neterror.url");
+      if (netErrorURI) {
+        nsAutoCString spec;
+        appUri->GetSpec(spec);
+        netErrorWhiteList = spec.Equals(NS_ConvertUTF16toUTF8(netErrorURI).get());
+      }
+    }
+
+    if (hasManage || netErrorWhiteList) {
       // webapps-manage permission means allow reading any application.zip file
       // in either the regular webapps directory, or the core apps directory (if
       // we're using one).
       NS_NAMED_LITERAL_CSTRING(appzip, "/application.zip");
       nsAutoCString pathEnd;
       requestedPath.Right(pathEnd, appzip.Length());
       if (!pathEnd.Equals(appzip)) {
         return nullptr;