Bug 1548773: Remove support for typemustmatch r=bzbarsky

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Frederik Braun 2019-05-05 14:41:59 +00:00
Родитель cb55df3ae6
Коммит 18a04317f0
14 изменённых файлов: 25 добавлений и 127 удалений

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

@ -1630,23 +1630,16 @@ nsObjectLoadingContent::UpdateObjectParameters() {
//
// In order of preference:
//
// 1) Perform typemustmatch check.
// If check is sucessful use type without further checks.
// If check is unsuccessful set stateInvalid to true
// 2) Use our type hint if it matches a plugin
// 3) If we have eAllowPluginSkipChannel, use the uri file extension if
// 1) Use our type hint if it matches a plugin
// 2) If we have eAllowPluginSkipChannel, use the uri file extension if
// it matches a plugin
// 4) If the channel returns a binary stream type:
// 4a) If we have a type non-null non-document type hint, use that
// 4b) If the uri file extension matches a plugin type, use that
// 5) Use the channel type
// 3) If the channel returns a binary stream type:
// 3a) If we have a type non-null non-document type hint, use that
// 3b) If the uri file extension matches a plugin type, use that
// 4) Use the channel type
bool overrideChannelType = false;
if (thisElement->HasAttr(kNameSpaceID_None, nsGkAtoms::typemustmatch)) {
if (!typeAttr.LowerCaseEqualsASCII(channelType.get())) {
stateInvalid = true;
}
} else if (IsPluginType(typeHint)) {
if (IsPluginType(typeHint)) {
LOG(("OBJLC [%p]: Using plugin type hint in favor of any channel type",
this));
overrideChannelType = true;

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

@ -101,10 +101,6 @@ class HTMLObjectElement final : public nsGenericHTMLFormElement,
void SetType(const nsAString& aValue, ErrorResult& aRv) {
SetHTMLAttr(nsGkAtoms::type, aValue, aRv);
}
bool TypeMustMatch() { return GetBoolAttr(nsGkAtoms::typemustmatch); }
void SetTypeMustMatch(bool aValue, ErrorResult& aRv) {
SetHTMLBoolAttr(nsGkAtoms::typemustmatch, aValue, aRv);
}
void GetName(DOMString& aValue) { GetHTMLAttr(nsGkAtoms::name, aValue); }
void SetName(const nsAString& aValue, ErrorResult& aRv) {
SetHTMLAttr(nsGkAtoms::name, aValue, aRv);

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

@ -50,8 +50,6 @@ skip-if = !crashreporter
[test_bug777098.html]
[test_bug784131.html]
[test_bug813906.html]
[test_bug827160.html]
skip-if = toolkit == 'android' # needs plugin support
[test_bug852315.html]
[test_bug854082.html]
[test_bug863792.html]

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

@ -1,54 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=827160
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 827160</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/SpecialPowers.js"></script>
<script type="application/javascript" src="utils.js"></script>
<script type="application/javascript" src="plugin-utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827160">Mozilla Bug 827160</a>
<script type="application/javascript">
// Make sure the test plugin is not click-to-play
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
</script>
<!-- Should load test plugin application/x-test -->
<object id="shouldLoad" data="data:application/x-test,foo"></object>
<!-- Should load test plugin application/x-test2, ignoring type="" -->
<object id="shouldIgnoreType" type="application/x-test" data="data:application/x-test2,foo"></object>
<!-- Should load nothing, channel type does not match type and typeMustMatch is present -->
<object id="shouldNotLoad" type="application/x-test" data="data:application/x-test2,foo" typemustmatch></object>
<!-- Should not load test plugin application/x-test2, no type field is present -->
<object id="shouldNotLoadMissingType" data="data:application/x-test2,foo" typemustmatch></object>
<!-- Should load, no data field is present -->
<object id="shouldLoadMissingData" type="application/x-test" typemustmatch></object>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
window.addEventListener("load", function() {
const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
is(SpecialPowers.wrap(document.getElementById("shouldLoad")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load without type, failed expected load");
is(SpecialPowers.wrap(document.getElementById("shouldIgnoreType")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with type, failed expected load");
is(SpecialPowers.wrap(document.getElementById("shouldNotLoad")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch, load success even though failure expected");
is(SpecialPowers.wrap(document.getElementById("shouldNotLoadMissingType")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch and with type, load success even though failure expected");
is(SpecialPowers.wrap(document.getElementById("shouldLoadMissingData")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with typemustmatch and without data, failed expected load");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

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

@ -19,8 +19,6 @@ interface HTMLObjectElement : HTMLElement {
attribute DOMString data;
[CEReactions, Pure, SetterThrows]
attribute DOMString type;
[CEReactions, Pure, SetterThrows]
attribute boolean typeMustMatch;
[CEReactions, Pure, SetterThrows]
attribute DOMString name;
[CEReactions, Pure, SetterThrows]

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

@ -1325,7 +1325,6 @@ const boolEls = {
],
keygen: ["autofocus", "disabled"],
menuitem: ["checked", "default", "disabled"],
object: ["typemustmatch"],
ol: ["reversed"],
optgroup: ["disabled"],
option: ["disabled", "selected"],

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

@ -22,7 +22,6 @@ boolean_attributes = {
"img": ["ismap"],
"input": ["autofocus", "checked", "disabled", "formnovalidate", "multiple", "readonly", "required"],
"menuitem": ["checked", "default", "disabled"],
"object": ["typemustmatch"],
"ol": ["reversed"],
"optgroup": ["disabled"],
"option": ["disabled", "selected"],

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

@ -59,7 +59,6 @@ var embeddedElements = {
// Conforming
data: "url",
type: "string",
typeMustMatch: "boolean",
name: "string",
useMap: "string",
width: "string",

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

@ -12,4 +12,22 @@ test(function() {
elm();
});
}, 'object legacycaller should not be supported');
test(() => {
const obj = document.createElement("object");
assert_false("typeMustMatch" in obj);
}, "object's typeMustMatch IDL attribute should not be supported");
async_test(t => {
const obj = document.createElement("object");
t.add_cleanup(() => obj.remove());
obj.setAttribute("data", "/common/blank.html");
obj.setAttribute("type", "text/plain");
obj.setAttribute("typemustmatch", "");
obj.onload = t.step_func_done(() => {
assert_not_equals(obj.contentDocument, null, "/common/blank.html should be loaded");
});
obj.onerror = t.unreached_func();
document.body.appendChild(obj);
}, "object's typemustmatch content attribute should not be supported");
</script>

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

@ -1,41 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: display fallback content</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t1 = async_test("the typemustmatch attribute is specified");
var t2 = async_test("the typemustmatch attribute is not specified");
</script>
<body onload="t1.done(); t2.done()">
<object id="obj"></object>
<div id="log"></div>
<script>
t1.step(function() {
var obj1 = document.createElement("object");
obj1.setAttribute("data", "/images/blue.png");
obj1.setAttribute("type", "text/plain");
obj1.setAttribute("typemustmatch", "");
obj1.onload = t1.step_func(function () {
assert_true("typeMustMatch" in obj1, "typeMustMatch is not supported.");
assert_unreached("The image of the first object should not be loaded.");
});
document.getElementById("obj").appendChild(obj1);
});
t2.step(function () {
var obj2 = document.createElement("object");
obj2.setAttribute("data", "test2.html");
obj2.setAttribute("type", "text/plain");
obj2.onload = t2.step_func( function () {
assert_not_equals(obj2.contentDocument, null, "The test2.html should be loaded.");
});
document.getElementById("obj").appendChild(obj2);
});
</script>
</body>

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

@ -1,4 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: object - fallback</title>
<link rel="author" title="Intel" href="http://www.intel.com">

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

@ -384,7 +384,6 @@ interface HTMLEmbedElement : HTMLElement {
interface HTMLObjectElement : HTMLElement {
[CEReactions] attribute USVString data;
[CEReactions] attribute DOMString type;
[CEReactions] attribute boolean typeMustMatch;
[CEReactions] attribute DOMString name;
[CEReactions] attribute DOMString useMap;
readonly attribute HTMLFormElement? form;

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

@ -57,7 +57,6 @@ def test_normal(session):
("img", ["ismap"]),
("input", ["autofocus", "checked", "disabled", "formnovalidate", "multiple", "readonly", "required"]),
("menuitem", ["checked", "default", "disabled"]),
("object", ["typemustmatch"]),
("ol", ["reversed"]),
("optgroup", ["disabled"]),
("option", ["disabled", "selected"]),

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

@ -1216,7 +1216,6 @@ STATIC_ATOMS = [
Atom("truespeed", "truespeed"),
Atom("tt", "tt"),
Atom("type", "type"),
Atom("typemustmatch", "typemustmatch"),
Atom("u", "u"),
Atom("ul", "ul"),
Atom("unparsedEntityUri", "unparsed-entity-uri"),