Bug 1309067 - adding asserts to ensure boolean and OA private browsing values match. r=ehsan
authorDave Huseby <dhuseby@mozilla.com>
Thu, 17 Nov 2016 12:14:00 +0100
changeset 323283 c21850fc2d088bd25b4cf1719075ba04af69f21c
parent 323282 671f0ae143a2678d3ec2a4218e2cfafc9424de44
child 323284 f438bfb22339793b15dc1a63140dbbb85a998e5f
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersehsan
bugs1309067
milestone53.0a1
Bug 1309067 - adding asserts to ensure boolean and OA private browsing values match. r=ehsan
docshell/base/LoadContext.h
dom/indexedDB/IDBFactory.cpp
--- a/docshell/base/LoadContext.h
+++ b/docshell/base/LoadContext.h
@@ -80,16 +80,17 @@ public:
     , mNestedFrameId(0)
     , mIsContent(aIsContent)
     , mUseRemoteTabs(aUseRemoteTabs)
     , mOriginAttributes(aAttrs)
 #ifdef DEBUG
     , mIsNotNull(true)
 #endif
   {
+    MOZ_DIAGNOSTIC_ASSERT(aUsePrivateBrowsing == (aAttrs.mPrivateBrowsingId > 0));
   }
 
   // Constructor taking reserved origin attributes.
   explicit LoadContext(DocShellOriginAttributes& aAttrs)
     : mTopFrameElement(nullptr)
     , mNestedFrameId(0)
     , mIsContent(false)
     , mUseRemoteTabs(false)
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.cpp
@@ -603,16 +603,17 @@ IDBFactory::OpenInternal(JSContext* aCx,
 
   PrincipalInfo& principalInfo = commonParams.principalInfo();
 
   if (aPrincipal) {
     if (!NS_IsMainThread()) {
       MOZ_CRASH("Figure out security checks for workers!");
     }
     MOZ_ASSERT(nsContentUtils::IsCallerChrome());
+    MOZ_DIAGNOSTIC_ASSERT(mPrivateBrowsingMode == (aPrincipal->GetPrivateBrowsingId() > 0));
 
     if (NS_WARN_IF(NS_FAILED(PrincipalToPrincipalInfo(aPrincipal,
                                                       &principalInfo)))) {
       IDB_REPORT_INTERNAL_ERR();
       aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
       return nullptr;
     }