Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_bug545268.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/events/test/test_bug545268.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=545268
-->

<head>
  <title>Test for Bug 545268</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=545268">Mozilla Bug 545268</a>
<p id="display">
</p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script type="application/javascript">

/**
 * Test for Bug 545268
 * Like the test for bug 493251, but we test that suppressing events in
 * a parent window stops the events from reaching the child window.
 */

  var win;
  var subwin;

  var mouseDown = 0;
  var mouseUp = 0;
  var mouseClick = 0;

  var keyDown = 0;
  var keyPress = 0;
  var keyUp = 0;

  function doTest() {
    var utils = SpecialPowers.getDOMWindowUtils(win);
    var f = win.document.getElementById("f");
    subwin = f.contentWindow;
    subwin.document.getElementsByTagName("input")[0].focus();
    subwin.addEventListener("keydown", function(e) { ++keyDown; }, true);
    subwin.addEventListener("keypress", function(e) { ++keyPress; }, true);
    subwin.addEventListener("keyup", function(e) { ++keyUp; }, true);
    subwin.addEventListener("mousedown", function(e) { ++mouseDown; }, true);
    subwin.addEventListener("mouseup", function(e) { ++mouseUp; }, true);
    subwin.addEventListener("click", function(e) { ++mouseClick; }, true);

    synthesizeKey("a", {}, subwin);
    is(keyDown, 1"Wrong number events (1)");
    is(keyPress, 1"Wrong number events (2)");
    is(keyUp, 1"Wrong number events (3)");

    // Test that suppressing events on the parent window prevents key
    // events in the subdocument window
    utils.suppressEventHandling(true);
    synthesizeKey("a", {}, subwin);
    is(keyDown, 1"Wrong number events (4)");
    is(keyPress, 1"Wrong number events (5)");
    is(keyUp, 1"Wrong number events (6)");
    utils.suppressEventHandling(false);
    is(keyDown, 1"Wrong number events (7)");
    is(keyPress, 1"Wrong number events (8)");
    is(keyUp, 1"Wrong number events (9)");

    setTimeout(continueTest1, 0);
    }

  function continueTest1() {
    var utils = SpecialPowers.getDOMWindowUtils(win);
    subwin.addEventListener("keydown", () => { utils.suppressEventHandling(true); }, {once: true});
    synthesizeKey("a", {}, subwin);
    is(keyDown, 2"Wrong number events (10)");
    is(keyPress, 1"Wrong number events (11)");
    is(keyUp, 1"Wrong number events (12)");
    utils.suppressEventHandling(false);
    setTimeout(continueTest2, 0);
  }

  function continueTest2() {
    var utils = SpecialPowers.getDOMWindowUtils(win);
    is(keyDown, 2"Wrong number events (13)");
    is(keyPress, 2"Wrong number events (14)");
    is(keyUp, 2"Wrong number events (15)");

    synthesizeMouseAtPoint(55, {}, win);
    is(mouseDown, 1"Wrong number events (16)");
    is(mouseUp, 1"Wrong number events (17)");
    is(mouseClick, 1"Wrong number events (18)");

    utils.suppressEventHandling(true);
    synthesizeMouseAtPoint(55, {}, win);
    utils.suppressEventHandling(false);
    is(mouseDown, 1"Wrong number events (19)");
    is(mouseUp, 1"Wrong number events (20)");
    is(mouseClick, 1"Wrong number events (21)");

    setTimeout(continueTest3, 0);
  }

  function continueTest3() {
    var utils = SpecialPowers.getDOMWindowUtils(win);
    synthesizeMouseAtPoint(55, { type: "mousedown" }, win);
    utils.suppressEventHandling(true);
    synthesizeMouseAtPoint(55, { type: "mouseup" }, win);
    utils.suppressEventHandling(false);
    setTimeout(continueTest4, 1000);
  }

  function continueTest4() {
    is(mouseDown, 2"Wrong number events (19)");
    is(mouseUp, 2"Wrong number events (20)");
    is(mouseClick, 2"Wrong number events (21)");
    win.close();
    SimpleTest.finish();
  }


  SimpleTest.waitForExplicitFinish();
  SimpleTest.requestFlakyTimeout("untriaged");
  win = window.open("bug545268.html""" , "");
  win.onload = doTest;

</script>
</pre>
</body>
</html>

Messung V0.5 in Prozent
C=80 H=93 G=86

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002