Bug 1476306 - Moving NullPrincipal/ContentPrincipal/SystemPrincipal under mozilla namespace - part 2 - SystemPrincipal, r=ckerschb
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 17 Jul 2018 21:38:19 +0200
changeset 484760 08d2f7d9a956c8dcccc9336bc3b0e32263987b4c
parent 484759 7ebf84d0611e5c5ee7e7a615c1dfbe1853e042d7
child 484761 cefce9913dfabb66dabf0935dd4116fcd4d654b1
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1476306
milestone63.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 1476306 - Moving NullPrincipal/ContentPrincipal/SystemPrincipal under mozilla namespace - part 2 - SystemPrincipal, r=ckerschb
caps/SystemPrincipal.cpp
caps/SystemPrincipal.h
caps/moz.build
caps/nsScriptSecurityManager.h
js/xpconnect/loader/mozJSSubScriptLoader.cpp
js/xpconnect/src/XPCJSContext.cpp
layout/build/nsLayoutModule.cpp
toolkit/components/extensions/webrequest/ChannelWrapper.cpp
--- a/caps/SystemPrincipal.cpp
+++ b/caps/SystemPrincipal.cpp
@@ -13,16 +13,18 @@
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
 #include "nsString.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIScriptSecurityManager.h"
 #include "pratom.h"
 
+using namespace mozilla;
+
 NS_IMPL_CLASSINFO(SystemPrincipal, nullptr,
                   nsIClassInfo::SINGLETON | nsIClassInfo::MAIN_THREAD_ONLY,
                   NS_SYSTEMPRINCIPAL_CID)
 NS_IMPL_QUERY_INTERFACE_CI(SystemPrincipal,
                            nsIPrincipal,
                            nsISerializable)
 NS_IMPL_CI_INTERFACE_GETTER(SystemPrincipal,
                             nsIPrincipal,
--- a/caps/SystemPrincipal.h
+++ b/caps/SystemPrincipal.h
@@ -1,31 +1,32 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 /* The privileged system principal. */
 
-#ifndef SystemPrincipal_h
-#define SystemPrincipal_h
+#ifndef mozilla_SystemPrincipal_h
+#define mozilla_SystemPrincipal_h
 
 #include "nsIPrincipal.h"
 #include "nsJSPrincipals.h"
 
 #include "mozilla/BasePrincipal.h"
 
 #define NS_SYSTEMPRINCIPAL_CID \
 { 0x4a6212db, 0xaccb, 0x11d3, \
 { 0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb }}
 #define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
 
+namespace mozilla {
 
-class SystemPrincipal final : public mozilla::BasePrincipal
+class SystemPrincipal final : public BasePrincipal
 {
   SystemPrincipal()
     : BasePrincipal(eSystemPrincipal)
   {
   }
 
 public:
   static already_AddRefed<SystemPrincipal> Create();
@@ -58,9 +59,11 @@ protected:
   }
 
   bool MayLoadInternal(nsIURI* aURI) override
   {
     return true;
   }
 };
 
-#endif // SystemPrincipal_h
+} // mozilla namespace
+
+#endif // mozilla_SystemPrincipal_h
--- a/caps/moz.build
+++ b/caps/moz.build
@@ -22,24 +22,24 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'caps'
 
 EXPORTS += [
     'ContentPrincipal.h',
     'nsJSPrincipals.h',
     'nsScriptSecurityManager.h',
-    'SystemPrincipal.h',
 ]
 
 EXPORTS.mozilla = [
     'BasePrincipal.h',
     'NullPrincipal.h',
     'NullPrincipalURI.h',
     'OriginAttributes.h',
+    'SystemPrincipal.h',
 ]
 
 SOURCES += [
     # Compile this separately since nsExceptionHandler.h conflicts
     # with something from NullPrincipal.cpp.
     'BasePrincipal.cpp',
 ]
 
--- a/caps/nsScriptSecurityManager.h
+++ b/caps/nsScriptSecurityManager.h
@@ -16,20 +16,20 @@
 #include "nsStringFwd.h"
 #include "plstr.h"
 #include "js/TypeDecls.h"
 
 #include <stdint.h>
 
 class nsIIOService;
 class nsIStringBundle;
