Fix <rdar://5569268> Crash when opening any FTP site in second tab/window
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 23:45:58 +0000 (23:45 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 23:45:58 +0000 (23:45 +0000)
WebCore:

        Fix <rdar://5569268> Crash when opening any FTP site in second tab/window

        Reviewed by Sam.

        No test possible.

        * platform/win/SharedBufferWin.cpp:
        (WebCore::SharedBuffer::createWithContentsOfFile): Bail if we get an
        empty path, because _wfopen_s will crash if we pass it a null pointer.

WebKit/win:

        Fix <rdar://5569268> Crash when opening any FTP site in second tab/window

        Reviewed by Sam.

        * WebView.cpp:
        (WebView::initWithFrame): Set the ftpDirectoryTemplatePath for every
        Page, not just the first one.

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

WebCore/ChangeLog
WebCore/platform/win/SharedBufferWin.cpp
WebKit/win/ChangeLog
WebKit/win/WebView.cpp

index ab64b6893577b2e69d8d7b5fd7d398a19e487e4d..39f7160bc3edb9a059c8f47e4e70533064ea5174 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-07  Adam Roben  <aroben@apple.com>
+
+        Fix <rdar://5569268> Crash when opening any FTP site in second tab/window
+
+        Reviewed by Sam.
+
+        No test possible.
+
+        * platform/win/SharedBufferWin.cpp:
+        (WebCore::SharedBuffer::createWithContentsOfFile): Bail if we get an
+        empty path, because _wfopen_s will crash if we pass it a null pointer.
+
 2007-11-07  David Kilzer  <ddkilzer@apple.com>
 
         WebKit confuses width/height for Media Queries device-aspect-ratio evaluation
index 2ea0f0547572c1d3da7537e2d531851084def65f..6a5599187ca077def0d07acef032027b0686c65b 100644 (file)
@@ -33,6 +33,9 @@ namespace WebCore {
 \r
 PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath)
 {
+    if (filePath.isEmpty())
+        return 0;
+
     String nullifiedPath = filePath;
     FILE* fileDescriptor = 0;
     if (_wfopen_s(&fileDescriptor, nullifiedPath.charactersWithNullTermination(), TEXT("r+b")) || !fileDescriptor) {
index d5258ab06be197d57134e6a07f1f8ec7b6fddd07..26e348972f871d836a84e2f78d23eec94ca3294b 100644 (file)
@@ -1,3 +1,13 @@
+2007-11-07  Adam Roben  <aroben@apple.com>
+
+        Fix <rdar://5569268> Crash when opening any FTP site in second tab/window
+
+        Reviewed by Sam.
+
+        * WebView.cpp:
+        (WebView::initWithFrame): Set the ftpDirectoryTemplatePath for every
+        Page, not just the first one.
+
 2007-11-06  Adam Roben  <aroben@apple.com>
 
         Change WebLocalizableStrings to take UTF-8 C strings
index 76743da7c1af0fefd43004993efedf825f56f1da..d1132766d5870a6999ba2fc0b341e9557e4a2a36 100644 (file)
@@ -1981,17 +1981,13 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
     // in FrameLoader::provisionalLoadStarted() doesn't always fail
     m_page->settings()->setUsesPageCache(false);
 
-    // Try to set the FTP Directory template path in WebCore when the first WebView is initialized
-    static bool setFTPDirectoryTemplatePathOnce = false;
-
-    if (!setFTPDirectoryTemplatePathOnce && m_uiDelegate) {
+    if (m_uiDelegate) {
         COMPtr<IWebUIDelegate2> uiDelegate2;
         if (SUCCEEDED(m_uiDelegate->QueryInterface(IID_IWebUIDelegate2, (void**)&uiDelegate2))) {
             BSTR path;
             if (SUCCEEDED(uiDelegate2->ftpDirectoryTemplatePath(this, &path))) {
                 m_page->settings()->setFTPDirectoryTemplatePath(String(path, SysStringLen(path)));
                 SysFreeString(path);
-                setFTPDirectoryTemplatePathOnce = true;
             }
         }
     }