Bug 1875466 - Remove browser.opaqueResponseBlocking.syntheticBrowsingContext pref. r=emilio

Depends on D199115

Differential Revision: https://phabricator.services.mozilla.com/D199116
This commit is contained in:
Tom Schuster
2024-01-22 14:26:11 +00:00
parent f20ecbedcd
commit 549a8ff507
6 changed files with 36 additions and 99 deletions

View File

@@ -23,8 +23,6 @@
src="../name.js"></script>
<script type="application/javascript">
const syntheticBrowsingContexts = SpecialPowers.getBoolPref("browser.opaqueResponseBlocking.syntheticBrowsingContext", false);
async function doTest() {
// ////////////////////////////////////////////////////////////////////////
// HTML:a@href
@@ -460,7 +458,6 @@
// ////////////////////////////////////////////////////////////////////////
// HTML:embed
if (syntheticBrowsingContexts) {
obj = {
INTERNAL_FRAME: [ {
DOCUMENT: [ {
@@ -469,12 +466,6 @@
} ],
} ],
};
} else {
obj = {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
};
}
testElm("embed_png", obj);
obj = {
@@ -1151,7 +1142,6 @@
// ////////////////////////////////////////////////////////////////////////
// HTML:object and HTML:param
if (syntheticBrowsingContexts) {
obj = {
INTERNAL_FRAME: [ {
DOCUMENT: [ {
@@ -1160,12 +1150,6 @@
} ],
} ],
};
} else {
obj = {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
};
}
testElm("object_png", obj);
obj = {

View File

@@ -1070,9 +1070,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
overrideChannelType = true;
} else if (binaryChannelType && typeHint != eType_Null) {
if (typeHint == eType_Document) {
if (StaticPrefs::
browser_opaqueResponseBlocking_syntheticBrowsingContext_AtStartup() &&
imgLoader::SupportImageWithMimeType(newMime)) {
if (imgLoader::SupportImageWithMimeType(newMime)) {
LOG(
("OBJLC [%p]: Using type hint in favor of binary channel type "
"(Image Document)",
@@ -1154,8 +1152,6 @@ nsObjectLoadingContent::UpdateObjectParameters() {
mLoadingSyntheticDocument =
newType == eType_Document &&
StaticPrefs::
browser_opaqueResponseBlocking_syntheticBrowsingContext_AtStartup() &&
imgLoader::SupportImageWithMimeType(newMime);
///

View File

@@ -6,19 +6,10 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script>
// Get the path of the current test, without hostname or filename.
const testPath = window.location.href.replace("http://mochi.test:8888", "");
const testDir = testPath.substring(0, testPath.lastIndexOf('/') + 1);
const embedHasBrowsingContext = SpecialPowers.getBoolPref("browser.opaqueResponseBlocking.syntheticBrowsingContext", false);
const imageTypeORB = embedHasBrowsingContext
? SpecialPowers.Ci.nsIObjectLoadingContent.TYPE_DOCUMENT
: SpecialPowers.Ci.nsIObjectLoadingContent.TYPE_IMAGE;
const imageTypeStringORB = embedHasBrowsingContext ? "document" : "image";
add_task(async function() {
// FIXME: Remove when bug 1658342 is fixed
@@ -35,17 +26,12 @@ add_task(async function() {
await new Promise(resolve => embed.addEventListener("load", resolve, { once: true }));
is(
SpecialPowers.wrap(embed).displayedType,
imageTypeORB,
`image load should have ${imageTypeStringORB} type`
SpecialPowers.Ci.nsIObjectLoadingContent.TYPE_DOCUMENT,
`image load should have document type`
);
if (!embedHasBrowsingContext) {
ok(!SpecialPowers.wrap(embed).frameLoader, "should not have frameloader");
ok(!SpecialPowers.wrap(embed).browsingContext, "should not have bc");
} else {
ok(SpecialPowers.wrap(embed).frameLoader, "should have frameloader");
ok(SpecialPowers.wrap(embed).browsingContext, "should have bc");
}
info("x-site document load from element");
embed.setAttribute("src", "http://example.com" + testDir + "file_empty.html");
@@ -86,17 +72,12 @@ add_task(async function() {
await new Promise(resolve => embed.addEventListener("load", resolve, { once: true }));
is(
SpecialPowers.wrap(embed).displayedType,
imageTypeORB,
`image load should have ${imageTypeStringORB} type`
SpecialPowers.Ci.nsIObjectLoadingContent.TYPE_DOCUMENT,
`image load should have document type`
);
if (!embedHasBrowsingContext) {
ok(!SpecialPowers.wrap(embed).frameLoader, "should not have frameloader");
ok(!SpecialPowers.wrap(embed).browsingContext, "should not have bc");
} else {
ok(SpecialPowers.wrap(embed).frameLoader, "should have frameloader");
ok(SpecialPowers.wrap(embed).browsingContext, "should have bc");
}
});
</script>
</body>

View File

@@ -3,11 +3,6 @@
"use strict";
const syntheticBrowsingContexts = SpecialPowers.getBoolPref(
"browser.opaqueResponseBlocking.syntheticBrowsingContext",
false
);
const DIRPATH = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",
""
@@ -92,7 +87,6 @@ add_task(async function test_iframeImageDocument() {
await runTest(iframe, TABURL, IMAGEURL, CROSSIMAGEURL, checkImage);
});
if (syntheticBrowsingContexts) {
add_task(async function test_embedImageDocument() {
await runTest(embed, TABURL, IMAGEURL, CROSSIMAGEURL, checkImage);
});
@@ -100,13 +94,11 @@ if (syntheticBrowsingContexts) {
add_task(async function test_objectImageDocument() {
await runTest(object, TABURL, IMAGEURL, CROSSIMAGEURL, checkImage);
});
}
add_task(async function test_iframeDocument() {
await runTest(iframe, TABURL, DOCUMENTURL, CROSSDOCUMENTURL, checkDocument);
});
if (syntheticBrowsingContexts) {
add_task(async function test_embedDocument() {
await runTest(embed, TABURL, DOCUMENTURL, CROSSDOCUMENTURL, checkDocument);
});
@@ -114,4 +106,3 @@ if (syntheticBrowsingContexts) {
add_task(async function test_objectDocument() {
await runTest(object, TABURL, DOCUMENTURL, CROSSDOCUMENTURL, checkDocument);
});
}

View File

@@ -3646,14 +3646,6 @@ nsCSSFrameConstructor::FindInputData(const Element& aElement,
ArrayLength(sInputData));
}
static nsIFrame* NS_NewSubDocumentOrImageFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return StaticPrefs::
browser_opaqueResponseBlocking_syntheticBrowsingContext_AtStartup()
? NS_NewSubDocumentFrame(aPresShell, aStyle)
: NS_NewImageFrame(aPresShell, aStyle);
}
/* static */
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindObjectData(const Element& aElement,
@@ -3684,7 +3676,7 @@ nsCSSFrameConstructor::FindObjectData(const Element& aElement,
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_FALLBACK,
ToCreationFunc(NS_NewBlockFrame)),
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_IMAGE,
NS_NewSubDocumentOrImageFrame),
NS_NewSubDocumentFrame),
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_DOCUMENT,
NS_NewSubDocumentFrame),
// Fake plugin handlers load as documents

View File

@@ -1761,13 +1761,6 @@
mirror: always
do_not_use_directly: true
# When this pref is enabled, <object> and <embed> elements will create
# synthetic documents when the resource type they're loading is an image.
- name: browser.opaqueResponseBlocking.syntheticBrowsingContext
type: bool
value: true
mirror: once
# When true, zooming will be enabled on all sites, even ones that declare
# user-scalable=no.
- name: browser.ui.zoom.force-user-scalable