-class SystemPrincipal;
 
 namespace mozilla {
 class OriginAttributes;
+class SystemPrincipal;
 } // namespace mozilla
 
 /////////////////////////////
 // nsScriptSecurityManager //
 /////////////////////////////
 #define NS_SCRIPTSECURITYMANAGER_CID \
 { 0x7ee2a4c0, 0x4b93, 0x17d3, \
 { 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }}
@@ -45,17 +45,17 @@ public:
     NS_DECL_NSISCRIPTSECURITYMANAGER
 
     static nsScriptSecurityManager*
     GetScriptSecurityManager();
 
     // Invoked exactly once, by XPConnect.
     static void InitStatics();
 
-    static already_AddRefed<SystemPrincipal>
+    static already_AddRefed<mozilla::SystemPrincipal>
     SystemPrincipalSingletonConstructor();
 
     /**
      * Utility method for comparing two URIs.  For security purposes, two URIs
      * are equivalent if their schemes, hosts, and ports (if any) match.  This
      * method returns true if aSubjectURI and aObjectURI have the same origin,
      * false otherwise.
      */
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ -11,28 +11,28 @@
 #include "nsIURI.h"
 #include "nsIIOService.h"
 #include "nsIChannel.h"
 #include "nsIInputStream.h"
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "nsIFileURL.h"
 #include "ContentPrincipal.h"
-#include "SystemPrincipal.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "xpcprivate.h" // For xpc::OptionsBase
 #include "js/Wrapper.h"
 
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "mozilla/dom/ScriptLoader.h"
 #include "mozilla/HoldDropJSObjects.h"
 #include "mozilla/ScriptPreloader.h"
+#include "mozilla/SystemPrincipal.h"
 #include "mozilla/scache/StartupCache.h"
 #include "mozilla/scache/StartupCacheUtils.h"
 #include "mozilla/Unused.h"
 #include "nsContentUtils.h"
 #include "nsString.h"
 #include "nsCycleCollectionParticipant.h"
 #include "GeckoProfiler.h"
 
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -43,29 +43,29 @@
 #include "mozilla/dom/ScriptLoader.h"
 #include "mozilla/dom/WindowBinding.h"
 #include "mozilla/extensions/WebExtensionPolicy.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ProcessHangMonitor.h"
 #include "mozilla/Sprintf.h"
+#include "mozilla/SystemPrincipal.h"
 #include "mozilla/ThreadLocal.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "mozilla/Unused.h"
 #include "AccessCheck.h"
 #include "nsGlobalWindow.h"
 #include "nsAboutProtocolUtils.h"
 
 #include "GeckoProfiler.h"
 #include "nsIInputStream.h"
 #include "nsIXULRuntime.h"
 #include "nsJSPrincipals.h"
 #include "ExpandedPrincipal.h"
-#include "SystemPrincipal.h"
 
 #if defined(XP_LINUX) && !defined(ANDROID)
 // For getrlimit and min/max.
 #include <algorithm>
 #include <sys/resource.h>
 #endif
 
 #ifdef XP_WIN
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -96,18 +96,18 @@ using mozilla::dom::AudioChannelAgent;
 // Editor stuff
 #include "nsEditorCID.h"
 #include "mozilla/EditorController.h" //CID
 #include "mozilla/HTMLEditor.h"
 
 #include "nsScriptSecurityManager.h"
 #include "ContentPrincipal.h"
 #include "ExpandedPrincipal.h"
-#include "SystemPrincipal.h"
 #include "mozilla/NullPrincipal.h"
+#include "mozilla/SystemPrincipal.h"
 #include "nsNetCID.h"
 #if defined(MOZ_WIDGET_ANDROID)
 #include "nsHapticFeedback.h"
 #endif
 #include "nsParserUtils.h"
 
 #include "nsHTMLCanvasFrame.h"
 
--- a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
+++ b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChannelWrapper.h"
 
 #include "jsapi.h"
 #include "xpcpublic.h"
 
 #include "mozilla/BasePrincipal.h"
-#include "SystemPrincipal.h"
+#include "mozilla/SystemPrincipal.h"
 
 #include "NSSErrorsService.h"
 #include "nsITransportSecurityInfo.h"
 
 #include "mozilla/AddonManagerWebAPI.h"
 #include "mozilla/ErrorNames.h"
 #include "mozilla/ResultExtensions.h"
 #include "mozilla/Unused.h"