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 type="text/css" href="chrome://global/skin"?> |
michael@0 | 3 | <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | https://bugzilla.mozilla.org/show_bug.cgi?id=658909 |
michael@0 | 6 | --> |
michael@0 | 7 | <window title="Mozilla Bug 658909" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 10 | |
michael@0 | 11 | <!-- test results are displayed in the html:body --> |
michael@0 | 12 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 13 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=658909" |
michael@0 | 14 | target="_blank">Mozilla Bug 658909</a> |
michael@0 | 15 | </body> |
michael@0 | 16 | |
michael@0 | 17 | <!-- test code goes here --> |
michael@0 | 18 | <script type="application/javascript"> |
michael@0 | 19 | <![CDATA[ |
michael@0 | 20 | /** Test for call/apply-ing Xray methods.**/ |
michael@0 | 21 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 22 | |
michael@0 | 23 | gLoadCount = 0; |
michael@0 | 24 | function frameLoaded() { |
michael@0 | 25 | if (++gLoadCount == frames.length) |
michael@0 | 26 | go(); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function msg(a, b, testName) { |
michael@0 | 30 | return "(" + a.name + ", " + b.name + "): " + testName; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | var testFunctions = { |
michael@0 | 34 | testDocumentElement: function(a, b, name) { |
michael@0 | 35 | var getter = Object.prototype.__lookupGetter__.call(a.document, 'documentElement'); |
michael@0 | 36 | is(getter.call(b.document), b.document.documentElement, msg(a, b, name)); |
michael@0 | 37 | }, |
michael@0 | 38 | |
michael@0 | 39 | testInvalidCall: function(a, b, name) { |
michael@0 | 40 | var getter = Object.prototype.__lookupGetter__.call(a.document, 'documentElement'); |
michael@0 | 41 | var threw = false; |
michael@0 | 42 | try { getter.call(b.document.body); } catch (e) { threw = true; }; |
michael@0 | 43 | ok(threw, msg(a, b, name)); |
michael@0 | 44 | }, |
michael@0 | 45 | |
michael@0 | 46 | testStatus: function(a, b, name) { |
michael@0 | 47 | var setter = Object.prototype.__lookupSetter__.call(a, 'status'); |
michael@0 | 48 | is(b.status, "", "Empty status"); |
michael@0 | 49 | setter.call(b, "foopy"); |
michael@0 | 50 | is(b.status, "foopy", msg(a, b, name)); |
michael@0 | 51 | b.status = ""; |
michael@0 | 52 | }, |
michael@0 | 53 | |
michael@0 | 54 | testCreateElement: function(a, b, name) { |
michael@0 | 55 | is(a.document.createElement.call(b.document, 'div').ownerDocument, b.document, msg(a, b, name)); |
michael@0 | 56 | }, |
michael@0 | 57 | |
michael@0 | 58 | testWindowName: function(a, b, name) { |
michael@0 | 59 | var getter = Object.prototype.__lookupGetter__.call(a, 'name'); |
michael@0 | 60 | is(getter.call(b), b.name, msg(a, b, name)); |
michael@0 | 61 | }, |
michael@0 | 62 | |
michael@0 | 63 | testCanvas: function(a, b, name) { |
michael@0 | 64 | var canvasA = a.document.createElement('canvas'); |
michael@0 | 65 | var canvasB = b.document.createElement('canvas'); |
michael@0 | 66 | var contextA = canvasA.getContext('2d'); |
michael@0 | 67 | var contextB = canvasB.getContext('2d'); |
michael@0 | 68 | var getter = Object.prototype.__lookupGetter__.call(contextA, 'canvas'); |
michael@0 | 69 | is(getter.call(contextB), canvasB, msg(a, b, name)); |
michael@0 | 70 | } |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | function go() { |
michael@0 | 74 | for (var i = 0; i < frames.length; ++i) |
michael@0 | 75 | frames[i].name = 'frame' + i; |
michael@0 | 76 | for (var i = 0; i < frames.length; ++i) { |
michael@0 | 77 | for (var j = 0; j < frames.length; ++j) { |
michael@0 | 78 | for (var k in testFunctions) |
michael@0 | 79 | testFunctions[k](frames[i], frames[j], k); |
michael@0 | 80 | } |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | SimpleTest.finish(); |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | |
michael@0 | 87 | ]]> |
michael@0 | 88 | </script> |
michael@0 | 89 | <iframe id="frame1" onload="frameLoaded();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" /> |
michael@0 | 90 | <iframe id="frame2" onload="frameLoaded();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" /> |
michael@0 | 91 | <iframe id="frame3" onload="frameLoaded();" type="content" src="http://example.com/tests/js/xpconnect/tests/mochitest/file_empty.html" /> |
michael@0 | 92 | </window> |