// Test that SavedFrame.prototype.parent gives the next older frame whose // principals are subsumed by the caller's principals.
// Given a string of letters |expected|, say "abc", assert that the stack // contains calls to a series of functions named by the next letter from // the string, say a, b, and then c. Younger frames appear earlier in // |expected| than older frames. function check(expected, stack) {
print("check(" + JSON.stringify(expected) + ") against:\n" + stack);
count++;
if (expected.length > 0) { thrownew Error("Missing frames for: " + expected);
} if (stack.length > 0 && !stack.every(s => s === null)) { thrownew Error("Unexpected extra frame(s):\n" + stack);
}
}
// Go from a SavedFrame linked list to an array of function display names. function extract(stack) { const results = []; while (stack) {
results.push(stack.functionDisplayName);
stack = stack.parent;
} return results;
}
// Make everyone's functions visible to each other, as needed.
b = low .b;
low .c = mid .c;
mid .d = high.d;
high.e = e;
f = low .f;
low .g = mid .g;
mid .h = high.h;
low.check = mid.check = high.check = check;
// They each must have their own extract so that CCWs don't mess up the // principals when we ask for the parent property.
low. eval("" + extract);
mid. eval("" + extract);
high.eval("" + extract);
// Kick the whole process off.
a();
assertEq(count, 8);
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
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.