diff --git a/clipboard-apis/async-custom-formats-write-read.tentative.https.html b/clipboard-apis/async-custom-formats-write-read.tentative.https.html index b6c368f75bc2f2..c91ce0e5c246b0 100644 --- a/clipboard-apis/async-custom-formats-write-read.tentative.https.html +++ b/clipboard-apis/async-custom-formats-write-read.tentative.https.html @@ -14,26 +14,19 @@ promise_test(async t => { await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); await test_driver.set_permission({name: 'clipboard-write'}, 'granted'); - const format1 = 'application/x-custom-format-clipboard-test-format-1'; - const format2 = 'application/x-custom-format-clipboard-test-format-2'; + const format1 = 'web application/x-custom-format-clipboard-test-format-1'; + const format2 = 'web application/x-custom-format-clipboard-test-format-2'; const blobInput1 = new Blob(['input data 1'], {type: format1}); const blobInput2 = new Blob(['input data 2'], {type: format2}); const clipboardItemInput = new ClipboardItem( - {[format1]: blobInput1, [format2]: blobInput2}, - {unsanitized: [format1, format2]}); + {[format1]: blobInput1, [format2]: blobInput2}); await waitForUserActivation(); await navigator.clipboard.write([clipboardItemInput]); - // Items may not be readable on the sanitized clipboard after custom format - // write. - await promise_rejects_dom(t, 'DataError', - navigator.clipboard.read()); - // Items should be readable on a custom format clipboard after custom format // write. await waitForUserActivation(); - const clipboardItems = await navigator.clipboard.read( - {unsanitized: [format1, format2]}); + const clipboardItems = await navigator.clipboard.read(); assert_equals(clipboardItems.length, 1); const clipboardItem = clipboardItems[0]; assert_true(clipboardItem instanceof ClipboardItem); @@ -58,15 +51,29 @@ const customFormatArray = []; const customFormatMap = {}; for (let i = 0; i <= 100; i++) { - customFormatArray.push("CustomFormat" + i); + customFormatArray.push("web text/CustomFormat" + i); const blobInput = new Blob(['input data'], {type: customFormatArray[i]}); customFormatMap[customFormatArray[i]] = blobInput; } - const clipboardItemInput = new ClipboardItem(customFormatMap, - {unsanitized: customFormatArray}); + const clipboardItemInput = new ClipboardItem(customFormatMap); await waitForUserActivation(); await promise_rejects_dom(t, 'NotAllowedError', navigator.clipboard.write([clipboardItemInput])); }, 'navigator.clipboard.write() fails for more than 100 custom formats'); +promise_test(async t => { + await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); + await test_driver.set_permission({name: 'clipboard-write'}, 'granted'); + + const format1 = 'application/x-custom-format-clipboard-test-format-1'; + const format2 = 'application/x-custom-format-clipboard-test-format-2'; + const blobInput1 = new Blob(['input data 1'], {type: format1}); + const blobInput2 = new Blob(['input data 2'], {type: format2}); + const clipboardItemInput = new ClipboardItem( + {[format1]: blobInput1, [format2]: blobInput2}); + await waitForUserActivation(); + await promise_rejects_dom(t, 'NotAllowedError', + navigator.clipboard.write([clipboardItemInput])); +}, 'navigator.clipboard.write() fails for custom formats without web prefix'); + diff --git a/clipboard-apis/async-html-script-removal.https.html b/clipboard-apis/async-html-script-removal.https.html index 90dc44c9db20e3..44c11add855137 100644 --- a/clipboard-apis/async-html-script-removal.https.html +++ b/clipboard-apis/async-html-script-removal.https.html @@ -4,10 +4,12 @@ Async Clipboard write ([text/html ClipboardItem]) -> readHtml (and remove scripts) tests +
Body needed for test_driver.click() + + +Body needed for test_driver.click() @@ -27,6 +29,7 @@ await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); await test_driver.click(button); + await waitForUserActivation(); const items = await navigator.clipboard.read(); const htmlBlob = await items[0].getType("text/html"); const html = await htmlBlob.text(); @@ -38,3 +41,4 @@ assert_false(loadObserved, 'Should not observe resource loading'); }); + diff --git a/clipboard-apis/async-navigator-clipboard-read-sanitize.https.html b/clipboard-apis/async-navigator-clipboard-read-sanitize.https.html index 9e0ab2ee740f85..cc1836753478b7 100644 --- a/clipboard-apis/async-navigator-clipboard-read-sanitize.https.html +++ b/clipboard-apis/async-navigator-clipboard-read-sanitize.https.html @@ -7,7 +7,9 @@ + +Body needed for test_driver.click() @@ -29,6 +31,7 @@ await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); await test_driver.click(button); + await waitForUserActivation(); const items = await navigator.clipboard.read(); const htmlBlob = await items[0].getType("text/html"); const html = await htmlBlob.text(); @@ -42,3 +45,4 @@ assert_false(testFailed); }); + diff --git a/clipboard-apis/async-promise-write-blobs-read-blobs.https.html b/clipboard-apis/async-promise-write-blobs-read-blobs.https.html index e4b93c7c5ffb7c..12184c92e0777f 100644 --- a/clipboard-apis/async-promise-write-blobs-read-blobs.https.html +++ b/clipboard-apis/async-promise-write-blobs-read-blobs.https.html @@ -4,10 +4,12 @@ Async Clipboard write blobs -> read blobs with promise tests +Body needed for test_driver.click() + + diff --git a/clipboard-apis/async-unsanitized-plaintext-formats-write-read.tentative.https.html b/clipboard-apis/async-unsanitized-plaintext-formats-write-read.tentative.https.html index f44ed22618e2fd..1c5638ca0a5faf 100644 --- a/clipboard-apis/async-unsanitized-plaintext-formats-write-read.tentative.https.html +++ b/clipboard-apis/async-unsanitized-plaintext-formats-write-read.tentative.https.html @@ -18,32 +18,35 @@ await test_driver.set_permission({name: 'clipboard-write'}, 'granted'); const dataToWrite = 'Test text.'; - const format = 'text/plain'; + const format1 = 'web text/plain'; + const format2 = 'text/plain'; - const blobInput = new Blob([dataToWrite], {type: format}); + const blobInput1 = new Blob([dataToWrite], {type: format1}); + const blobInput2 = new Blob([dataToWrite], {type: format2}); // Blob types are automatically converted to lower-case. - assert_equals(blobInput.type, format.toLowerCase()); + assert_equals(blobInput1.type, format1.toLowerCase()); + assert_equals(blobInput2.type, format2.toLowerCase()); const clipboardItemInput = new ClipboardItem( - {[format]: blobInput}, {unsanitized: [format]}); + {[format1]: blobInput1, [format2]: blobInput2}); await waitForUserActivation(); await navigator.clipboard.write([clipboardItemInput]); // Items should be readable on a system clipboard after custom format write. await waitForUserActivation(); - const clipboardItems = await navigator.clipboard.read( - {unsanitized: [format]}); + const clipboardItems = await navigator.clipboard.read(); assert_equals(clipboardItems.length, 1); const clipboardItem = clipboardItems[0]; assert_true(clipboardItem instanceof ClipboardItem); - const blobOutput = await clipboardItem.getType(format); - assert_equals(blobOutput.type, format); - const data = await (new Response(blobOutput)).text(); - assert_equals(data, dataToWrite); + const blobOutput1 = await clipboardItem.getType(format1); + assert_equals(blobOutput1.type, format1); + const data1 = await (new Response(blobOutput1)).text(); + assert_equals(data1, dataToWrite); // These examples use native text formats, so these formats should be // accessible as text. + await waitForUserActivation(); const textOutput = await navigator.clipboard.readText(); assert_equals(textOutput, dataToWrite); -}, 'Verify write and read unsanitized content to the clipboard given standard format as input'); +}, 'Verify write and read unsanitized content to the clipboard given standard and custom formats as input'); diff --git a/clipboard-apis/async-write-blobs-read-blobs.https.html b/clipboard-apis/async-write-blobs-read-blobs.https.html index 50d23a9c3625d5..8bec558b2b2de8 100644 --- a/clipboard-apis/async-write-blobs-read-blobs.https.html +++ b/clipboard-apis/async-write-blobs-read-blobs.https.html @@ -4,10 +4,12 @@ Async Clipboard write blobs -> read blobs tests +Body needed for test_driver.click() + + + +Body needed for test_driver.click()
The bottom image should display the same image as the top image.
Original Image:
@@ -47,7 +49,9 @@ assert_equals(blobInput.type, 'image/png'); const clipboardItemInput = new ClipboardItem({'image/png' : blobInput}); + await waitForUserActivation(); await navigator.clipboard.write([clipboardItemInput]); + await waitForUserActivation(); const clipboardItems = await navigator.clipboard.read(); assert_equals(clipboardItems.length, 1); @@ -73,7 +77,9 @@ const invalidPngBlob = new Blob(['this text is not a valid png image'], {type: 'image/png'}); const clipboardItemInput = new ClipboardItem({'image/png' : invalidPngBlob}); + await waitForUserActivation(); await promise_rejects_dom(t, 'DataError', navigator.clipboard.write([clipboardItemInput])); }, 'Verify write error on malformed data [image/png ClipboardItem]'); + diff --git a/clipboard-apis/async-write-svg-read-svg.https.html b/clipboard-apis/async-write-svg-read-svg.https.html index 19c91597c111ee..42f6c547b29799 100644 --- a/clipboard-apis/async-write-svg-read-svg.https.html +++ b/clipboard-apis/async-write-svg-read-svg.https.html @@ -4,10 +4,12 @@ Async Clipboard write ([image/svg+xml ClipboardItem]) -> read and write svg tests +Body needed for test_driver.click() + + + + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + - +Body needed for test_driver.click() + -Body needed for test_driver.click()Body needed for test_driver.click()Body needed for test_driver.click()