Bug 1565965 - Allow unsafe loads in the Layout Debugger. r=bzbarsky a=RyanVM
authorCameron McCormack <cam@mcc.id.au>
Tue, 16 Jul 2019 03:47:56 +0000
changeset 544675 cbf0daa7f713e2d86bb0bb8ea823dbc396bb8aba
parent 544674 d5c1f040691a4b986aa7fa03d9127c34b72c57d9
child 544676 650f8bb0184e7027916abebef499384673dfba9f
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, RyanVM
bugs1565965
milestone69.0
Bug 1565965 - Allow unsafe loads in the Layout Debugger. r=bzbarsky a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D38037
docshell/base/moz.build
docshell/base/nsDocShell.cpp
--- a/docshell/base/moz.build
+++ b/docshell/base/moz.build
@@ -118,8 +118,11 @@ LOCAL_INCLUDES += [
     '/netwerk/protocol/viewsource',
     '/toolkit/components/browser',
     '/toolkit/components/find',
     '/tools/profiler',
 ]
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
+
+if CONFIG['MOZ_LAYOUT_DEBUGGER']:
+    DEFINES['MOZ_LAYOUT_DEBUGGER'] = True
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9613,16 +9613,28 @@ nsresult nsDocShell::InternalLoad(nsDocS
           nsAutoCString requestedPrePath;
           uri->GetPrePath(requestedPrePath);
           // So allow the discovery path to load inside about:addons.
           if (discoveryPrePath.Equals(requestedPrePath)) {
             break;
           }
         }
       }
+#ifdef MOZ_LAYOUT_DEBUGGER
+      // Also allow loads in the layout debugger window.
+      nsCOMPtr<nsIDocShellTreeItem> rootItem;
+      GetRootTreeItem(getter_AddRefs(rootItem));
+      nsCOMPtr<nsIWebNavigation> root = do_QueryInterface(rootItem);
+      nsCOMPtr<nsIURI> rootURL;
+      root->GetCurrentURI(getter_AddRefs(rootURL));
+      if (rootURL && rootURL->GetSpecOrDefault().EqualsLiteral(
+                         "chrome://layoutdebug/content/layoutdebug.xul")) {
+        break;
+      }
+#endif
       // Final exception for some legacy automated tests:
       if (xpc::IsInAutomation() &&
           Preferences::GetBool("security.allow_unsafe_parent_loads", false)) {
         break;
       }
       return NS_ERROR_FAILURE;
     } while (0);
   }