Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/basic/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  basic-fuses.js   Sprache: JAVA

 
// |jit-test| skip-if: !(getBuildConfiguration('debug')||getBuildConfiguration('fuzzing-defined'))

function intact(name) {
  let state = getFuseState();
  if (!(name in state)) {
    throw "No such fuse " + name;
  }
  return state[name].intact
}

function testRealmChange() {
  let g = newGlobal();
  g.evaluate(intact.toString())

  // Get a mutating function which will affect the symbol.iterator fuse.
  let rdel = g.evaluate("function del(o) { delete o.prototype[Symbol.iterator] };del")
  // Fuse is still intact.
  g.evaluate(`assertEq(intact("ArrayPrototypeIteratorFuse"), true)`);

  // setup a new global,
  let g2 = newGlobal();
  g2.evaluate(intact.toString())

  // register the popping function.
  g2.rdel = rdel;

  // Pop the array fuse in the new global.
  g2.evaluate(`rdel(Array)`);

  // The realm of the original array should have a fuse still intact
  g.evaluate(`assertEq(intact("ArrayPrototypeIteratorFuse"), true)`);

  // The realm of the array proto should no longer be intact. Oh dear. This is
  // interesting. We currently ask the cx for the array iterator proto,
  g2.evaluate(`assertEq(intact("ArrayPrototypeIteratorFuse"), false)`);
}

testRealmChange();

function testInNewGlobal(pre, post) {
  g = newGlobal();
  g.evaluate(intact.toString());
  g.evaluate(pre)
  g.evaluate("assertRealmFuseInvariants()");
  g.evaluate(post);
}

testInNewGlobal("delete Array.prototype[Symbol.iterator]", `assertEq(intact("ArrayPrototypeIteratorFuse"), false)`)
testInNewGlobal("([])[Symbol.iterator]().__proto__['return'] = () => 10;", `assertEq(intact("ArrayIteratorPrototypeHasNoReturnProperty"), false)`)
testInNewGlobal("([])[Symbol.iterator]().__proto__.__proto__['return'] = () => 10;", `assertEq(intact("IteratorPrototypeHasNoReturnProperty"), false)`)
testInNewGlobal("Object.prototype['return'] = () => 10;", `assertEq(intact("ObjectPrototypeHasNoReturnProperty"), false)`)
testInNewGlobal(`assertEq(intact("ArrayIteratorPrototypeHasIteratorProto"), true); Object.setPrototypeOf(( ([])[Symbol.iterator]().__proto__ ), {a:10})`, `assertEq(intact("ArrayIteratorPrototypeHasIteratorProto"), false);`);
testInNewGlobal(`assertEq(intact("IteratorPrototypeHasObjectProto"), true); Object.setPrototypeOf( ( ([])[Symbol.iterator]().__proto__.__proto__ ), {a:10})`, `assertEq(intact("IteratorPrototypeHasObjectProto"), false);`);

testInNewGlobal(`assertEq(intact("hasSeenObjectEmulateUndefinedFuse"), true); createIsHTMLDDA()`, `assertEq(intact("hasSeenObjectEmulateUndefinedFuse"), false);`);
// Runtime wide fuse.
assertEq(intact("hasSeenObjectEmulateUndefinedFuse"), false);

Messung V0.5
C=86 H=96 G=90

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ¤

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