WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 38826
Don't convert filenames to URLs in edit drags.
https://bugs.webkit.org/show_bug.cgi?id=38826
Summary
Don't convert filenames to URLs in edit drags.
Daniel Cheng
Reported
2010-05-09 17:49:00 PDT
This is on Chromium, but I believe the same will happen in Safari. Go to any web page, set the page to be contentEditable, and then drag and drop a file. A link is created with an absolute file:// path. This is because DragController calls DragData::asURL.
Attachments
Patch
(30.36 KB, patch)
2010-05-20 21:02 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(24.69 KB, patch)
2010-06-04 21:43 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(24.69 KB, patch)
2010-06-05 13:26 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(24.91 KB, patch)
2010-06-05 13:40 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(26.23 KB, patch)
2010-06-07 17:06 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(27.84 KB, patch)
2010-06-08 17:30 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(26.28 KB, patch)
2010-06-08 17:38 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(26.26 KB, patch)
2010-06-08 18:48 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Patch
(26.11 KB, patch)
2010-06-09 13:39 PDT
,
Daniel Cheng
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Daniel Cheng
Comment 1
2010-05-20 21:02:14 PDT
Created
attachment 56666
[details]
Patch
Daniel Cheng
Comment 2
2010-05-20 21:10:39 PDT
Darin, do you mind reviewing this patch?
Eric Seidel (no email)
Comment 3
2010-05-28 15:53:09 PDT
Oliver has also worked on drag code in the past and may be interested in this change.
Simon Fraser (smfr)
Comment 4
2010-05-28 15:55:00 PDT
Comment on
attachment 56666
[details]
Patch
> + String url = dragData->asURL(false, &title);
Boolean parameters suck. It's hard, at the call site, to know what the true/false means. Either use an enum, or have two separate methods.
Jian Li
Comment 5
2010-05-28 16:18:16 PDT
LayoutTests/platform/qt/Skipped:5096 + # Filenames aren't filtered out from edit drags yet, see
https://bugs.wekit.org/show_bug.cgi?id=38826
I think this test should still be marked as skipped even after filename filtering is supported because qt does not support beginDragWithFiles yet. WebCore/platform/DragData.h:95 + bool containsURL(bool convertFilenames = false) const; It will be simpler to make the default value to support the majority cases which is true. Then you do not need to change a lot of codes above. In addition, I think convertFilenames is a little bit confusing since indeed we mean not to expose file url, maybe something like doNotExposeFilename and make the default value as false. Or even better, as Simon pointed out, switch to using enum. WebCore/platform/DragData.h:98 + String asURL(bool convertFilenames = false, String* title = 0) const; ditto. WebCore/platform/android/DragDataAndroid.cpp:71 + bool DragData::containsURL(bool convertFilenames) const Please make sure this can get compiled correctly since some platforms might complain about unused parameter.
Daniel Cheng
Comment 6
2010-06-04 21:43:57 PDT
Created
attachment 57959
[details]
Patch
Early Warning System Bot
Comment 7
2010-06-04 21:48:54 PDT
Attachment 57959
[details]
did not build on qt: Build output:
http://webkit-commit-queue.appspot.com/results/3090061
WebKit Review Bot
Comment 8
2010-06-05 04:07:47 PDT
Attachment 57959
[details]
did not build on win: Build output:
http://webkit-commit-queue.appspot.com/results/3078084
Daniel Cheng
Comment 9
2010-06-05 13:26:24 PDT
Created
attachment 57969
[details]
Patch
Early Warning System Bot
Comment 10
2010-06-05 13:33:15 PDT
Attachment 57969
[details]
did not build on qt: Build output:
http://webkit-commit-queue.appspot.com/results/3148057
Daniel Cheng
Comment 11
2010-06-05 13:40:09 PDT
Created
attachment 57970
[details]
Patch
WebKit Review Bot
Comment 12
2010-06-05 14:53:06 PDT
Attachment 57969
[details]
did not build on win: Build output:
http://webkit-commit-queue.appspot.com/results/3120078
WebKit Review Bot
Comment 13
2010-06-05 15:17:25 PDT
Attachment 57970
[details]
did not build on win: Build output:
http://webkit-commit-queue.appspot.com/results/3113093
Daniel Cheng
Comment 14
2010-06-07 17:06:46 PDT
Created
attachment 58096
[details]
Patch
WebKit Review Bot
Comment 15
2010-06-07 21:10:39 PDT
Attachment 58096
[details]
did not build on win: Build output:
http://webkit-commit-queue.appspot.com/results/3237011
Daniel Cheng
Comment 16
2010-06-08 17:30:52 PDT
Created
attachment 58200
[details]
Patch
Daniel Cheng
Comment 17
2010-06-08 17:38:37 PDT
Created
attachment 58202
[details]
Patch
Daniel Cheng
Comment 18
2010-06-08 17:40:00 PDT
(In reply to
comment #5
)
> LayoutTests/platform/qt/Skipped:5096 > + # Filenames aren't filtered out from edit drags yet, see
https://bugs.wekit.org/show_bug.cgi?id=38826
> I think this test should still be marked as skipped even after filename filtering is supported because qt does not support beginDragWithFiles yet. >
Done.
> WebCore/platform/DragData.h:95 > + bool containsURL(bool convertFilenames = false) const; > It will be simpler to make the default value to support the majority cases which is true. Then you do not need to change a lot of codes above. > In addition, I think convertFilenames is a little bit confusing since indeed we mean not to expose file url, maybe something like doNotExposeFilename and make the default value as false. Or even better, as Simon pointed out, switch to using enum. > > WebCore/platform/DragData.h:98 > + String asURL(bool convertFilenames = false, String* title = 0) const; > ditto. >
Changed the default argument value, and also switched it to using an enum.
> WebCore/platform/android/DragDataAndroid.cpp:71 > + bool DragData::containsURL(bool convertFilenames) const > Please make sure this can get compiled correctly since some platforms might complain about unused parameter.
There are other unused parameters already, so I think this should be OK.
Jian Li
Comment 19
2010-06-08 18:26:51 PDT
Comment on
attachment 58202
[details]
Patch LayoutTests/ChangeLog:14 + (moveMouseToCenterOfElement): No need to show these new methods in js. WebCore/platform/DragData.h:81 + enum ShouldConvertFilenames { DoNotConvertFilenames, ConvertFilenames }; Might be better to name ShouldConvertFilenames as FilenamesConvertPolicy. WebCore/platform/chromium/DragDataChromium.cpp:64 + String DragData::asURL(ShouldConvertFilenames convertFilenames, String* title) const ShouldConvertFilenames convertFilenames => FilenamesConvertPolicy convertPolicy WebCore/platform/android/DragDataAndroid.cpp:71 + bool DragData::containsURL(ShouldConvertFilenames convertFilenames) const The argument name can be omitted. Please also change other occurrences.
Daniel Cheng
Comment 20
2010-06-08 18:48:36 PDT
Created
attachment 58205
[details]
Patch
Daniel Cheng
Comment 21
2010-06-08 23:30:39 PDT
(In reply to
comment #19
)
> (From update of
attachment 58202
[details]
) > LayoutTests/ChangeLog:14 > + (moveMouseToCenterOfElement): > No need to show these new methods in js. >
This is the output from prepare-ChangeLog. I felt best to leave it that way.
> WebCore/platform/DragData.h:81 > + enum ShouldConvertFilenames { DoNotConvertFilenames, ConvertFilenames }; > Might be better to name ShouldConvertFilenames as FilenamesConvertPolicy. >
Done.
> WebCore/platform/chromium/DragDataChromium.cpp:64 > + String DragData::asURL(ShouldConvertFilenames convertFilenames, String* title) const > ShouldConvertFilenames convertFilenames => FilenamesConvertPolicy convertPolicy >
Done.
> WebCore/platform/android/DragDataAndroid.cpp:71 > + bool DragData::containsURL(ShouldConvertFilenames convertFilenames) const > The argument name can be omitted. Please also change other occurrences.
This is actually necessary--it's used by WebCore/page/DragController.cpp.
Jian Li
Comment 22
2010-06-09 13:24:43 PDT
Comment on
attachment 58205
[details]
Patch
> > LayoutTests/ChangeLog:14 > > + (moveMouseToCenterOfElement): > > No need to show these new methods in js. > > > > This is the output from prepare-ChangeLog. I felt best to leave it that way.
Yes, this is output from prepare-ChangeLog. But many people choose not to add new methods from the new file. LayoutTests/editing/pasteboard/script-tests/file-drag-to-editable.js:18 + function dragFilesOntoEditableArea(files) { Please move '{' to the beginning of next line. WebCore/platform/android/DragDataAndroid.cpp:71 + bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const It is better to omit the argument name "filenamePolicy" since otherwise it might break other build for "unused parameter". WebCore/platform/android/DragDataAndroid.cpp:76 + String DragData::asURL(FilenameConversionPolicy filenamePolicy, String*) const ditto. WebCore/platform/win/ClipboardUtilitiesWin.cpp:366 + // FIXME: originally, this logic was so dropping files on WebKit would insert the filename. The comment "this logic was so dropping files on WebKit" seems to be hard to understand. Could you please rephrase it? WebCore/platform/win/ClipboardUtilitiesWin.h:64 + String getURL(IDataObject*, DragData::FilenameConversionPolicy filenamePolicy, bool& success, String* title = 0); The argument name filenamePolicy can be omitted per coding style guideline.
Daniel Cheng
Comment 23
2010-06-09 13:39:54 PDT
Created
attachment 58289
[details]
Patch
Daniel Cheng
Comment 24
2010-06-09 13:41:29 PDT
(In reply to
comment #22
)
> (From update of
attachment 58205
[details]
) > > > LayoutTests/ChangeLog:14 > > > + (moveMouseToCenterOfElement): > > > No need to show these new methods in js. > > > > > > > This is the output from prepare-ChangeLog. I felt best to leave it that way. > Yes, this is output from prepare-ChangeLog. But many people choose not to add new methods from the new file. >
Done.
> LayoutTests/editing/pasteboard/script-tests/file-drag-to-editable.js:18 > + function dragFilesOntoEditableArea(files) { > Please move '{' to the beginning of next line. >
Done.
> WebCore/platform/android/DragDataAndroid.cpp:71 > + bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const > It is better to omit the argument name "filenamePolicy" since otherwise it might break other build for "unused parameter". >
Done.
> WebCore/platform/android/DragDataAndroid.cpp:76 > + String DragData::asURL(FilenameConversionPolicy filenamePolicy, String*) const > ditto. >
Done.
> WebCore/platform/win/ClipboardUtilitiesWin.cpp:366 > + // FIXME: originally, this logic was so dropping files on WebKit would insert the filename. > The comment "this logic was so dropping files on WebKit" seems to be hard to understand. Could you please rephrase it? >
Done.
> WebCore/platform/win/ClipboardUtilitiesWin.h:64 > + String getURL(IDataObject*, DragData::FilenameConversionPolicy filenamePolicy, bool& success, String* title = 0); > The argument name filenamePolicy can be omitted per coding style guideline.
Done.
Jian Li
Comment 25
2010-06-09 15:04:08 PDT
Comment on
attachment 58289
[details]
Patch r=me
WebKit Commit Bot
Comment 26
2010-06-10 07:31:45 PDT
Comment on
attachment 58289
[details]
Patch Clearing flags on attachment: 58289 Committed
r60957
: <
http://trac.webkit.org/changeset/60957
>
WebKit Commit Bot
Comment 27
2010-06-10 07:31:54 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug