[Webkit-unassigned] [Bug 89873] New: [WK2][GTK] Implement new API to save a web page using MHTML

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 25 06:05:01 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=89873

           Summary: [WK2][GTK] Implement new API to save a web page using
                    MHTML
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Keywords: Gtk
          Severity: Normal
          Priority: P2
         Component: WebKit Gtk
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: msanchez at igalia.com


It would be great if we could ask a WebKitWebView to save the current web page, and its associated external resources, into a self-contained file we browse later (maybe offline) or send to someone else, for instance.

In this regard, we could initially use the MHTML format[1] (already supported  in WebKit since some time ago [2][3]), but it could probably be good if we did not tied ourselves up into it and left the door open to some other possibilities that might be interesting as well (e.g. embedding external resources as 'data URIs'[4]).

Last, it would be interesting both to have a way to easily save the page into disk (a save_to_file() function) but also a way to receive the serialized page in some other way, so the end application can decide what to do with it.

After talking to Carlos, we think a proposal like this one could make sense:

    typedef enum {
        WEBKIT_SAVE_MODE_MHTML // The only supported 'Save Mode' at the moment
    } WebKitWebViewSaveMode;


    WEBKIT_API void
    webkit_web_view_save                               (WebKitWebView             *web_view,
                                                        WebKitWebViewSaveMode      save_mode,
                                                        GCancellable              *cancellable,
                                                        GAsyncReadyCallback        callback,
                                                        gpointer                   user_data);

    WEBKIT_API GInputStream*
    webkit_web_view_save_finish                        (WebKitWebView             *web_view,
                                                        GAsyncResult              *result,
                                                        GError                   **error);

    WEBKIT_API void
    webkit_web_view_save_to_file                       (WebKitWebView             *web_view,
                                                        const gchar               *filepath,
                                                        WebKitWebViewSaveMode      save_mode,
                                                        GCancellable              *cancellable,
                                                        GAsyncReadyCallback        callback,
                                                        gpointer                   user_data);

    WEBKIT_API gboolean
    webkit_web_view_save_to_file_finish                (WebKitWebView             *web_view,
                                                        GAsyncResult              *result,
                                                        GError                   **error)


I will send a mail to webkit-gtk ML and will start attaching patches soon.

[1] http://en.wikipedia.org/wiki/MHTML
[2] https://bugs.webkit.org/show_bug.cgi?id=7168
[3] https://bugs.webkit.org/show_bug.cgi?id=7169
[4] http://en.wikipedia.org/wiki/Data_URI_scheme

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list