commit | d5d8dff80df5e6df3a090afe30c6220c020aa893 | [log] [tgz] |
---|---|---|
author | wenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Mon Oct 16 07:59:39 2017 +0000 |
committer | wenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Mon Oct 16 07:59:39 2017 +0000 |
tree | 74a77f402e52b48d5148f5b3ec7ba77408ec22cd | |
parent | 0f8b4d043ce6e3e58e059a68f31e33e63f84d8ba [diff] |
On ToT, event.dataTransfer.getData("text/uri-list") returns an empty string when dragging an image https://bugs.webkit.org/show_bug.cgi?id=178301 <rdar://problem/34990050> Reviewed by Darin Adler. Source/WebCore: After r222656, we consider images on the pasteboard to be files. This causes DataTransfer.getData to return the empty string for all types, which brings back https://bugs.webkit.org/show_bug.cgi?id=170637. To allow pages to access the URL part of a dragged image, we exempt "text/uri-list" from our heurstics to hide pasteboard data which may contain files, and return the URL as long as its protocol is either HTTP or HTTPS. Tweaked an existing layout test to cover this scenario, as well as the scenario in which the dragged image links to a file URL (in which case we should avoid exposing the data). Test: editing/pasteboard/drag-drop-href-as-url.html DataInteractionTests.DataTransferGetDataWhenDroppingImageWithHTTPURL * dom/DataTransfer.cpp: (WebCore::DataTransfer::getDataForItem const): When the pasteboard contains files, allow data for "text/uri-list" to be returned, as long as the URL string has a white-listed protocol (currently, this is just http and https). (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const): (WebCore::DataTransfer::setData): (WebCore::DataTransfer::types const): When the pasteboard contains files, allow "text/uri-list" to be added, alongside the "Files" type, if it would have been exposed in the list of safe DOM types. * dom/DataTransfer.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): Add a new helper method to determine whether it is safe to expose an URL string as "text/uri-list" to bindings, if the pasteboard contains files. While this currently checks whether or not the URL is in the HTTP family, we may want to consider tweaking this to blacklist the "file" protocol instead, and allow all other valid URLs by default. * platform/Pasteboard.h: * platform/PlatformPasteboard.h: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::pasteboardMayContainFilePaths): (WebCore::PlatformPasteboard::stringForType const): Mark stringForType as const, and also teach stringForType to return the null string for the platform URL type if the pasteboard might contain file paths. (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Before coercing a platform type to "text/uri-list" when building the list of DOM-safe types, check that the stringForType is not the empty string, in which case we don't expose the type to the DOM at all. This ensures that in cases where the URL might reveal a file path, we don't advertise "text/uri-list" as a type. We adopt a similar strategy on iOS. (WebCore::PlatformPasteboard::stringForType): Deleted. * platform/mac/PlatformPasteboardMac.mm: (WebCore::pasteboardMayContainFilePaths): (WebCore::PlatformPasteboard::stringForType const): (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): (WebCore::PlatformPasteboard::stringForType): Deleted. Tools: Fixes issues in DumpRenderTree's LocalPasteboard to ensure that drag-drop-href-as-url.html exposes files, and also adds a new iOS drag and drop API test. * DumpRenderTree/mac/DumpRenderTreePasteboard.mm: (-[LocalPasteboard addTypes:owner:]): (-[LocalPasteboard setData:forType:]): Fixes LocalPasteboard's implementation of changeCount to incremement when the pasteboard owner changes, rather than every time data is changed. This is consistent with NSPasteboard behavior. * TestWebKitAPI/Tests/ios/DataInteractionTests.mm: (TestWebKitAPI::TEST): Adds a new API test to verify that an image and HTTP URL written by the platform is correctly web exposed. LayoutTests: Fixes an existing test to account for asynchronous image decoding, and also rebaselines results to expect that only the URL can be read, and not text. * TestExpectations: * editing/pasteboard/data-transfer-item-list-add-file-multiple-times-expected.txt: * editing/pasteboard/drag-drop-href-as-text-data-expected.txt: Removed. * editing/pasteboard/drag-drop-href-as-text-data.html: Removed. * editing/pasteboard/drag-drop-href-as-url-expected.txt: Added. * editing/pasteboard/drag-drop-href-as-url.html: Added. Tweaks an existing drag and drop test to verify that an URL can be read back when dragging an image, but not when if the URL is a file URL. * editing/pasteboard/files-during-page-drags-expected.txt: * editing/pasteboard/files-during-page-drags.html: Fixes this test by decoding the dragged image element before starting the drag and drop simulation. * platform/mac-wk1/TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@223340 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.
Downloading Safari Technology Preview to test the latest version of WebKit.
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
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.
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 WebKit.
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.
Install the dependencies by running the following command:
Tools/gtk/install-dependencies
Then run the following command to build additional dependencies:
Tools/Scripts/update-webkitgtk-libs
Run the following command to build WebKit with debugging symbols for GTK+ port:
Tools/Scripts/build-webkit --debug --gtk
Note that the procedure for building a release tarball is different. For more information, see the wiki page.
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
.
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.