commit | 56b894cf3d88d931dd6ddc67d6c4d9e352030ab4 | [log] [tgz] |
---|---|---|
author | wenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Oct 22 07:22:19 2019 +0000 |
committer | wenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Oct 22 07:22:19 2019 +0000 |
tree | 70a17b73b5d6930737f1e9b3c2c32a10e0373dbb | |
parent | a889c22a722efefd76f24df60e336145cc923ad5 [diff] |
imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https.html is flaky https://bugs.webkit.org/show_bug.cgi?id=203181 Reviewed by Ryosuke Niwa. Source/WebCore: This test is flaky because its results currently vary depending on whether content already exists on the platform pasteboard. In this test, the page is able to read items from the clipboard since DOM paste and programmatic clipboard access are enabled when running layout tests. However, in the case where the pasteboard is empty, we end up rejecting the promise due to an early return in Clipboard::read(). In contrast, when the pasteboard has at least one item, we'll end up resolving the promise with a sequence of ClipboardItems, which then causes the test to fail because it expects this result to be a DataTransfer instead (which, at time of writing, is incorrect w.r.t. the async clipboard spec). To fix this, we remove this early return that rejects the promise when there are no pasteboard items, and instead allow the promise to resolve with no items. However, simply removing this check would mean that if the pasteboard change count changes between the start of the call to Clipboard.read() and retrieval of item information from the platform pasteboard, we'll no longer reject the promimse as expected. This is because we currently iterate through each of the items and check that the item's change count matches, so if there are no items, we simply avoid checking the change count. We address this by instead sending the expected change count along with the request for allPasteboardItemInfo(), and refactoring the implementation of allPasteboardItemInfo (and informationForItemAtIndex) to instead check this expected change count against the current change count of the pasteboard. * Modules/async-clipboard/Clipboard.cpp: (WebCore::Clipboard::read): Remove the `allInfo.isEmpty()` early return, and also remove a FIXME that is addressed by this refactoring. * Modules/async-clipboard/Clipboard.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::allPasteboardItemInfo const): (WebCore::Pasteboard::pasteboardItemInfo const): Make these methods require a changeCount; also, make these return optional results. * platform/Pasteboard.h: (WebCore::Pasteboard::changeCount const): * platform/PasteboardItemInfo.h: (WebCore::PasteboardItemInfo::encode const): (WebCore::PasteboardItemInfo::decode): Remove PasteboardItemInfo's changeCount, now that the check occurs in the client layer. * platform/PasteboardStrategy.h: * platform/PlatformPasteboard.h: * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::fileContentState): (WebCore::Pasteboard::changeCount const): * platform/cocoa/PlatformPasteboardCocoa.mm: (WebCore::PlatformPasteboard::allPasteboardItemInfo): * platform/gtk/PlatformPasteboardGtk.cpp: (WebCore::PlatformPasteboard::write): * platform/ios/PasteboardIOS.mm: (WebCore::changeCountForPasteboard): (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::read): (WebCore::Pasteboard::readRespectingUTIFidelities): (WebCore::Pasteboard::readPlatformValuesAsStrings): Normalize changeCount to be a `int64_t`, which matches iOS and macOS platforms. Before this patch, the notion of changeCount is very ill-defined, with some call sites expecting `long` types, other call sites expecting `int`, and yet others expecting `uint64_t`. This changes all of these to expect `int64_t`. (WebCore::Pasteboard::readFilePaths): Refactor these methods to bail when the resulting item information has no value (i.e. WTF::nullopt). * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::informationForItemAtIndex): (WebCore::PlatformPasteboard::copy): (WebCore::PlatformPasteboard::addTypes): (WebCore::PlatformPasteboard::setTypes): (WebCore::PlatformPasteboard::setBufferForType): (WebCore::PlatformPasteboard::setURL): (WebCore::PlatformPasteboard::setStringForType): (WebCore::PlatformPasteboard::changeCount const): (WebCore::PlatformPasteboard::setColor): (WebCore::PlatformPasteboard::write): * platform/libwpe/PlatformPasteboardLibWPE.cpp: (WebCore::PlatformPasteboard::write): * platform/mac/PasteboardMac.mm: (WebCore::writeURLForTypes): (WebCore::writeFileWrapperAsRTFDAttachment): (WebCore::Pasteboard::read): (WebCore::Pasteboard::readPlatformValuesAsStrings): * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::write): (WebCore::PlatformPasteboard::changeCount const): (WebCore::PlatformPasteboard::copy): (WebCore::PlatformPasteboard::addTypes): (WebCore::PlatformPasteboard::setTypes): (WebCore::PlatformPasteboard::setBufferForType): (WebCore::PlatformPasteboard::setURL): (WebCore::PlatformPasteboard::setColor): (WebCore::PlatformPasteboard::setStringForType): (WebCore::PlatformPasteboard::informationForItemAtIndex): Source/WebKit: Add a changeCount argument to informationForItemAtIndex and allPasteboardItemInfo, and also make then return optional values; also, adjust changeCount to be an `int64_t` in a few places. See WebCore ChangeLog for more details. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::pasteboardCopy): (WebKit::WebPasteboardProxy::getPasteboardChangeCount): (WebKit::WebPasteboardProxy::addPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardURL): (WebKit::WebPasteboardProxy::setPasteboardColor): (WebKit::WebPasteboardProxy::setPasteboardStringForType): (WebKit::WebPasteboardProxy::setPasteboardBufferForType): (WebKit::WebPasteboardProxy::writeCustomData): (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): * UIProcess/WebPasteboardProxy.cpp: (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::writeItemsToPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::changeCount): (WebKit::WebPlatformStrategies::addTypes): (WebKit::WebPlatformStrategies::setTypes): (WebKit::WebPlatformStrategies::setBufferForType): (WebKit::WebPlatformStrategies::setURL): (WebKit::WebPlatformStrategies::setColor): (WebKit::WebPlatformStrategies::setStringForType): (WebKit::WebPlatformStrategies::writeCustomData): (WebKit::WebPlatformStrategies::allPasteboardItemInfo): (WebKit::WebPlatformStrategies::informationForItemAtIndex): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Source/WebKitLegacy/mac: Add a changeCount argument to informationForItemAtIndex and allPasteboardItemInfo, and also make then return optional values. See WebCore ChangeLog for more details. * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::changeCount): (WebPlatformStrategies::addTypes): (WebPlatformStrategies::setTypes): (WebPlatformStrategies::setBufferForType): (WebPlatformStrategies::setURL): (WebPlatformStrategies::setColor): (WebPlatformStrategies::setStringForType): (WebPlatformStrategies::writeCustomData): (WebPlatformStrategies::informationForItemAtIndex): (WebPlatformStrategies::allPasteboardItemInfo): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251421 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
or
git clone https://git.webkit.org/git/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.