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

Quelle  test_private_field_xrays.js   Sprache: JAVA

 
'use strict';

add_task(async function () {
  let webnav = Services.appShell.createWindowlessBrowser(false);

  let docShell = webnav.docShell;

  docShell.createAboutBlankDocumentViewer(nullnull);

  let window = webnav.document.defaultView;

  let iframe = window.eval(`
    iframe = document.createElement("iframe");
    iframe.id = "iframe"
    document.body.appendChild(iframe)
    iframe`);


  let unwrapped = Cu.waiveXrays(iframe);


  class Base {
    constructor(o) {
      return o;
    }
  };


  class A extends Base {
    #x = 12;
    static gx(o) {
      return o.#x;
    }

    static sx(o, v) {
      o.#x = v;
    }
  };

  new A(iframe);
  Assert.equal(A.gx(iframe), 12);
  A.sx(iframe, 'wrapped');

  // Shouldn't tunnel past xray.
  Assert.throws(() => A.gx(unwrapped), TypeError);
  Assert.throws(() => A.sx(unwrapped, 'unwrapped'), TypeError);

  new A(unwrapped);
  Assert.equal(A.gx(unwrapped), 12);
  Assert.equal(A.gx(iframe), 'wrapped');

  A.sx(iframe, 'modified');
  Assert.equal(A.gx(unwrapped), 12);
  A.sx(unwrapped, 16);
  Assert.equal(A.gx(iframe), 'modified');
});

Messung V0.5
C=95 H=89 G=91

¤ Dauer der Verarbeitung: 0.4 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.