Web Inspector: Saving files should not suggest the top level directory
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Mar 2017 23:37:40 +0000 (23:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Mar 2017 23:37:40 +0000 (23:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170085
<rdar://problem/30197794>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-03-27
Reviewed by Matt Baker.

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::save):
Don't set panel.directoryURL unless we have a good suggestion.

Source/WebKit2:

* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(WebKit::RemoteWebInspectorProxy::platformSave):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformSave):
Don't set panel.directoryURL unless we have a good suggestion.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@214442 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/RemoteWebInspectorProxyMac.mm
Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

index 02bbdcf..4c917d3 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Saving files should not suggest the top level directory
+        https://bugs.webkit.org/show_bug.cgi?id=170085
+        <rdar://problem/30197794>
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorFrontendClient::save):
+        Don't set panel.directoryURL unless we have a good suggestion.
+
 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop
index 6c8844d..54dc27f 100644 (file)
@@ -329,7 +329,12 @@ void WebInspectorFrontendClient::save(const String& suggestedURL, const String&
 
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.nameFieldStringValue = platformURL.lastPathComponent;
-    panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
+
+    // If we have a file URL we've already saved this file to a path and
+    // can provide a good directory to show. Otherwise, use the system's
+    // default behavior for the initial directory to show in the dialog.
+    if (platformURL.isFileURL)
+        panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
 
     auto completionHandler = ^(NSInteger result) {
         if (result == NSModalResponseCancel)
index 35eba05..218b208 100644 (file)
@@ -1,3 +1,17 @@
+2017-03-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Saving files should not suggest the top level directory
+        https://bugs.webkit.org/show_bug.cgi?id=170085
+        <rdar://problem/30197794>
+
+        Reviewed by Matt Baker.
+
+        * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
+        (WebKit::RemoteWebInspectorProxy::platformSave):
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformSave):
+        Don't set panel.directoryURL unless we have a good suggestion.
+
 2017-03-27  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         Add delegate method to let an WebKit client provide a custom image preview controller.
index 6bef4b8..263af8f 100644 (file)
@@ -179,7 +179,12 @@ void RemoteWebInspectorProxy::platformSave(const String& suggestedURL, const Str
 
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.nameFieldStringValue = platformURL.lastPathComponent;
-    panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
+
+    // If we have a file URL we've already saved this file to a path and
+    // can provide a good directory to show. Otherwise, use the system's
+    // default behavior for the initial directory to show in the dialog.
+    if (platformURL.isFileURL)
+        panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
 
     auto completionHandler = ^(NSInteger result) {
         if (result == NSModalResponseCancel)
index 84bf4e9..dbd4042 100644 (file)
@@ -460,7 +460,12 @@ void WebInspectorProxy::platformSave(const String& suggestedURL, const String& c
 
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.nameFieldStringValue = platformURL.lastPathComponent;
-    panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
+
+    // If we have a file URL we've already saved this file to a path and
+    // can provide a good directory to show. Otherwise, use the system's
+    // default behavior for the initial directory to show in the dialog.
+    if (platformURL.isFileURL)
+        panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
 
     auto completionHandler = ^(NSInteger result) {
         if (result == NSModalResponseCancel)