addLoadEvent(function() {
// blob:// URLs inherit their origin, so the window inside blobFrame
// should be same-orgin with us except for the PDF viewer messing with
// origins.
const printFunc = blobFrame.contentWindow.print;
is(typeof printFunc, "function", "Should have a 'print' function");
ok(Object.getOwnPropertyNames(blobFrame.contentWindow).includes("print"), "Should see 'print' property in property names");
try {
// data: URLs get nonce origins, so the window inside dataFrame is not
// same-origin with us in any way.
dataFrame.contentWindow.print;
ok(false, "Should throw on cross-origin .print access");
} catch (e) {
ok(/Permission denied/.test(e.message), "Should have a security error");
}
ok(!Object.getOwnPropertyNames(dataFrame.contentWindow).includes("print"), "Should not see 'print' property in property names");
try {
printFunc.call(dataFrame.contentWindow);
ok(false, "Should throw on cross-origin call");
} catch (e) {
ok(/Permission to call/.test(e.message), "Should have a security error for call");
}
// It'd be nice to test that calling the function works right, but if it
// does it'll put up the print dialog, which is not helpful in an
// automated test.
SimpleTest.finish();
});
</script>
</div>
<pre id="test"></pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.25 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.