mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Update web-platform-tests to revision ee82278e15570e573d87fb80179ff8231b6db61a
This commit is contained in:
parent
d23bc4f1a4
commit
83e2dc11b0
278 changed files with 13348 additions and 10515 deletions
|
@ -137,21 +137,25 @@ promise_test(t => {
|
|||
promise_test(() => {
|
||||
return new Promise((resolve,reject) => {
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.srcdoc = '<script>' +
|
||||
' window.onmessage = message => {' +
|
||||
' if (message.data === "Ready") {' +
|
||||
' let onSuccess = () => { parent.postMessage("Failure", "*"); };' +
|
||||
' let onError = error => {' +
|
||||
' if (error.name == "SecurityError") {' +
|
||||
' parent.postMessage("Success", "*");' +
|
||||
' } else {' +
|
||||
' parent.postMessage("Failure", "*");' +
|
||||
' }' +
|
||||
' };' +
|
||||
' navigator.nfc.push("Test").then(onSuccess, onError);' +
|
||||
' }' +
|
||||
' };' +
|
||||
'<\/script>';
|
||||
iframe.srcdoc = `<script>
|
||||
window.onmessage = message => {
|
||||
if (message.data === "Ready") {
|
||||
let onSuccess = () => { parent.postMessage("Failure", "*"); };
|
||||
let onError = error => {
|
||||
if (error.name == "SecurityError") {
|
||||
parent.postMessage("Success", "*");
|
||||
} else {
|
||||
parent.postMessage("Failure", "*");
|
||||
}
|
||||
};
|
||||
try {
|
||||
navigator.nfc.push("Test").then(onSuccess, onError);
|
||||
} catch(e) {
|
||||
parent.postMessage("Failure", "*");
|
||||
}
|
||||
}
|
||||
};
|
||||
<\/script>`;
|
||||
iframe.onload = () => iframe.contentWindow.postMessage('Ready', '*');
|
||||
document.body.appendChild(iframe);
|
||||
window.onmessage = message => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue