WebKit/win:
authorkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2007 22:16:56 +0000 (22:16 +0000)
committerkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2007 22:16:56 +0000 (22:16 +0000)
        Reviewed by Steve.

        - <rdar://5656485> Drosera: Win: Nightly does not reliably connect to
        WebKit.

        - Drosera and Safari need to use the same ProgIDs in order for
        CoCreateInstance to work properly.  The most robust way to do this is
        for WebKit to dynamically publish those ProgIDs.

        * ForEachCoClass.cpp: Added.
        (setUseOpenSourceWebKit):
        (progIDForClass):
        * ForEachCoClass.h: Added functionality to publish ProgIDs.
        * WebKit.vcproj/WebKit.def: Exposed added functions for applications.
        * WebKit.vcproj/WebKit.vcproj: Added ForEachCoClass.cpp
        * WebKit.vcproj/WebKit_debug.def: Exposed added functions fori
        applications.

WebKitTools:

        Reviewed by Steve.

        - <rdar://5656485> Drosera: Win: Nightly does not reliably connect to
        WebKit.

        - Drosera and Safari need to use the same ProgIDs in order for
        CoCreateInstance to work properly.  The most robust way to do this is
        for WebKit to dynamically publish those ProgIDs.

        * Drosera/win/DebuggerClient.cpp: Use the published ProgIDs
        (DebuggerClient::createWebViewWithRequest):
        * Drosera/win/Drosera.cpp: Use the published ProgIDs and rename some
        statics.
        (Drosera::initUI):
        (Drosera::attach):
        (Drosera::attemptToCreateServerConnection):
        * Drosera/win/Drosera.vcproj/Drosera.vcproj: Fix a runtime failure.
        * Drosera/win/ServerConnection.cpp: Reformat the connection function and
        make use of the published ProgIDs.
        (ServerConnection::attemptToCreateServerConnection):

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

WebKit/win/ChangeLog
WebKit/win/ForEachCoClass.cpp [new file with mode: 0755]
WebKit/win/ForEachCoClass.h
WebKit/win/WebKit.vcproj/WebKit.def
WebKit/win/WebKit.vcproj/WebKit.vcproj
WebKit/win/WebKit.vcproj/WebKit_debug.def
WebKitTools/ChangeLog
WebKitTools/Drosera/win/DebuggerClient.cpp
WebKitTools/Drosera/win/Drosera.cpp
WebKitTools/Drosera/win/Drosera.vcproj/Drosera.vcproj
WebKitTools/Drosera/win/ServerConnection.cpp

index fcf30a756607ba927cabfbec5daf110a5e237466..2556a676366f8a8bff6b0fa2dea9f512cdcb4538 100644 (file)
@@ -1,3 +1,23 @@
+2007-12-20  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Steve.
+
+        - <rdar://5656485> Drosera: Win: Nightly does not reliably connect to 
+        WebKit.
+
+        - Drosera and Safari need to use the same ProgIDs in order for
+        CoCreateInstance to work properly.  The most robust way to do this is
+        for WebKit to dynamically publish those ProgIDs.
+
+        * ForEachCoClass.cpp: Added.
+        (setUseOpenSourceWebKit):
+        (progIDForClass):
+        * ForEachCoClass.h: Added functionality to publish ProgIDs.
+        * WebKit.vcproj/WebKit.def: Exposed added functions for applications.
+        * WebKit.vcproj/WebKit.vcproj: Added ForEachCoClass.cpp
+        * WebKit.vcproj/WebKit_debug.def: Exposed added functions fori
+        applications.
+
 2007-12-19  Dave Hyatt <hyatt@apple.com>
 
         Add a fourth preference value for GDI text in the font smoothing prefs.
