Bug 1318303 - Mochitest for object node data attribute removal; a=TEST-ONLY
☠☠ backed out by e9ddc15cef26 ☠ ☠
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 04 Jan 2017 12:34:32 -0800
changeset 375365 3985fbac8369e2a2632a053e544b3b0adad3fc74
parent 375364 563468e72885ab31fbb3ece5efa338ad98a4f7cb
child 375366 229a81285dff03edd8945add36a0813e5c82b187
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTEST-ONLY
bugs1318303
milestone53.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 1318303 - Mochitest for object node data attribute removal; a=TEST-ONLY MozReview-Commit-ID: 8yP5c0s6Zwx
dom/base/test/mochitest.ini
dom/base/test/test_bug1318303.html
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -590,16 +590,17 @@ skip-if = toolkit == 'android'
 [test_bug1263696.html]
 [test_bug1268962.html]
 [test_bug1274806.html]
 [test_bug1281963.html]
 [test_bug1295852.html]
 [test_bug1307730.html]
 [test_bug1308069.html]
 [test_bug1314032.html]
+[test_bug1318303.html]
 [test_caretPositionFromPoint.html]
 [test_change_policy.html]
 [test_classList.html]
 [test_clearTimeoutIntervalNoArg.html]
 [test_constructor-assignment.html]
 [test_constructor.html]
 [test_copyimage.html]
 subsuite = clipboard
new file mode 100644
--- /dev/null
+++ b/dom/base/test/test_bug1318303.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+  <!--
+       https://bugzilla.mozilla.org/show_bug.cgi?id=1318303
+     -->
+  <head>
+    <meta charset="utf-8">
+    <title>Test for Bug 1318303</title>
+    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+    <script>
+     var _createIterator = function (root) {
+       return document.createNodeIterator.call(root.ownerDocument || root,
+                                               root,
+                                               NodeFilter.SHOW_ELEMENT
+                                             | NodeFilter.SHOW_COMMENT
+                                             | NodeFilter.SHOW_TEXT,
+                                               function () {
+                                                 return NodeFilter.FILTER_ACCEPT;
+                                               },
+                                               false
+       );
+     };
+
+     evil = "<body><object data=''><p></p></object></body>";
+     doc = new DOMParser().parseFromString(evil, 'text/html');
+     body = doc.getElementsByTagName("body")[0];
+     nodeIterator = _createIterator(body);
+     try {
+       while ((currentNode = nodeIterator.nextNode())) {
+         currentNode.removeAttribute("data");
+       }
+       ok(true, "Removing data attributes did not throw error");
+     } catch(err) {
+       ok(false, "Removing data attribute threw error!");
+     }
+     obj = doc.getElementsByTagName("object")[0];
+     const objLC = SpecialPowers.Ci.nsIObjectLoadingContent;
+
+     obj instanceof objLC;
+     obj = SpecialPowers.wrap(obj);
+
+     ok(obj.pluginFallbackType == objLC.PLUGIN_ALTERNATE,
+        "expected alternate fallback mode");
+
+    </script>
+  </head>
+</html>
+