mirror of
https://github.com/servo/servo.git
synced 2025-10-16 08:20:22 +01:00
39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<script>
|
|
'use strict'
|
|
|
|
// Sends two messages to its creator:
|
|
// (1) The result of chooseFileSystemEntries().
|
|
// (2) The result of getOriginPrivateDirectory().
|
|
|
|
function post_message(data) {
|
|
if (window.parent !== null) {
|
|
window.parent.postMessage(data, { targetOrigin: '*' });
|
|
}
|
|
if (window.opener !== null) {
|
|
window.opener.postMessage(data, { targetOrigin: '*' });
|
|
}
|
|
}
|
|
|
|
try {
|
|
window.chooseFileSystemEntries({ type: 'open-directory' })
|
|
.then(() => {
|
|
post_message('chooseFileSystemEntries(): FULFILLED');
|
|
}).catch(error => {
|
|
post_message(`chooseFileSystemEntries(): REJECTED: ${error.name}`);
|
|
});
|
|
} catch (error) {
|
|
post_message(`chooseFileSystemEntries(): EXCEPTION: ${error.name}`);
|
|
}
|
|
|
|
try {
|
|
window.getOriginPrivateDirectory()
|
|
.then(() => {
|
|
post_message('getOriginPrivateDirectory(): FULFILLED');
|
|
}).catch(error => {
|
|
post_message(`getOriginPrivateDirectory(): REJECTED: ${error.name}`);
|
|
});
|
|
} catch (error) {
|
|
post_message(`getOriginPrivateDirectory(): EXCEPTION: ${error.name}`);
|
|
}
|
|
</script>
|