Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for getUserData/setUserData support in XBL</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 7 | |
michael@0 | 8 | <style type="text/css"> |
michael@0 | 9 | #t { |
michael@0 | 10 | -moz-binding: url(#xbl); |
michael@0 | 11 | } |
michael@0 | 12 | </style> |
michael@0 | 13 | |
michael@0 | 14 | <bindings xmlns="http://www.mozilla.org/xbl"> |
michael@0 | 15 | <binding id="xbl" inheritstyle="false"> |
michael@0 | 16 | <implementation><constructor><![CDATA[ |
michael@0 | 17 | this.textContent = !!(this.getUserData && this.setUserData); |
michael@0 | 18 | ]]></constructor></implementation> |
michael@0 | 19 | </binding> |
michael@0 | 20 | </bindings> |
michael@0 | 21 | |
michael@0 | 22 | </head> |
michael@0 | 23 | <body> |
michael@0 | 24 | <p id="display"></p> |
michael@0 | 25 | |
michael@0 | 26 | <pre id="test"> |
michael@0 | 27 | <script class="testbody"> |
michael@0 | 28 | <![CDATA[ |
michael@0 | 29 | "use strict"; |
michael@0 | 30 | |
michael@0 | 31 | var url = 'data:text/html;charset=utf-8,' + |
michael@0 | 32 | encodeURIComponent('<div id=t style="-moz-binding:url(' + location + '#xbl)"></div>'); |
michael@0 | 33 | |
michael@0 | 34 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 35 | addLoadEvent(test1); |
michael@0 | 36 | |
michael@0 | 37 | function test1() { |
michael@0 | 38 | var iframe = document.createElement('iframe'); |
michael@0 | 39 | iframe.src = url; |
michael@0 | 40 | iframe.onload = function() { |
michael@0 | 41 | var t = iframe.contentWindow.t; |
michael@0 | 42 | is(!!(t.getUserData || t.setUserData), false, |
michael@0 | 43 | "getUserData and setUserData should not be visible from the regular content"); |
michael@0 | 44 | is(t.textContent, "true", |
michael@0 | 45 | "getUserData and setUserData should be visible from XBL"); |
michael@0 | 46 | document.body.removeChild(iframe); |
michael@0 | 47 | SimpleTest.finish(); |
michael@0 | 48 | }; |
michael@0 | 49 | document.body.appendChild(iframe); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | ]]> |
michael@0 | 53 | </script> |
michael@0 | 54 | </pre> |
michael@0 | 55 | </body> |
michael@0 | 56 | </html> |