diff --git a/WebKit/win/ForEachCoClass.cpp b/WebKit/win/ForEachCoClass.cpp
new file mode 100755 (executable)
index 0000000..edc6a45
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "ForEachCoClass.h"
+
+#include <JavaScriptCore/Assertions.h>
+
+void setUseOpenSourceWebKit(bool b)
+{
+    s_progIDs = b ? openSourceProgIDs : productionProgIDs;
+}
+
+LPCOLESTR progIDForClass(WebKitClass cls)
+{
+    ASSERT(cls < WebKitClassSentinel);
+    return s_progIDs[cls];
+}
+
+
index 50e6c648b5756d310fb4503d7056b0a75eefe345..c290353180e7ece092bb49106f4a70ed678a7561 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef ForEachCoClass_h
 #define ForEachCoClass_h
 
+#include <WebKit/ProgIDMacros.h>
+
 #define FOR_EACH_COCLASS(macro) \
     macro(CFDictionaryPropertyBag) \
     macro(WebCache) \
     macro(WebView) \
     // end of macro
 
+#define WEBKITCLASS_MEMBER(cls) cls##Class,
+enum WebKitClass {
+    FOR_EACH_COCLASS(WEBKITCLASS_MEMBER)
+    WebKitClassSentinel
+};
+#undef WEBKITCLASS_MEMBER
+
+#define PRODUCTION_PROGID(cls) VERSION_INDEPENDENT_PRODUCTION_PROGID(cls),
+static LPCOLESTR productionProgIDs[WebKitClassSentinel] = {
+    FOR_EACH_COCLASS(PRODUCTION_PROGID)
+};
+#undef PRODUCTION_PROGID
+
+#define OPENSOURCE_PROGID(cls) VERSION_INDEPENDENT_OPENSOURCE_PROGID(cls),
+static LPCOLESTR openSourceProgIDs[WebKitClassSentinel] = {
+    FOR_EACH_COCLASS(OPENSOURCE_PROGID)
+};
+#undef OPENSOURCE_PROGID
+
+#if __PRODUCTION__
+    static LPCOLESTR* s_progIDs = productionProgIDs;
+#else
+    static LPCOLESTR* s_progIDs = openSourceProgIDs;
+#endif
+
+#define PROGID(className) progIDForClass(className##Class)
+
+void setUseOpenSourceWebKit(bool);
+LPCOLESTR progIDForClass(WebKitClass);
+
+
+
 #endif // !defined(ForEachCoClass_h)
index b477654a16bcf35c913381fe65e38a175262e52d..539a018b3707b25b9b3cb0be081deb50e80988c0 100644 (file)
@@ -88,6 +88,8 @@ EXPORTS
 ;      KJS_JSObject_JSObjectSetMember
 ;      KJS_JSObject_JSObjectSetSlot
 ;      KJS_JSObject_JSObjectToString
+        setUseOpenSourceWebKit
+        progIDForClass
         WebLocalizedStringUTF8
         WebLocalizedLPCTSTRUTF8
         DrawTextAtPoint
index 055c4790cf9b17edded72249c8c2545266ea607b..47096f1bc8005a024ff7214a459c196f9ea7a1cf 100644 (file)
                                RelativePath="..\DOMHTMLClasses.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\ForEachCoClass.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\HTTPHeaderPropertyBag.cpp"\r
                                >\r
index 74fb9def8689acf6fde0bf4383b53dd1bfd27536..ff5c0ea9b2378d973b3a29fc80155f3b2b3dffb9 100644 (file)
@@ -88,6 +88,8 @@ EXPORTS
 ;       KJS_JSObject_JSObjectSetMember
 ;       KJS_JSObject_JSObjectSetSlot
 ;       KJS_JSObject_JSObjectToString
+        setUseOpenSourceWebKit
+        progIDForClass
         WebLocalizedStringUTF8
         WebLocalizedLPCTSTRUTF8
         DrawTextAtPoint
