Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 function check(aElementName, aBarred) {
2 let doc = gBrowser.contentDocument;
3 let tooltip = document.getElementById("aHTMLTooltip");
4 let content = doc.getElementById('content');
6 let e = doc.createElement(aElementName);
7 content.appendChild(e);
9 ok(!tooltip.fillInPageTooltip(e),
10 "No tooltip should be shown when the element is valid");
12 e.setCustomValidity('foo');
13 if (aBarred) {
14 ok(!tooltip.fillInPageTooltip(e),
15 "No tooltip should be shown when the element is barred from constraint validation");
16 } else {
17 ok(tooltip.fillInPageTooltip(e),
18 e.tagName + " " +"A tooltip should be shown when the element isn't valid");
19 }
21 e.setAttribute('title', '');
22 ok (!tooltip.fillInPageTooltip(e),
23 "No tooltip should be shown if the title attribute is set");
25 e.removeAttribute('title');
26 content.setAttribute('novalidate', '');
27 ok (!tooltip.fillInPageTooltip(e),
28 "No tooltip should be shown if the novalidate attribute is set on the form owner");
29 content.removeAttribute('novalidate');
31 content.removeChild(e);
32 }
34 function todo_check(aElementName, aBarred) {
35 let doc = gBrowser.contentDocument;
36 let tooltip = document.getElementById("aHTMLTooltip");
37 let content = doc.getElementById('content');
39 let e = doc.createElement(aElementName);
40 content.appendChild(e);
42 let cought = false;
43 try {
44 e.setCustomValidity('foo');
45 } catch (e) {
46 cought = true;
47 }
49 todo(!cought, "setCustomValidity should exist for " + aElementName);
51 content.removeChild(e);
52 }
54 function test () {
55 waitForExplicitFinish();
56 gBrowser.selectedTab = gBrowser.addTab();
57 gBrowser.selectedBrowser.addEventListener("load", function () {
58 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
60 let testData = [
61 /* element name, barred */
62 [ 'input', false ],
63 [ 'textarea', false ],
64 [ 'button', true ],
65 [ 'select', false ],
66 [ 'output', true ],
67 [ 'fieldset', true ],
68 [ 'object', true ],
69 ];
71 for each (let data in testData) {
72 check(data[0], data[1]);
73 }
75 let todo_testData = [
76 [ 'keygen', 'false' ],
77 ];
79 for each(let data in todo_testData) {
80 todo_check(data[0], data[1]);
81 }
83 gBrowser.removeCurrentTab();
84 finish();
85 }, true);
87 content.location =
88 "data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>";
89 }