Bug 1548773: Remove support for typemustmatch r=bzbarsky
authorFrederik Braun <fbraun@mozilla.com>
Sun, 05 May 2019 14:41:59 +0000
changeset 531450 a08af741bd23f9837b6dc6aa74829fbe933568e4
parent 531449 5fe8a5adca365edc23c9664717943696de84461d
child 531451 f59b3336d254c80bf2b315a74fea0cb0fa8e0d47
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1548773
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1548773: Remove support for typemustmatch r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D29803
dom/base/nsObjectLoadingContent.cpp
dom/html/HTMLObjectElement.h
dom/plugins/test/mochitest/mochitest.ini
dom/plugins/test/mochitest/test_bug827160.html
dom/webidl/HTMLObjectElement.webidl
testing/marionette/element.js
testing/marionette/harness/marionette_harness/tests/unit/test_element_state.py
testing/web-platform/tests/html/dom/elements-embedded.js
testing/web-platform/tests/html/semantics/embedded-content/the-object-element/historical.html
testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-fallback.html
testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test2.html
testing/web-platform/tests/interfaces/html.idl
testing/web-platform/tests/webdriver/tests/get_element_attribute/get.py
xpcom/ds/StaticAtoms.py
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -1625,33 +1625,26 @@ nsObjectLoadingContent::UpdateObjectPara
 
     ObjectType typeHint = newMime.IsEmpty()
                               ? eType_Null
                               : GetTypeOfContent(newMime, mSkipFakePlugins);
 
     //
     // 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;
     } else if ((caps & eAllowPluginSkipChannel) &&
                IsPluginEnabledByExtension(newURI, newMime)) {
       LOG(
           ("OBJLC [%p]: Using extension as type hint for "
            "eAllowPluginSkipChannel tag (%s)",
--- a/dom/html/HTMLObjectElement.h
+++ b/dom/html/HTMLObjectElement.h
@@ -96,20 +96,16 @@ class HTMLObjectElement final : public n
   }
   void SetData(const nsAString& aValue, ErrorResult& aRv) {
     SetHTMLAttr(nsGkAtoms::data, aValue, aRv);
   }
   void GetType(DOMString& aValue) { GetHTMLAttr(nsGkAtoms::type, aValue); }
   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);
   }
   void GetUseMap(DOMString& aValue) { GetHTMLAttr(nsGkAtoms::usemap, aValue); }
   void SetUseMap(const nsAString& aValue, ErrorResult& aRv) {
     SetHTMLAttr(nsGkAtoms::usemap, aValue, aRv);
   }
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -45,18 +45,16 @@ skip-if = !crashreporter
 skip-if = !crashreporter
 [test_bug532208.html]
 [test_bug539565-1.html]
 [test_bug539565-2.html]
 [test_bug771202.html]
 [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]
 [test_bug967694.html]
 [test_bug985859.html]
 [test_bug986930.html]
 [test_bug1092842.html]
 skip-if = (verify && (os == 'win')) || (os == "win" && webrender) # win/webrender bug 1296400
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_bug827160.html
+++ /dev/null
@@ -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>
--- a/dom/webidl/HTMLObjectElement.webidl
+++ b/dom/webidl/HTMLObjectElement.webidl
@@ -15,18 +15,16 @@
 // http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
 [HTMLConstructor, NeedResolve]
 interface HTMLObjectElement : HTMLElement {
   [CEReactions, Pure, SetterThrows]
            attribute DOMString data;
   [CEReactions, Pure, SetterThrows]
            attribute DOMString type;
   [CEReactions, Pure, SetterThrows]
-           attribute boolean typeMustMatch;
-  [CEReactions, Pure, SetterThrows]
            attribute DOMString name;
   [CEReactions, Pure, SetterThrows]
            attribute DOMString useMap;
   [Pure]
   readonly attribute HTMLFormElement? form;
   [CEReactions, Pure, SetterThrows]
            attribute DOMString width;
   [CEReactions, Pure, SetterThrows]
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -1320,17 +1320,16 @@ const boolEls = {
     "disabled",
     "formnovalidate",
     "multiple",
     "readonly",
     "required",
   ],
   keygen: ["autofocus", "disabled"],
   menuitem: ["checked", "default", "disabled"],
-  object: ["typemustmatch"],
   ol: ["reversed"],
   optgroup: ["disabled"],
   option: ["disabled", "selected"],
   script: ["async", "defer"],
   select: ["autofocus", "disabled", "multiple", "required"],
   textarea: ["autofocus", "disabled", "readonly", "required"],
   track: ["default"],
   video: ["autoplay", "controls", "loop", "muted"],
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_element_state.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_element_state.py
@@ -17,17 +17,16 @@ boolean_attributes = {
   "details": ["open"],
   "dialog": ["open"],
   "fieldset": ["disabled"],
   "form": ["novalidate"],
   "iframe": ["allowfullscreen"],
   "img": ["ismap"],
   "input": ["autofocus", "checked", "disabled", "formnovalidate", "multiple", "readonly", "required"],
   "menuitem": ["checked", "default", "disabled"],
-  "object": ["typemustmatch"],
   "ol": ["reversed"],
   "optgroup": ["disabled"],
   "option": ["disabled", "selected"],
   "script": ["async", "defer"],
   "select": ["autofocus", "disabled", "multiple", "required"],
   "textarea": ["autofocus", "disabled", "readonly", "required"],
   "track": ["default"],
   "video": ["autoplay", "controls", "loop", "muted"],
--- a/testing/web-platform/tests/html/dom/elements-embedded.js
+++ b/testing/web-platform/tests/html/dom/elements-embedded.js
@@ -54,17 +54,16 @@ var embeddedElements = {
     // Obsolete
     align: "string",
     name: "string"
   },
   object: {
     // Conforming
     data: "url",
     type: "string",
-    typeMustMatch: "boolean",
     name: "string",
     useMap: "string",
     width: "string",
     height: "string",
 
     // Obsolete
     align: "string",
     archive: "string",
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/historical.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/historical.html
@@ -7,9 +7,27 @@
 <script>
 test(function() {
   var elm = document.getElementById('object');
   assert_equals(typeof elm, 'object', 'typeof');
   assert_throws(new TypeError(), 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>
deleted file mode 100644
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-fallback.html
+++ /dev/null
@@ -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>
deleted file mode 100644
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test2.html
+++ /dev/null
@@ -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">
--- a/testing/web-platform/tests/interfaces/html.idl
+++ b/testing/web-platform/tests/interfaces/html.idl
@@ -379,17 +379,16 @@ interface HTMLEmbedElement : HTMLElement
   Document? getSVGDocument();
 };
 
 [Exposed=Window,
  HTMLConstructor]
 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;
   [CEReactions] attribute DOMString width;
   [CEReactions] attribute DOMString height;
   readonly attribute Document? contentDocument;
   readonly attribute WindowProxy? contentWindow;
   Document? getSVGDocument();
--- a/testing/web-platform/tests/webdriver/tests/get_element_attribute/get.py
+++ b/testing/web-platform/tests/webdriver/tests/get_element_attribute/get.py
@@ -52,17 +52,16 @@ def test_normal(session):
     ("details", ["open"]),
     ("dialog", ["open"]),
     ("fieldset", ["disabled"]),
     ("form", ["novalidate"]),
     ("iframe", ["allowfullscreen"]),
     ("img", ["ismap"]),
     ("input", ["autofocus", "checked", "disabled", "formnovalidate", "multiple", "readonly", "required"]),
     ("menuitem", ["checked", "default", "disabled"]),
-    ("object", ["typemustmatch"]),
     ("ol", ["reversed"]),
     ("optgroup", ["disabled"]),
     ("option", ["disabled", "selected"]),
     ("script", ["async", "defer"]),
     ("select", ["autofocus", "disabled", "multiple", "required"]),
     ("textarea", ["autofocus", "disabled", "readonly", "required"]),
     ("track", ["default"]),
     ("video", ["autoplay", "controls", "loop", "muted"])
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -1211,17 +1211,16 @@ STATIC_ATOMS = [
     Atom("treecols", "treecols"),
     Atom("treeitem", "treeitem"),
     Atom("treerow", "treerow"),
     Atom("treeseparator", "treeseparator"),
     Atom("_true", "true"),
     Atom("truespeed", "truespeed"),
     Atom("tt", "tt"),
     Atom("type", "type"),
-    Atom("typemustmatch", "typemustmatch"),
     Atom("u", "u"),
     Atom("ul", "ul"),
     Atom("unparsedEntityUri", "unparsed-entity-uri"),
     Atom("up", "up"),
     Atom("upperFirst", "upper-first"),
     Atom("use", "use"),
     Atom("useAttributeSets", "use-attribute-sets"),
     Atom("usemap", "usemap"),