index db0a0f1f796c12f386ea6c10c6df9be9a330d5e8..34952a075572a09e2e3c8604f446f7c25f2388ab 100644 (file)
@@ -1,3 +1,26 @@
+2007-12-20  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Steve.
+
+        - <rdar://5656485> Drosera: Win: Nightly does not reliably connect to
+        WebKit.
+
+        - Drosera and Safari need to use the same ProgIDs in order for
+        CoCreateInstance to work properly.  The most robust way to do this is
+        for WebKit to dynamically publish those ProgIDs.
+
+        * Drosera/win/DebuggerClient.cpp: Use the published ProgIDs
+        (DebuggerClient::createWebViewWithRequest):
+        * Drosera/win/Drosera.cpp: Use the published ProgIDs and rename some
+        statics.
+        (Drosera::initUI):
+        (Drosera::attach):
+        (Drosera::attemptToCreateServerConnection):
+        * Drosera/win/Drosera.vcproj/Drosera.vcproj: Fix a runtime failure.
+        * Drosera/win/ServerConnection.cpp: Reformat the connection function and
+        make use of the published ProgIDs.
+        (ServerConnection::attemptToCreateServerConnection):
+
 2007-12-20  Kevin McCullough  <kmccullough@apple.com>
 
         - <rdar://problem/5658317> REGRESSION: 20+ leaks seen on buildbots.
index 713ff3d807eb6944fdeb263c8b36de9327fc5263..b15c61d9837faf9da3cd0d79f4f249310f6f5a52 100644 (file)
@@ -32,6 +32,7 @@
 #include "Drosera.h"
 #include "ServerConnection.h"
 
+#include <WebKit/ForEachCoClass.h>
 #include <WebKit/IWebView.h>
 #include <WebKit/IWebViewPrivate.h>
 #include <WebKit/WebKit.h>
@@ -222,8 +223,13 @@ HRESULT STDMETHODCALLTYPE DebuggerClient::createWebViewWithRequest(
     if (FAILED(ret))
         return ret;
 
+    CLSID clsid = CLSID_NULL;
+    ret = CLSIDFromProgID(PROGID(WebView), &clsid);
+    if (FAILED(ret))
+        return ret;
+
     COMPtr<IWebView> view;
-    ret = CoCreateInstance(CLSID_WebView, 0, CLSCTX_ALL, IID_IWebView, (void**)&view);
+    ret = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IWebView, (void**)&view);
     if (FAILED(ret))
         return ret;
 
index f2de412415cf595f772fa4b2f1b3f63d710672d0..5e35c8c422ad7556c38d6ea6d99739439e0aa55a 100644 (file)
@@ -35,6 +35,7 @@
 #include "ServerConnection.h"
 
 #include <JavaScriptCore/JSStringRef.h>
+#include <WebKit/ForEachCoClass.h>
 #include <WebKit/IWebMutableURLRequest.h>
 #include <WebKit/IWebView.h>
 #include <WebKit/WebKit.h>
@@ -45,8 +46,7 @@ const unsigned MAX_LOADSTRING = 100;
 TCHAR szTitle[MAX_LOADSTRING];                  // The title bar text
 TCHAR szWindowClass[MAX_LOADSTRING];            // the main window class name
 
-static const LRESULT kNotHandledResult = -1;
-static LPCTSTR kDroseraPointerProp = TEXT("DroseraPointer");
+static LPCTSTR s_DroseraPointerProp = TEXT("DroseraPointer");
 static HINSTANCE hInst;
 
 BSTR cfStringToBSTR(CFStringRef cfstr);
@@ -259,7 +259,12 @@ HRESULT Drosera::initUI(HINSTANCE hInstance, int nCmdShow)
     if (FAILED(ret))
         return ret;
 
-    ret = CoCreateInstance(CLSID_WebView, 0, CLSCTX_ALL, IID_IWebView, (void**)&m_webView);
+    CLSID clsid = CLSID_NULL;
+    ret = CLSIDFromProgID(PROGID(WebView), &clsid);
+    if (FAILED(ret))
+        return ret;
+
+    ret = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IWebView, (void**)&m_webView);
     if (FAILED(ret))
         return ret;
 
