test_bug1050049.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1050049
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 1050049</title>
  9. <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
  11. <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
  12. <script type="application/javascript">
  13. /** Test for Bug 1050049 **/
  14. SimpleTest.waitForExplicitFinish();
  15. var regularBindingURI = window.location.toString().replace("test_bug1050049.html", "file_bug1050049.xml") + "#regularChromeBinding";
  16. var whitelistedBindingURI = window.location.toString().replace("test_bug1050049.html", "file_bug1050049.xml") + "#whitelistedChromeBinding";
  17. function testApplyBinding(doc, bindingURI, expectBind) {
  18. var d = doc.createElement('div');
  19. doc.body.appendChild(d);
  20. d.style.MozBinding = "url(" + bindingURI + ")";
  21. return new Promise(function(resolve, reject) {
  22. // Wait two ticks of the refresh driver for the binding to be applied.
  23. function onceBindingWouldBeApplied() {
  24. is(!!doc.getAnonymousNodes(d), expectBind, "Binding " + (expectBind ? "should" : "shouldn't") +
  25. " be applied: " + bindingURI + ", " + doc.location);
  26. resolve();
  27. }
  28. window.requestAnimationFrame(function() { window.requestAnimationFrame(onceBindingWouldBeApplied); });
  29. });
  30. }
  31. function go() {
  32. testApplyBinding(document, regularBindingURI, true)
  33. .then(testApplyBinding.bind(null, window[0].document, regularBindingURI, false))
  34. .then(testApplyBinding.bind(null, document, whitelistedBindingURI, true))
  35. .then(testApplyBinding.bind(null, window[0].document, whitelistedBindingURI, true))
  36. .then(SimpleTest.finish.bind(SimpleTest));
  37. }
  38. </script>
  39. </head>
  40. <body>
  41. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1050049">Mozilla Bug 1050049</a>
  42. <p id="display"></p>
  43. <div id="content" style="display: none">
  44. </div>
  45. <pre id="test">
  46. </pre>
  47. <iframe onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
  48. </body>
  49. </html>