Bug 134735

Summary: [GTK] Implement webkit_web_view_load_bytes() in WebKit2
Product: WebKit Reporter: Gergely Polonkai <gergely>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: berto, bunhere, cdumez, cgarcia, commit-queue, gustavo, gyuyoung.kim, mrobinson, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch svillar: review+

Gergely Polonkai
Reported 2014-07-08 11:35:05 PDT
It would be nice to have the old webkit_web_view_load_string() function in the WebKit2 API, or provide a way to simulate it.
Attachments
Patch (14.60 KB, patch)
2014-07-10 05:19 PDT, Carlos Garcia Campos
svillar: review+
Carlos Garcia Campos
Comment 1 2014-07-10 04:22:06 PDT
load_string() like in webkit1 limits the API to null terminated array of characters, so in this case I would use webkit_web_view_load_bytes() that receives a GBytes. That way we can take a reference and create an API::Data object without duplicating the memory.
Gergely Polonkai
Comment 2 2014-07-10 04:40:46 PDT
How about (for 1.x compatibility reasons) implementing both? _load_string() may internally convert the null-terminated strings into GBytes and call _load_bytes() maybe. I don’t know how hard it would be, even navigating the sources is hard for me as a webkit newbie…
Carlos Garcia Campos
Comment 3 2014-07-10 05:19:20 PDT
WebKit Commit Bot
Comment 4 2014-07-10 05:20:38 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Carlos Garcia Campos
Comment 5 2014-07-10 05:22:30 PDT
(In reply to comment #2) > How about (for 1.x compatibility reasons) implementing both? _load_string() may internally convert the null-terminated strings into GBytes and call _load_bytes() maybe. I don’t know how hard it would be, even navigating the sources is hard for me as a webkit newbie… I think load_string is a confusing name in any case, so in case of adding a new (convenient) API to load a const char, it would be load_data that receives const char + data length. But I think it's very easy for users to simply create a GBytes.
Gustavo Noronha (kov)
Comment 6 2014-07-10 05:45:24 PDT
I agree, wonder how that impacts bindings though, does anyone know if it can be made idiomatic for js and python?
Gustavo Noronha (kov)
Comment 7 2014-07-10 05:50:08 PDT
Comment on attachment 234704 [details] Patch The API looks good to me, fwiw.
Sergio Villar Senin
Comment 8 2014-07-29 04:03:07 PDT
Comment on attachment 234704 [details] Patch The API looks fine to me too.
Carlos Garcia Campos
Comment 9 2014-07-29 04:36:18 PDT
Tim Horton
Comment 10 2014-07-29 08:21:07 PDT
Comment on attachment 234704 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=234704&action=review > Source/WebKit2/ChangeLog:9 > + random data in the web view using the given MIME-Type, encoding Hopefully the data isn't random. Arbitrary?
Carlos Garcia Campos
Comment 11 2014-07-29 08:29:53 PDT
(In reply to comment #10) > (From update of attachment 234704 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=234704&action=review > > > Source/WebKit2/ChangeLog:9 > > + random data in the web view using the given MIME-Type, encoding > > Hopefully the data isn't random. Arbitrary? Oops, yes, you are right, bad english translation in my head.
Note You need to log in before you can comment on or make changes to this bug.