@@ -282,7 +287,7 @@ HRESULT Drosera::initUI(HINSTANCE hInstance, int nCmdShow)
     if (FAILED(ret))
         return ret;
 
-    ::SetProp(viewWindow, kDroseraPointerProp, (HANDLE)this);
+    SetProp(viewWindow, s_DroseraPointerProp, (HANDLE)this);
 
     // FIXME: Implement window size/position save/restore
     ShowWindow(m_hWnd, nCmdShow);
@@ -325,8 +330,13 @@ HRESULT Drosera::attach()
     if (FAILED(ret))
         return ret;
 
+    CLSID clsid = CLSID_NULL;
+    ret = CLSIDFromProgID(PROGID(WebMutableURLRequest), &clsid);
+    if (FAILED(ret))
+        return ret;
+
     COMPtr<IWebMutableURLRequest> request;
-    ret = CoCreateInstance(CLSID_WebMutableURLRequest, 0, CLSCTX_ALL, IID_IWebMutableURLRequest, (void**)&request);
+    ret = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IWebMutableURLRequest, (void**)&request);
     if (FAILED(ret))
         return ret;
 
index 7386665b2378cded2daa783e7e5478f7214ff551..8ef2dc5fb64447e9bad944eeaa6f3bb97bc5ccf1 100755 (executable)
                                MinimalRebuild="true"\r
                                ExceptionHandling="1"\r
                                BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
+                               RuntimeLibrary="2"\r
                                RuntimeTypeInfo="false"\r
                                UsePrecompiledHeader="2"\r
                                PrecompiledHeaderThrough="DroseraPrefix.h"\r
index 8313ba5a5dc710a81dbeec828a350de8d99699cb..e59c4fce375db567ff0f11786dff6c78ed7f2860 100644 (file)
@@ -36,6 +36,7 @@
 #include <JavaScriptCore/JSRetainPtr.h>
 #include <JavaScriptCore/JSStringRefBSTR.h>
 #include <JavaScriptCore/RetainPtr.h>
+#include <WebKit/ForEachCoClass.h>
 #include <WebKit/IWebScriptCallFrame.h>
 #include <WebKit/IWebScriptDebugServer.h>
 #include <WebKit/WebKit.h>
@@ -62,20 +63,26 @@ ServerConnection::~ServerConnection()
 void ServerConnection::attemptToCreateServerConnection(JSGlobalContextRef globalContextRef)
 {
     COMPtr<IWebScriptDebugServer> tempServer;
-    if (SUCCEEDED(CoCreateInstance(CLSID_WebScriptDebugServer, 0, CLSCTX_LOCAL_SERVER, IID_IWebScriptDebugServer, (void**)&tempServer))) {
-        if (FAILED(tempServer->sharedWebScriptDebugServer(&m_server)))
-            return;
 
-        if (FAILED(m_server->addListener(this))) {
-            m_server = 0;
-            return;
-        }
+    CLSID clsid = CLSID_NULL;
+    if (FAILED(CLSIDFromProgID(PROGID(WebScriptDebugServer), &clsid)))
+        return;
+
+    if (FAILED(CoCreateInstance(clsid, 0, CLSCTX_LOCAL_SERVER, IID_IWebScriptDebugServer, (void**)&tempServer)))
+        return;
 
-        m_serverConnected = true;
+    if (FAILED(tempServer->sharedWebScriptDebugServer(&m_server)))
+        return;
 
-        if (globalContextRef)
-            m_globalContext = JSGlobalContextRetain(globalContextRef);
+    if (FAILED(m_server->addListener(this))) {
+        m_server = 0;
+        return;
     }
+
+    m_serverConnected = true;
+
+    if (globalContextRef)
+        m_globalContext = JSGlobalContextRetain(globalContextRef);
 }
 
 void ServerConnection::setGlobalContext(JSGlobalContextRef globalContextRef)