Commit 54ef9a89 authored by Kristen Wright's avatar Kristen Wright
Browse files

Bug 1622111 - Convert security.data_uri.unique_opaque_origin to static pref...

Bug 1622111 - Convert security.data_uri.unique_opaque_origin to static pref and remove ClientPrefs. r=njn

Converts security.data_uri.unique_opaque_origin to a static pref. This pref was initialized by the ClientManager in ClientPrefs, so this commit also removes those files. Somehow this pref was getting added in VarCache twice, so it also removes the places where the pref was added in Networking.

Differential Revision: https://phabricator.services.mozilla.com/D67185

--HG--
extra : moz-landing-system : lando
parent 5b8ccb75
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_extensions.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPrefs_security.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/StartupTimeline.h"
@@ -9873,7 +9874,8 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
        true,  // aInheritForAboutBlank
        isSrcdoc);

    bool isURIUniqueOrigin = nsIOService::IsDataURIUniqueOpaqueOrigin() &&
    bool isURIUniqueOrigin =
        StaticPrefs::security_data_uri_unique_opaque_origin() &&
        SchemeIsData(aLoadState->URI());
    inheritPrincipal = inheritAttrs && !isURIUniqueOrigin;
  }
+3 −1
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@
#include "mozilla/net/UrlClassifierFeatureFactory.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_security.h"
#include "nsChannelClassifier.h"
#include "nsFocusManager.h"
#include "ReferrerInfo.h"
@@ -2276,7 +2277,8 @@ nsresult nsObjectLoadingContent::OpenChannel() {
      nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL;

  bool isURIUniqueOrigin =
      nsIOService::IsDataURIUniqueOpaqueOrigin() && mURI->SchemeIs("data");
      StaticPrefs::security_data_uri_unique_opaque_origin() &&
      mURI->SchemeIs("data");

  if (inherit && !isURIUniqueOrigin) {
    securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
+0 −3
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#include "ClientHandle.h"
#include "ClientManagerChild.h"
#include "ClientManagerOpChild.h"
#include "ClientPrefs.h"
#include "ClientSource.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/ipc/BackgroundChild.h"
@@ -248,8 +247,6 @@ void ClientManager::Startup() {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
  sClientManagerThreadLocalIndexDuplicate = sClientManagerThreadLocalIndex;
#endif

  ClientPrefsInit();
}

// static
+0 −30
Original line number Diff line number Diff line
/* -*- 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/. */

#include "ClientPrefs.h"

#include "mozilla/Preferences.h"

namespace mozilla {
namespace dom {

namespace {

bool gDataURLUniqueOpaqueOrigin = false;

}  // anonymous namespace

void ClientPrefsInit() {
  Preferences::AddBoolVarCache(&gDataURLUniqueOpaqueOrigin,
                               "security.data_uri.unique_opaque_origin", false);
}

bool ClientPrefsGetDataURLUniqueOpaqueOrigin() {
  return gDataURLUniqueOpaqueOrigin;
}

}  // namespace dom
}  // namespace mozilla

dom/clients/manager/ClientPrefs.h

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
/* -*- 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/. */
#ifndef _mozilla_dom_ClientPrefs_h
#define _mozilla_dom_ClientPrefs_h

namespace mozilla {
namespace dom {

void ClientPrefsInit();

bool ClientPrefsGetAllowUniqueOpaqueOrigin();

}  // namespace dom
}  // namespace mozilla

#endif  // _mozilla_dom_ClientPrefs_h
Loading