Bug 882186 - Whitelist the neterror url in NeckoParent r=jduell
authorFabrice Desré <fabrice@mozilla.com>
Tue, 24 Sep 2013 14:21:12 -0700
changeset 162333 f5e14b213c0f2a76abe61b1d8c90d93af5b59118
parent 162332 c8bdac9164aec33431f4ccdf7b8fa3d4997c2956
child 162334 cdb0446bdf00979169b26301be87891af0caf25c
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs882186
milestone27.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 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;