Eine aufbereitete Darstellung der Quelle

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

Benutzer

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.3 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