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.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | <!-- |
michael@0 | 6 | https://bugzilla.mozilla.org/show_bug.cgi?id=816340 |
michael@0 | 7 | --> |
michael@0 | 8 | <window title="Mozilla Bug 816340" |
michael@0 | 9 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 10 | onload="start();"> |
michael@0 | 11 | <label value="Mozilla Bug 816340"/> |
michael@0 | 12 | <!-- test code goes here --> |
michael@0 | 13 | <script type="application/javascript"><![CDATA[ |
michael@0 | 14 | |
michael@0 | 15 | function ok(val, msg) { |
michael@0 | 16 | opener.wrappedJSObject.ok(val, msg); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | var elems = |
michael@0 | 20 | [ |
michael@0 | 21 | "input", |
michael@0 | 22 | "textarea", |
michael@0 | 23 | "select", |
michael@0 | 24 | "fieldset", |
michael@0 | 25 | "button", |
michael@0 | 26 | ]; |
michael@0 | 27 | |
michael@0 | 28 | var chromeDidGetEvent = false; |
michael@0 | 29 | function chromeListener() { |
michael@0 | 30 | chromeDidGetEvent = true; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function testElement(el, disabled, contentShouldGetEvent) { |
michael@0 | 34 | chromeDidGetEvent = false; |
michael@0 | 35 | var b = document.getElementById("browser"); |
michael@0 | 36 | b.contentDocument.body.innerHTML = null; |
michael@0 | 37 | var e = b.contentDocument.createElement(el); |
michael@0 | 38 | if (disabled) { |
michael@0 | 39 | e.setAttribute("disabled", "true"); |
michael@0 | 40 | } |
michael@0 | 41 | b.contentDocument.body.appendChild(e); |
michael@0 | 42 | var contentDidGetEvent = false; |
michael@0 | 43 | b.contentDocument.body.addEventListener("foo", |
michael@0 | 44 | function() { contentDidGetEvent = true }, true); |
michael@0 | 45 | |
michael@0 | 46 | b.addEventListener("foo", chromeListener, true); |
michael@0 | 47 | e.dispatchEvent(new Event("foo")); |
michael@0 | 48 | b.removeEventListener("foo", chromeListener, true); |
michael@0 | 49 | ok(contentDidGetEvent == contentShouldGetEvent, "content: " + el + (disabled ? " disabled" : "")); |
michael@0 | 50 | ok(chromeDidGetEvent, "chrome: " + el + (disabled ? " disabled" : "")); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | function start() { |
michael@0 | 54 | // Test common element. |
michael@0 | 55 | testElement("div", false, true); |
michael@0 | 56 | testElement("div", true, true); |
michael@0 | 57 | |
michael@0 | 58 | for (var i = 0; i < elems.length; ++i) { |
michael@0 | 59 | testElement(elems[i], false, true); |
michael@0 | 60 | testElement(elems[i], true, false); |
michael@0 | 61 | } |
michael@0 | 62 | ok(true, "done"); |
michael@0 | 63 | opener.setTimeout("done()", 0); |
michael@0 | 64 | window.close(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | ]]></script> |
michael@0 | 68 | |
michael@0 | 69 | <browser id="browser" type="content" src="about:blank"/> |
michael@0 | 70 | </window> |