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 177801
Use blob URL when pasting RTFD instead of overriding DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=177801
Summary
Use blob URL when pasting RTFD instead of overriding DocumentLoader
Ryosuke Niwa
Reported
2017-10-03 01:01:40 PDT
Right now, the pasted content’s subresources are loaded by overriding document loader. This is extremely hacky way of making paste work, and websites can’t access those sub resources. Use blob URL instead.
Attachments
Fixes the bug
(26.46 KB, patch)
2017-10-03 01:26 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed builds
(26.43 KB, patch)
2017-10-03 11:45 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed GTK+ builds
(27.26 KB, patch)
2017-10-03 11:49 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Patch for landing
(26.23 KB, patch)
2017-10-04 02:05 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2017-10-03 01:02:03 PDT
<
rdar://problem/34542270
>
Ryosuke Niwa
Comment 2
2017-10-03 01:26:54 PDT
Created
attachment 322500
[details]
Fixes the bug
Ryosuke Niwa
Comment 3
2017-10-03 11:45:18 PDT
Created
attachment 322554
[details]
Fixed builds
Ryosuke Niwa
Comment 4
2017-10-03 11:49:04 PDT
Created
attachment 322555
[details]
Fixed GTK+ builds
Wenson Hsieh
Comment 5
2017-10-04 00:39:07 PDT
Comment on
attachment 322555
[details]
Fixed GTK+ builds View in context:
https://bugs.webkit.org/attachment.cgi?id=322555&action=review
The general approach looks reasonable to me, but I'm not familiar with loading code at all. Perhaps Chris would have some additional input here?
> Source/WebCore/ChangeLog:10 > + into the document using WebKit fake URL, and DocumentLoader was overridden to return the appropraite
appropraite => appropriate
> Source/WebCore/editing/markup.cpp:128 > + if (element.attributeContainsURL(attribute) && !attribute.value().isEmpty()) {
How would this handle data: URLs, or app: URLs?
> Source/WebCore/editing/markup.cpp:131 > + changes.append(AttributeChange(&element, attribute.name(), replacement));
Nit - { } initialization here?
> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:46 > + [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSRTFDPboardType] owner:nil];
Nit - this would probably be more succinct using @[] instead of +[NSArray arrayWithObject]
> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:61 > + [[UIPasteboard generalPasteboard] setItems:@[[NSDictionary dictionaryWithObject:data forKey:(NSString *)kUTTypeFlatRTFD]]];
Nit - this would probably be more succinct using @{} instead of +[NSDictionary dictionaryWithObject]
> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:72 > + [webView paste:nil];
Did you mean to check that the editable root is empty after this?
Ryosuke Niwa
Comment 6
2017-10-04 02:04:50 PDT
Comment on
attachment 322555
[details]
Fixed GTK+ builds View in context:
https://bugs.webkit.org/attachment.cgi?id=322555&action=review
>> Source/WebCore/editing/markup.cpp:128 >> + if (element.attributeContainsURL(attribute) && !attribute.value().isEmpty()) { > > How would this handle data: URLs, or app: URLs?
They won't be in replacement map since those URLs shouldn't be appearing as sub resources in attributed attributes we just parsed.
>> Source/WebCore/editing/markup.cpp:131 >> + changes.append(AttributeChange(&element, attribute.name(), replacement)); > > Nit - { } initialization here?
Sure.
>> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:46 >> + [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSRTFDPboardType] owner:nil]; > > Nit - this would probably be more succinct using @[] instead of +[NSArray arrayWithObject]
Fixed.
>> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:61 >> + [[UIPasteboard generalPasteboard] setItems:@[[NSDictionary dictionaryWithObject:data forKey:(NSString *)kUTTypeFlatRTFD]]]; > > Nit - this would probably be more succinct using @{} instead of +[NSDictionary dictionaryWithObject]
Fixed.
>> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:72 >> + [webView paste:nil]; > > Did you mean to check that the editable root is empty after this?
No. This test is simply here to make sure WebKit doesn't hit a debug assertion / crash when sharedBuffer is empty in getPasteboardBufferForType.
Ryosuke Niwa
Comment 7
2017-10-04 02:05:44 PDT
Created
attachment 322638
[details]
Patch for landing
Ryosuke Niwa
Comment 8
2017-10-04 02:06:14 PDT
Comment on
attachment 322638
[details]
Patch for landing Wait for EWS.
WebKit Commit Bot
Comment 9
2017-10-04 04:06:18 PDT
Comment on
attachment 322638
[details]
Patch for landing Clearing flags on attachment: 322638 Committed
r222839
: <
http://trac.webkit.org/changeset/222839
>
WebKit Commit Bot
Comment 10
2017-10-04 04:06:20 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