Bug 1552168 - Remove Pref data_uri.unique_opaque_origin r=ckerschb

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sebastian Streich 2019-07-03 10:23:29 +00:00
Родитель 099f37af60
Коммит e7a3fe847e
11 изменённых файлов: 5 добавлений и 90 удалений

Просмотреть файл

@ -9989,9 +9989,7 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
true, // aInheritForAboutBlank
isSrcdoc);
bool isURIUniqueOrigin = nsIOService::IsDataURIUniqueOpaqueOrigin() &&
SchemeIsData(aLoadState->URI());
inheritPrincipal = inheritAttrs && !isURIUniqueOrigin;
inheritPrincipal = inheritAttrs && !SchemeIsData(aLoadState->URI());
}
nsLoadFlags loadFlags = mDefaultLoadFlags;

Просмотреть файл

@ -2291,9 +2291,8 @@ nsresult nsObjectLoadingContent::OpenChannel() {
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL;
bool isData;
bool isURIUniqueOrigin = nsIOService::IsDataURIUniqueOpaqueOrigin() &&
NS_SUCCEEDED(mURI->SchemeIs("data", &isData)) &&
isData;
bool isURIUniqueOrigin =
NS_SUCCEEDED(mURI->SchemeIs("data", &isData)) && isData;
if (inherit && !isURIUniqueOrigin) {
securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;

Просмотреть файл

@ -9,7 +9,6 @@
#include "ClientHandle.h"
#include "ClientManagerChild.h"
#include "ClientManagerOpChild.h"
#include "ClientPrefs.h"
#include "ClientSource.h"
#include "mozilla/dom/WorkerHolderToken.h"
#include "mozilla/dom/WorkerPrivate.h"
@ -241,8 +240,6 @@ void ClientManager::Startup() {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
sClientManagerThreadLocalIndexDuplicate = sClientManagerThreadLocalIndex;
#endif
ClientPrefsInit();
}
// static

Просмотреть файл

@ -1,30 +0,0 @@
/* -*- 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

Просмотреть файл

@ -1,19 +0,0 @@
/* -*- 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

Просмотреть файл

@ -6,7 +6,6 @@
#include "ClientValidation.h"
#include "ClientPrefs.h"
#include "mozilla/net/MozURL.h"
namespace mozilla {
@ -109,13 +108,6 @@ bool ClientIsValidCreationURL(const PrincipalInfo& aPrincipalInfo,
return true;
}
// We have some tests that use data: URL windows without an opaque
// origin. This should only happen when a pref is set.
if (!ClientPrefsGetDataURLUniqueOpaqueOrigin() &&
scheme.LowerCaseEqualsLiteral("data")) {
return true;
}
// Otherwise don't support this URL type in the clients sub-system for
// now. This will exclude a variety of internal browser clients, but
// currently we don't need to support those. This function can be
@ -133,10 +125,7 @@ bool ClientIsValidCreationURL(const PrincipalInfo& aPrincipalInfo,
scheme.LowerCaseEqualsLiteral("resource") ||
scheme.LowerCaseEqualsLiteral("blob") ||
scheme.LowerCaseEqualsLiteral("javascript") ||
scheme.LowerCaseEqualsLiteral("view-source") ||
(!ClientPrefsGetDataURLUniqueOpaqueOrigin() &&
scheme.LowerCaseEqualsLiteral("data"));
scheme.LowerCaseEqualsLiteral("view-source");
}
case PrincipalInfo::TNullPrincipalInfo: {
// A wide variety of clients can have a null principal. For example,

Просмотреть файл

@ -40,7 +40,6 @@ UNIFIED_SOURCES += [
'ClientOpenWindowOpChild.cpp',
'ClientOpenWindowOpParent.cpp',
'ClientOpenWindowUtils.cpp',
'ClientPrefs.cpp',
'ClientPrincipalUtils.cpp',
'ClientSource.cpp',
'ClientSourceChild.cpp',

Просмотреть файл

@ -161,9 +161,7 @@ nsresult ChannelFromScriptURL(
rv = uri->SchemeIs("data", &isData);
NS_ENSURE_SUCCESS(rv, rv);
bool isURIUniqueOrigin =
net::nsIOService::IsDataURIUniqueOpaqueOrigin() && isData;
if (inheritAttrs && !isURIUniqueOrigin) {
if (inheritAttrs && !isData) {
secFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
}

Просмотреть файл

@ -5505,12 +5505,6 @@ pref("osfile.reset_worker_delay", 30000);
pref("media.block-autoplay-until-in-foreground", true);
// TODO: Bug 1324406: Treat 'data:' documents as unique, opaque origins
// If true, data: URIs will be treated as unique opaque origins, hence will use
// a NullPrincipal as the security context.
// Otherwise it will inherit the origin from parent node, this is the legacy
// behavior of Firefox.
pref("security.data_uri.unique_opaque_origin", true);
// If true, all toplevel data: URI navigations will be blocked.
// Please note that manually entering a data: URI in the

Просмотреть файл

@ -183,7 +183,6 @@ static const char kProfileDoChange[] = "profile-do-change";
uint32_t nsIOService::gDefaultSegmentSize = 4096;
uint32_t nsIOService::gDefaultSegmentCount = 24;
bool nsIOService::sIsDataURIUniqueOpaqueOrigin = false;
bool nsIOService::sBlockToplevelDataUriNavigations = false;
bool nsIOService::sBlockFTPSubresources = false;
@ -260,8 +259,6 @@ nsresult nsIOService::Init() {
} else
NS_WARNING("failed to get observer service");
Preferences::AddBoolVarCache(&sIsDataURIUniqueOpaqueOrigin,
"security.data_uri.unique_opaque_origin", false);
Preferences::AddBoolVarCache(
&sBlockToplevelDataUriNavigations,
"security.data_uri.block_toplevel_data_uri_navigations", false);
@ -1803,11 +1800,6 @@ nsIOService::SpeculativeAnonymousConnect(nsIURI* aURI, nsIPrincipal* aPrincipal,
return SpeculativeConnectInternal(aURI, aPrincipal, aCallbacks, true);
}
/*static*/
bool nsIOService::IsDataURIUniqueOpaqueOrigin() {
return sIsDataURIUniqueOpaqueOrigin;
}
/*static*/
bool nsIOService::BlockToplevelDataUriNavigations() {
return sBlockToplevelDataUriNavigations;

Просмотреть файл

@ -99,7 +99,6 @@ class nsIOService final : public nsIIOService,
bool IsLinkUp();
static bool IsDataURIUniqueOpaqueOrigin();
static bool BlockToplevelDataUriNavigations();
static bool BlockFTPSubresources();
@ -220,7 +219,6 @@ class nsIOService final : public nsIIOService,
bool mNetworkNotifyChanged;
static bool sIsDataURIUniqueOpaqueOrigin;
static bool sBlockToplevelDataUriNavigations;
static bool sBlockFTPSubresources;