Bug 202894

Summary: [GTK][WebInspector] Support for saving data
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: WebKitGTKAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bugs-noreply, cgarcia
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 204618    
Attachments:
Description Flags
Patch cgarcia: review+, cgarcia: commit-queue-

Philippe Normand
Reported 2019-10-13 08:26:30 PDT
Implementation of WebInspectorProxy::platformSave() is missing.
Attachments
Patch (3.94 KB, patch)
2019-10-13 08:29 PDT, Philippe Normand
cgarcia: review+
cgarcia: commit-queue-
Philippe Normand
Comment 1 2019-10-13 08:29:54 PDT
Carlos Garcia Campos
Comment 2 2019-10-14 00:41:13 PDT
Comment on attachment 380843 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380843&action=review > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:467 > + GTK_WINDOW(gtk_widget_get_toplevel(m_inspectorView)), GTK_FILE_CHOOSER_ACTION_SAVE, "Save", "Cancel")); You need to check the toplevel before using it, you can use WebCore::widgetIsOnscreenToplevelWindow(toplevel) and pass nullptr if it returns false. > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:470 > + gtk_file_chooser_set_do_overwrite_confirmation(chooser, true); TRUE > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:471 > + gtk_file_chooser_set_current_name(chooser, suggestedURL.utf8().data()); This expects a name not a URL. > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:479 > + if (!base64Decode(content, out, Base64ValidatePadding)) Do we want to decode UTF-16 here? > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:486 > + data = content.utf8().data(); We are saving UTF-8 here.
Philippe Normand
Comment 3 2019-10-14 01:53:47 PDT
Comment on attachment 380843 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380843&action=review >> Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:471 >> + gtk_file_chooser_set_current_name(chooser, suggestedURL.utf8().data()); > > This expects a name not a URL. Actually the argument is not an URL, it's a filename. I'll rename it.
Adrian Perez
Comment 4 2019-10-14 02:01:14 PDT
Comment on attachment 380843 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380843&action=review > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:487 > + dataLength = strlen(data); You could use “content.utf8().length()” here instead which is O(1), and avoid the call to strlen() which is O(n).
Philippe Normand
Comment 5 2019-10-14 02:21:22 PDT
Philippe Normand
Comment 6 2019-10-14 02:21:48 PDT
(In reply to Adrian Perez from comment #4) > Comment on attachment 380843 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=380843&action=review > > > Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp:487 > > + dataLength = strlen(data); > > You could use “content.utf8().length()” here instead which is O(1), and avoid > the call to strlen() which is O(n). Indeed, good tip :P
Note You need to log in before you can comment on or make changes to this bug.