Truly independent web browser
<!doctype html>
<script src="../include.js"></script>
<script>
asyncTest(done => {
const iframe = document.createElement("iframe");
iframe.onload = () => {
const otherWindow = iframe.contentWindow;
const regexp = new otherWindow.RegExp("(.*)");
regexp.exec = RegExp.prototype.exec;
const result = regexp[Symbol.replace]("SECRET", "X");
println(`result: ${result}`);
println(`foreign capture: ${otherWindow.RegExp.$1 || "empty"}`);
done();
};
iframe.srcdoc = "<!DOCTYPE html>";
document.body.appendChild(iframe);
});
</script>