Changeset 252627 in webkit
- Timestamp:
- Nov 19, 2019 7:26:13 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252623 r252627 1 2019-11-19 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Clipboard API] Add support for Clipboard.readText() 4 https://bugs.webkit.org/show_bug.cgi?id=204310 5 <rdar://problem/57292754> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add several new layout tests. 10 11 * editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes-expected.txt: Added. 12 * editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html: Added. 13 14 Add a test to verify that if the clipboard changes content in the middle of a call to clipboard.readText, we 15 will reject the readText() promise and avoid exposing any text to the page. 16 17 * editing/async-clipboard/clipboard-read-text-expected.txt: Added. 18 * editing/async-clipboard/clipboard-read-text-from-platform-expected.txt: Added. 19 * editing/async-clipboard/clipboard-read-text-from-platform.html: Added. 20 21 Add a test to verify that we display DOM paste UI when reading text that was written to the pasteboard directly 22 via platform API. 23 24 * editing/async-clipboard/clipboard-read-text-same-origin-expected.txt: Added. 25 * editing/async-clipboard/clipboard-read-text-same-origin.html: Added. 26 27 Add a test to verify that we allow the page to access same origin text data on the pasteboard using readText, 28 during a user gesture. 29 30 * editing/async-clipboard/clipboard-read-text.html: Added. 31 32 Add a basic test to verify that readText works when the page writes text to the clipboard using DataTransfer and 33 document.execCommand. 34 35 * platform/gtk/TestExpectations: 36 * platform/mac-wk1/TestExpectations: 37 * platform/win/TestExpectations: 38 * platform/wpe/TestExpectations: 39 1 40 2019-11-18 John Wilander <wilander@apple.com> 2 41 -
trunk/LayoutTests/imported/w3c/ChangeLog
r252598 r252627 1 2019-11-19 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Clipboard API] Add support for Clipboard.readText() 4 https://bugs.webkit.org/show_bug.cgi?id=204310 5 <rdar://problem/57292754> 6 7 Reviewed by Ryosuke Niwa. 8 9 Rebaseline a couple of imported web platform tests. 10 11 * web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https-expected.txt: 12 * web-platform-tests/clipboard-apis/async-write-text-read-text-manual.https-expected.txt: 13 1 14 2019-11-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https-expected.txt
r252561 r252627 8 8 PASS navigator.clipboard.writeText() fails (expect DOMString) 9 9 FAIL navigator.clipboard.read() succeeds assert_true: expected true got false 10 FAIL navigator.clipboard.readText() succeeds promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported." 10 PASS navigator.clipboard.readText() succeeds 11 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/clipboard-apis/async-write-text-read-text-manual.https-expected.txt
r250856 r252627 1 1 Note: This is a manual test because it writes/reads to the shared system clipboard and thus cannot be run async with other tests that might interact with the clipboard. 2 2 3 Harness Error (TIMEOUT), message = null 3 PASS Verify write and read clipboard (DOMString) 4 4 5 TIMEOUT Verify write and read clipboard (DOMString) Test timed out6 -
trunk/LayoutTests/platform/gtk/TestExpectations
r252498 r252627 1296 1296 webkit.org/b/204112 editing/async-clipboard/clipboard-change-data-while-reading.html [ Crash ] 1297 1297 webkit.org/b/204112 editing/async-clipboard/clipboard-get-type-with-old-items.html [ Crash ] 1298 webkit.org/b/204112 editing/async-clipboard/clipboard-read-text-from-platform.html [ Crash ] 1299 webkit.org/b/204112 editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html [ Crash ] 1298 1300 1299 1301 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r252397 r252627 70 70 # DOM paste access requests are not implemented in WebKit1. 71 71 editing/async-clipboard/clipboard-change-data-while-reading.html [ Skip ] 72 editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html [ Skip ] 73 editing/async-clipboard/clipboard-read-text-from-platform.html [ Skip ] 74 editing/async-clipboard/clipboard-read-text-same-origin.html [ Skip ] 72 75 73 76 imported/w3c/web-platform-tests/websockets/Close-1000-reason.any.html [ Pass Failure ] -
trunk/LayoutTests/platform/win/TestExpectations
r252598 r252627 1195 1195 webkit.org/b/203100 editing/async-clipboard/clipboard-write-items-twice.html [ Skip ] 1196 1196 webkit.org/b/203100 editing/async-clipboard/clipboard-write-text.html [ Skip ] 1197 webkit.org/b/203100 editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html [ Skip ] 1198 webkit.org/b/203100 editing/async-clipboard/clipboard-read-text-from-platform.html [ Skip ] 1199 webkit.org/b/203100 editing/async-clipboard/clipboard-read-text-same-origin.html [ Skip ] 1200 webkit.org/b/203100 editing/async-clipboard/clipboard-read-text.html [ Skip ] 1197 1201 1198 1202 webkit.org/b/140783 [ Release ] editing/pasteboard/copy-standalone-image.html [ Failure ImageOnlyFailure ] -
trunk/LayoutTests/platform/wpe/TestExpectations
r252366 r252627 790 790 webkit.org/b/204112 editing/async-clipboard/clipboard-change-data-while-reading.html [ Crash ] 791 791 webkit.org/b/204112 editing/async-clipboard/clipboard-get-type-with-old-items.html [ Crash ] 792 webkit.org/b/204112 editing/async-clipboard/clipboard-read-text-from-platform.html [ Crash ] 793 webkit.org/b/204112 editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html [ Crash ] 792 794 793 795 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/Source/WebCore/ChangeLog
r252626 r252627 1 2019-11-19 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Clipboard API] Add support for Clipboard.readText() 4 https://bugs.webkit.org/show_bug.cgi?id=204310 5 <rdar://problem/57292754> 6 7 Reviewed by Ryosuke Niwa. 8 9 Implements readText; see below for more detail. 10 11 Tests: editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html 12 editing/async-clipboard/clipboard-read-text-from-platform.html 13 editing/async-clipboard/clipboard-read-text-same-origin.html 14 editing/async-clipboard/clipboard-read-text.html 15 16 * Modules/async-clipboard/Clipboard.cpp: 17 (WebCore::Clipboard::readText): 18 19 Implement the method. This works similarly to Clipboard::read, but immediately reads text data for the first 20 clipboard item with data for "text/plain", instead of exposing a list of clipboard items. 21 22 * dom/DataTransfer.cpp: 23 (WebCore::DataTransfer::commitToPasteboard): 24 25 If the custom pasteboard data object is empty, then don't bother trying to write it to the platform pasteboard. 26 This avoids hitting an assertion in WebDragClient::beginDrag that checks to make sure there's no data on the 27 pasteboard right before beginning a drag in the UI process which was getting hit because we'd otherwise end up 28 writing just the pasteboard data origin; it also has an added bonus of avoiding an unnecessary sync IPC message. 29 30 * platform/mac/PlatformPasteboardMac.mm: 31 (WebCore::PlatformPasteboard::write): 32 33 Write the custom data type ("com.apple.WebKit.custom-pasteboard-data") when writing PasteboardCustomData to the 34 pasteboard on macOS, even when the custom pasteboard data only contains an origin. This allows DOM paste 35 requests to automatically accept when exchanging text data between the same origin via the async clipboard API. 36 1 37 2019-11-19 Chris Dumez <cdumez@apple.com> 2 38 -
trunk/Source/WebCore/Modules/async-clipboard/Clipboard.cpp
r252561 r252627 98 98 void Clipboard::readText(Ref<DeferredPromise>&& promise) 99 99 { 100 promise->reject(NotSupportedError); 100 auto frame = makeRefPtr(this->frame()); 101 if (!frame) { 102 promise->reject(NotAllowedError); 103 return; 104 } 105 106 auto pasteboard = Pasteboard::createForCopyAndPaste(); 107 auto changeCountAtStart = pasteboard->changeCount(); 108 if (!frame->requestDOMPasteAccess()) { 109 promise->reject(NotAllowedError); 110 return; 111 } 112 113 auto allInfo = pasteboard->allPasteboardItemInfo(); 114 if (!allInfo) { 115 promise->reject(NotAllowedError); 116 return; 117 } 118 119 String text; 120 for (size_t index = 0; index < allInfo->size(); ++index) { 121 if (allInfo->at(index).webSafeTypesByFidelity.contains("text/plain"_s)) { 122 PasteboardPlainText plainTextReader; 123 pasteboard->read(plainTextReader, PlainTextURLReadingPolicy::IgnoreURL, index); 124 text = WTFMove(plainTextReader.text); 125 break; 126 } 127 } 128 129 if (changeCountAtStart == pasteboard->changeCount()) 130 promise->resolve<IDLDOMString>(WTFMove(text)); 131 else 132 promise->reject(NotAllowedError); 101 133 } 102 134 -
trunk/Source/WebCore/dom/DataTransfer.cpp
r251117 r252627 426 426 ASSERT(is<StaticPasteboard>(*m_pasteboard) && !is<StaticPasteboard>(nativePasteboard)); 427 427 PasteboardCustomData customData = downcast<StaticPasteboard>(*m_pasteboard).takeCustomData(); 428 if (!customData.hasData()) 429 return; 430 428 431 if (RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 429 432 customData.setOrigin(m_originIdentifier); -
trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm
r252450 r252627 232 232 }); 233 233 234 bool hasSameOriginCustomData = data.hasSameOriginCustomData();235 if ( hasSameOriginCustomData)234 bool shouldWriteCustomData = data.hasSameOriginCustomData() || !data.origin().isEmpty(); 235 if (shouldWriteCustomData) 236 236 [types addObject:@(PasteboardCustomData::cocoaType())]; 237 237 … … 245 245 }); 246 246 247 if ( hasSameOriginCustomData) {247 if (shouldWriteCustomData) { 248 248 if (auto serializedCustomData = data.createSharedBuffer()->createNSData()) 249 249 [m_pasteboard setData:serializedCustomData.get() forType:@(PasteboardCustomData::cocoaType())];
Note: See TracChangeset
for help on using the changeset viewer.