layout/generic/test/test_bug469774.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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" type="text/css"?>
michael@0 4 <!--
michael@0 5 https://bugzilla.mozilla.org/show_bug.cgi?id=469774
michael@0 6 -->
michael@0 7 <window title="Mozilla Bug 469774"
michael@0 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 9
michael@0 10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
michael@0 11 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
michael@0 12
michael@0 13 <vbox height="50"/>
michael@0 14
michael@0 15 <menupopup id="popup">
michael@0 16 <textbox id="textbox"/>
michael@0 17 </menupopup>
michael@0 18
michael@0 19 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 20 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469774">Mozilla Bug 469774</a>
michael@0 21
michael@0 22 <p id="display"></p>
michael@0 23 <div id="content" style="display: none">
michael@0 24 </div>
michael@0 25 </body>
michael@0 26
michael@0 27 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
michael@0 28
michael@0 29 /** Test for Bug 469774 **/
michael@0 30
michael@0 31 // Test whether menu popups are blocked from being painted in their parent window.
michael@0 32
michael@0 33 // Like snapshotWindow, but with DRAWWINDOW_DRAW_CARET
michael@0 34 function snapShot() {
michael@0 35 var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
michael@0 36 canvas.setAttribute("width", 200);
michael@0 37 canvas.setAttribute("height", 50);
michael@0 38 var ctx = canvas.getContext("2d");
michael@0 39 ctx.drawWindow(window, 0, 0, 200, 50, "transparent", ctx.DRAWWINDOW_DRAW_CARET);
michael@0 40 return canvas;
michael@0 41 }
michael@0 42
michael@0 43 function doTest() {
michael@0 44 window.removeEventListener("focus", doTest, false);
michael@0 45
michael@0 46 var before = snapShot();
michael@0 47
michael@0 48 var popup = document.getElementById("popup");
michael@0 49 popup.openPopup(null, "after_start", 0, 0, false, false);
michael@0 50
michael@0 51 popup.addEventListener("popupshown", function() {
michael@0 52 var textbox = document.getElementById("textbox");
michael@0 53 textbox.focus(); // show caret
michael@0 54
michael@0 55 var after = snapShot();
michael@0 56
michael@0 57 var equal, str1, str2;
michael@0 58 [equal, str1, str2] = compareSnapshots(after, before, true);
michael@0 59 ok(equal, "Showing a popup shouldn't affect drawing in its parent window",
michael@0 60 "got " + str1 + " but expected " + str2);
michael@0 61
michael@0 62 popup.hidePopup();
michael@0 63 SimpleTest.finish();
michael@0 64 }, false);
michael@0 65 }
michael@0 66
michael@0 67 SimpleTest.waitForExplicitFinish();
michael@0 68 window.addEventListener("focus", doTest, false);
michael@0 69
michael@0 70 ]]></script>
michael@0 71
michael@0 72 </window>

mercurial