Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/cacheir/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 955 B image not shown  

Quelle  windowproxy-transplant.js

  Sprache: JAVA
 

// Test GetProp and SetProp on (transplanted) WindowProxy objects.

function test(sameCompartment) {
  let g1 = newGlobal({newCompartment: true});
  g1.evaluate(`
    var x = 10;
    function incX() {
      for (var i = 0; i < 100; i++) {
        x = x + 1// Always g1.
        globalThis.x = globalThis.x + 1// The WindowProxy's current global.
      }
      return x;
    }
  `);

  // g1 is the WindowProxy's active Window so g1.x is incremented 200 times.
  let incX = g1.incX;
  assertEq(incX(), 210);
  assertEq(g1.x, 210);

  let g2 =
    sameCompartment
      ? newGlobal({sameCompartmentAs: g1, transplantWindowProxy: g1})
      : newGlobal({newCompartment: true, transplantWindowProxy: g1});
  assertEq(g1, g2);
  g2.evaluate("var x = 20;");

  // Now g2 is the WindowProxy's active Window so g1.x (for the original g1) and
  // g2.x are each incremented 100 times.
  assertEq(incX(), 310);
  assertEq(g2.x, 120);
}
test(false);
test(true);

Messung V0.5 in Prozent
C=96 H=77 G=86

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© 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.