test_bug1217571.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1217571
  5. -->
  6. <head>
  7. <title>Test for Bug 1217571</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  10. </head>
  11. <body>
  12. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1217571">Mozilla Bug 1217571</a>
  13. <p id="display"></p>
  14. <iframe src="bug1217571-iframe.html"></iframe>
  15. <iframe src="bug1217571-iframe.html"></iframe>
  16. <pre id="test">
  17. <script type="application/javascript">
  18. /** Test for Bug 614392**/
  19. SimpleTest.waitForExplicitFinish();
  20. window.onload = function() {
  21. // Each iframe loads the same image. Both images should share the same
  22. // container from the image cache. Check that this holds true.
  23. var iframes = document.getElementsByTagName("iframe");
  24. var imgs = Array.from(iframes, function (f) {
  25. return SpecialPowers.wrap(f.contentDocument.getElementsByTagName("img")[0]);
  26. });
  27. var containers = imgs.map(function (img) {
  28. return img.QueryInterface(SpecialPowers.Ci.nsIImageLoadingContent)
  29. .getRequest(SpecialPowers.Ci.nsIImageLoadingContent.CURRENT_REQUEST)
  30. .image;
  31. });
  32. ok(SpecialPowers.compare(containers[0], containers[1]),
  33. "containers for identical images in different iframes should be identical");
  34. SimpleTest.finish();
  35. }
  36. </script>
  37. </pre>
  38. </body>
  39. </html>