2020-04-04 20:56:06 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
2021-01-31 01:44:54 +00:00
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
2020-04-04 20:56:06 +00:00
|
|
|
<title>Yomichan Manual Tests</title>
|
2021-01-31 01:44:54 +00:00
|
|
|
<link rel="icon" type="image/gif" href="data:image/gif;base64,R0lGODlhEAAQAKEBAAAAAP///////////yH5BAEKAAIALAAAAAAQABAAAAImFI6Zpt0B4YkS0TCpq07xbmEgcGVRUpLaI46ZG7ppalY0jDCwUAAAOw==">
|
|
|
|
<link rel="stylesheet" href="test-stylesheet.css">
|
2020-04-04 20:56:06 +00:00
|
|
|
<script src="test-document2-script.js"></script>
|
|
|
|
</head>
|
2020-08-22 17:03:35 +00:00
|
|
|
<style id="container-styles">
|
|
|
|
.container {
|
|
|
|
width: 100%;
|
|
|
|
height: 200px;
|
|
|
|
border: 1px solid #d8d8d8;
|
|
|
|
position: relative;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
.container-inner {
|
|
|
|
background-color: #f8f8f8;
|
|
|
|
padding: 0.5em;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
2021-05-23 16:29:54 +00:00
|
|
|
}
|
|
|
|
.danger {
|
|
|
|
color: #c83c28;
|
2020-08-22 17:03:35 +00:00
|
|
|
}
|
|
|
|
</style>
|
2020-04-04 20:56:06 +00:00
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1>Yomichan Manual Tests</h1>
|
2020-05-10 18:09:04 +00:00
|
|
|
<y-description>Manual tests involving fullscreen elements, <iframe>s, and shadow DOMs.</y-description>
|
2020-04-04 20:56:06 +00:00
|
|
|
|
2020-05-10 18:09:04 +00:00
|
|
|
<y-test>
|
|
|
|
<y-description>Standard content.</y-description>
|
2020-08-22 17:03:35 +00:00
|
|
|
<div class="fullscreen-element container"><div class="container-inner">
|
2020-04-04 20:56:06 +00:00
|
|
|
<div>
|
|
|
|
ありがとう
|
|
|
|
</div>
|
|
|
|
<div>
|
2020-05-10 18:09:04 +00:00
|
|
|
<a href="#" class="fullscreen-link">Toggle fullscreen</a>
|
2020-04-04 20:56:06 +00:00
|
|
|
</div>
|
|
|
|
</div></div>
|
2020-05-10 18:09:04 +00:00
|
|
|
</y-test>
|
2020-04-04 20:56:06 +00:00
|
|
|
|
2020-05-10 18:09:04 +00:00
|
|
|
<y-test data-shadow-mode="open">
|
|
|
|
<y-description>Content inside of an open shadow DOM.</y-description>
|
|
|
|
<div class="template-content-container"></div>
|
|
|
|
<template>
|
2021-01-31 01:44:54 +00:00
|
|
|
<link rel="stylesheet" href="test-stylesheet.css">
|
2020-08-22 17:03:35 +00:00
|
|
|
<div class="fullscreen-element container"><div class="container-inner">
|
2020-04-04 20:56:06 +00:00
|
|
|
<div>
|
|
|
|
ありがとう
|
|
|
|
</div>
|
|
|
|
<div>
|
2020-05-10 18:09:04 +00:00
|
|
|
<a href="#" class="fullscreen-link">Toggle fullscreen</a>
|
2020-04-04 20:56:06 +00:00
|
|
|
</div>
|
|
|
|
</div></div>
|
|
|
|
</template>
|
2020-05-10 18:09:04 +00:00
|
|
|
</y-test>
|
2020-04-04 20:56:06 +00:00
|
|
|
|
2020-05-10 18:09:04 +00:00
|
|
|
<y-test data-shadow-mode="closed">
|
|
|
|
<y-description>Content inside of a closed shadow DOM.</y-description>
|
|
|
|
<div class="template-content-container"></div>
|
|
|
|
<template>
|
2021-01-31 01:44:54 +00:00
|
|
|
<link rel="stylesheet" href="test-stylesheet.css">
|
2020-08-22 17:03:35 +00:00
|
|
|
<div class="fullscreen-element container"><div class="container-inner">
|
2020-05-10 18:09:04 +00:00
|
|
|
<div>
|
|
|
|
ありがとう
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<a href="#" class="fullscreen-link">Toggle fullscreen</a>
|
|
|
|
</div>
|
|
|
|
</div></div>
|
|
|
|
</template>
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description><iframe> element.</y-description>
|
2020-08-22 17:03:35 +00:00
|
|
|
<iframe src="test-document2-frame1.html" allowfullscreen="true" class="container"></iframe>
|
2020-05-10 18:09:04 +00:00
|
|
|
</y-test>
|
2020-04-04 20:56:06 +00:00
|
|
|
|
2020-05-10 18:09:04 +00:00
|
|
|
<y-test data-shadow-mode="open">
|
|
|
|
<y-description><iframe> element inside of an open shadow DOM.</y-description>
|
|
|
|
<div class="template-content-container"></div>
|
|
|
|
<template>
|
2020-08-22 17:03:35 +00:00
|
|
|
<iframe src="test-document2-frame1.html" allowfullscreen="true" class="container"></iframe>
|
2020-04-04 20:56:06 +00:00
|
|
|
</template>
|
2020-05-10 18:09:04 +00:00
|
|
|
</y-test>
|
2020-04-04 20:56:06 +00:00
|
|
|
|
2020-05-10 18:09:04 +00:00
|
|
|
<y-test data-shadow-mode="closed">
|
|
|
|
<y-description><iframe> element inside of a closed shadow DOM.</y-description>
|
|
|
|
<div class="template-content-container"></div>
|
|
|
|
<template>
|
2020-08-22 17:03:35 +00:00
|
|
|
<iframe src="test-document2-frame1.html" allowfullscreen="true" class="container"></iframe>
|
2020-04-17 21:33:49 +00:00
|
|
|
</template>
|
2020-05-10 18:09:04 +00:00
|
|
|
</y-test>
|
|
|
|
|
2020-08-25 00:17:10 +00:00
|
|
|
<y-test>
|
|
|
|
<y-description><iframe> element with data URL.</y-description>
|
2021-05-23 14:54:28 +00:00
|
|
|
<iframe id="iframe-with-data-url" src="data:text/html;base64,PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCiAgICA8aGVhZD4NCiAgICAgICAgPG1ldGEgY2hhcnNldD0iVVRGLTgiPg0KICAgICAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLGluaXRpYWwtc2NhbGU9MSI+DQogICAg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W5zLXNlcmlmOw0KICAgIGZvbnQtc2l6ZTogMTRweDsNCiAgICBwYWRkaW5nOiAwOw0KICAgIG1hcmdpbjogMDsNCiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZjhmOGY4Ow0KfQ0KYSwgYTp2aXNpdGVkIHsNCiAgICBjb2xvcjogIzEwODBjMDsNCiAgICB0ZXh0LWRlY29yYXRpb246IHVuZGVybGluZTsNCn0NCi5jb250ZW50IHsNCiAgICBwb3NpdGlvbjogYWJzb2x1dGU7DQogICAgbGVmdDogMDsNCiAgICB0b3A6IDA7DQogICAgcmlnaHQ6IDA7DQogICAgYm90dG9tOiAwOw0KICAgIHBhZGRpbmc6IDAuNWVtOw0KICAgIGJhY2tncm91bmQtY29sb3I6ICNmOGY4Zjg7DQp9DQogICAgICAgIDwvc3R5bGU+DQogICAgPC9oZWFkPg0KPGJvZHk+PGRpdiBjbGFzcz0iY29udGVudCI+DQo8ZGl2Pg0KICAgIOOBguOCiuOBjOOBqOOBhg
|
2020-08-25 00:17:10 +00:00
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description><iframe> element with blob URL.</y-description>
|
|
|
|
<iframe id="iframe-with-blob-url" allowfullscreen="true" class="container"></iframe>
|
|
|
|
</y-test>
|
|
|
|
|
2021-05-23 14:54:28 +00:00
|
|
|
<y-test>
|
|
|
|
<y-description><iframe> element with srcdoc.</y-description>
|
2021-05-23 16:29:54 +00:00
|
|
|
<iframe allowfullscreen="true" class="iframe-with-srcdoc container"></iframe>
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description><iframe> element with srcdoc and <code>sandbox="allow-same-origin allow-scripts"</code>.</y-description>
|
|
|
|
<iframe allowfullscreen="true" class="iframe-with-srcdoc container" sandbox="allow-same-origin allow-scripts"></iframe>
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description>
|
|
|
|
<iframe> element with srcdoc and <code>sandbox="allow-scripts"</code>.<br>
|
|
|
|
<span class="danger">This element is expected to not work.</span>
|
|
|
|
</y-description>
|
|
|
|
<iframe allowfullscreen="true" class="iframe-with-srcdoc container" sandbox="allow-scripts"></iframe>
|
2021-05-23 14:54:28 +00:00
|
|
|
</y-test>
|
|
|
|
|
2020-08-22 17:03:35 +00:00
|
|
|
<y-test>
|
|
|
|
<y-description>SVG <img>.</y-description>
|
2021-01-31 01:44:54 +00:00
|
|
|
<img src="test-document2-frame2.svg" class="container" alt="">
|
2020-08-22 17:03:35 +00:00
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description>SVG <object>.</y-description>
|
|
|
|
<object data="test-document2-frame2.svg" type="image/svg+xml" class="container"></object>
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description>SVG <embed>.</y-description>
|
|
|
|
<embed type="image/svg+xml" src="test-document2-frame2.svg" class="container">
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description>SVG <iframe>.</y-description>
|
|
|
|
<iframe src="test-document2-frame2.svg" allowfullscreen="true" class="container"></iframe>
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
<y-test>
|
|
|
|
<y-description>SVG <svg>.</y-description>
|
2021-01-31 01:44:54 +00:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="container" style="background-color: #f8f8f8;" focusable="false">
|
2020-08-22 17:03:35 +00:00
|
|
|
<text
|
|
|
|
x="7"
|
|
|
|
y="12"
|
|
|
|
style="
|
|
|
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
|
|
font-size: 14px;
|
|
|
|
fill: #000000;
|
|
|
|
dominant-baseline: hanging;"
|
|
|
|
>
|
|
|
|
ありがとう
|
|
|
|
</text>
|
|
|
|
</svg>
|
|
|
|
</y-test>
|
|
|
|
|
|
|
|
|
2020-05-10 18:09:04 +00:00
|
|
|
<script>
|
2020-08-25 00:17:10 +00:00
|
|
|
(() => {
|
|
|
|
function stringToTypedArray(string) {
|
|
|
|
const array = new Uint8Array(string.length);
|
|
|
|
for (let i = 0; i < string.length; ++i) {
|
|
|
|
array[i] = string.charCodeAt(i);
|
|
|
|
}
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
2021-05-23 14:54:28 +00:00
|
|
|
function dataUrlToContent(dataUrl) {
|
|
|
|
const [, type, isBase64, data] = /^data:([^;]*);(base64,)?([\w\W]*)$/.exec(dataUrl);
|
|
|
|
const content = (
|
2020-08-25 00:17:10 +00:00
|
|
|
isBase64 ?
|
|
|
|
new TextDecoder().decode(stringToTypedArray(atob(data))) :
|
|
|
|
data
|
|
|
|
);
|
2021-05-23 14:54:28 +00:00
|
|
|
return {content, type};
|
|
|
|
}
|
|
|
|
|
|
|
|
function dataUrlToBlob(dataUrl) {
|
|
|
|
const {content, type} = dataUrlToContent(dataUrl);
|
|
|
|
return new Blob([content], {type});
|
2020-08-25 00:17:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (const element of document.querySelectorAll('y-test')) {
|
|
|
|
setup(element);
|
|
|
|
}
|
|
|
|
|
|
|
|
const iframeWithDataUrl = document.querySelector('#iframe-with-data-url');
|
|
|
|
const iframeWithBlobUrl = document.querySelector('#iframe-with-blob-url');
|
|
|
|
iframeWithBlobUrl.src = URL.createObjectURL(dataUrlToBlob(iframeWithDataUrl.src));
|
2021-05-23 16:29:54 +00:00
|
|
|
for (const iframeWithSrcdoc of document.querySelectorAll('.iframe-with-srcdoc')) {
|
|
|
|
iframeWithSrcdoc.srcdoc = dataUrlToContent(iframeWithDataUrl.src).content;
|
|
|
|
}
|
2020-08-25 00:17:10 +00:00
|
|
|
})();
|
2020-05-10 18:09:04 +00:00
|
|
|
</script>
|
2020-04-17 21:33:49 +00:00
|
|
|
|
2020-04-04 20:56:06 +00:00
|
|
|
</body>
|
2020-04-17 21:33:49 +00:00
|
|
|
</html>
|