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
Родитель 40de2c94b3
Коммит 97be7de9ad
6 изменённых файлов: 36 добавлений и 99 удалений

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

@ -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,21 +458,14 @@
// ////////////////////////////////////////////////////////////////////////
// HTML:embed
if (syntheticBrowsingContexts) {
obj = {
INTERNAL_FRAME: [ {
DOCUMENT: [ {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
} ],
obj = {
INTERNAL_FRAME: [ {
DOCUMENT: [ {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
} ],
};
} else {
obj = {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
};
}
} ],
};
testElm("embed_png", obj);
obj = {
@ -1151,21 +1142,14 @@
// ////////////////////////////////////////////////////////////////////////
// HTML:object and HTML:param
if (syntheticBrowsingContexts) {
obj = {
INTERNAL_FRAME: [ {
DOCUMENT: [ {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
} ],
obj = {
INTERNAL_FRAME: [ {
DOCUMENT: [ {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
} ],
};
} else {
obj = {
role: ROLE_GRAPHIC,
interfaces: [ nsIAccessibleImage ],
};
}
} ],
};
testElm("object_png", obj);
obj = {

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

@ -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);
///

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

@ -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");
}
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");
}
ok(SpecialPowers.wrap(embed).frameLoader, "should have frameloader");
ok(SpecialPowers.wrap(embed).browsingContext, "should have bc");
});
</script>
</body>

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

@ -3,11 +3,6 @@
"use strict";
const syntheticBrowsingContexts = SpecialPowers.getBoolPref(
"browser.opaqueResponseBlocking.syntheticBrowsingContext",
false
);
const DIRPATH = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",
""
@ -92,26 +87,22 @@ 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);
});
add_task(async function test_embedImageDocument() {
await runTest(embed, TABURL, IMAGEURL, CROSSIMAGEURL, checkImage);
});
add_task(async function test_objectImageDocument() {
await runTest(object, TABURL, IMAGEURL, CROSSIMAGEURL, checkImage);
});
}
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);
});
add_task(async function test_embedDocument() {
await runTest(embed, TABURL, DOCUMENTURL, CROSSDOCUMENTURL, checkDocument);
});
add_task(async function test_objectDocument() {
await runTest(object, TABURL, DOCUMENTURL, CROSSDOCUMENTURL, checkDocument);
});
}
add_task(async function test_objectDocument() {
await runTest(object, TABURL, DOCUMENTURL, CROSSDOCUMENTURL, checkDocument);
});

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

@ -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

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

@ -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