Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/tests/mochitest/bugs/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_errorReporting.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/tests/mochitest/bugs/test_errorReporting.html


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

<head>
  <meta charset="utf-8">
  <title>Test for Bug 1070842</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">

  /** Test for error reporting behavior. **/
  SimpleTest.waitForExplicitFinish();

  function testErrorReportingHelper(f, rgxp, preventDefault) {
    return new Promise(function(resolve, reject) {
      window.addEventListener('error', function(e) {
        ok(rgxp.test(e.message), "Should get message matching " + rgxp + ". Got: " + e.message);
        var expectedMessages;
        if (preventDefault) {
          e.preventDefault();
          expectedMessages = [];
        } else {
          expectedMessages = [{message: rgxp}];
        }
        SimpleTest.monitorConsole(resolve, expectedMessages, /* forbidUnexpectedMsgs = */ true);
        setTimeout(SimpleTest.endMonitorConsole.bind(SimpleTest), 0);
      }, {once: true});

      // Notify the test harness to avoid treating the next exception as a test failure.
      SimpleTest.expectUncaughtException();

      // Invoke the function async so that the exception doesn't get eaten by
      // the Promise machinery.
      setTimeout(f, 0);
    });
  }
  function testErrorReporting(f, rgxp) {
    return new Promise(function(resolve, reject) {
        testErrorReportingHelper.bind(null, f, rgxp, false)().then(
        testErrorReportingHelper.bind(null, f, rgxp, true)).then(
        resolve);
    });
  }

  function go() {
    var otherWin = $('emptyFrame').contentWindow;
    var clickMe = $('clickMe');
    testErrorReporting.bind(null, () => { throw Error("Simple Error") }, /Simple Error/)().then(
    testErrorReporting.bind(null, () => otherWin.eval('throw Error("Cross Global Error")'), /Cross Global Error/)).then(
    testErrorReporting.bind(null, () => clickMe.dispatchEvent(new MouseEvent('click')), /thrwan/)).then(
    testErrorReporting.bind(null, () => { clickMe.setAttribute('onclick'' '); /* Make sure we recompile. */
                                          clickMe.setAttribute('onclick''?');
                                          clickMe.onclick; }, /SyntaxError/)).then(
    SimpleTest.finish.bind(SimpleTest));
  }

  </script>
</head>
<body onload="go();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1070842">Mozilla Bug 1070842</a>
<p id="display"></p>
<div id="content" style="display: none">
<button id="clickMe" onclick="thrwan.error;">Click Me</button>
<iframe id="emptyFrame"></iframe>

</div>
<pre id="test">
</pre>
</body>
</html>

Messung V0.5
C=87 H=88 G=87

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.