Roll out r36245 in hopes of fixing the Windows nightly builds with Safari 3.1.2.
authormrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 7 Sep 2008 08:41:35 +0000 (08:41 +0000)
committermrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 7 Sep 2008 08:41:35 +0000 (08:41 +0000)
Rubber-stamped by Tim Hatcher.

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

WebKit/win/ChangeLog
WebKit/win/ForEachCoClass.cpp
WebKit/win/Interfaces/WebKit.idl

index 44d6d56..a60fcc2 100644 (file)
@@ -1,16 +1,3 @@
-2008-09-06  Steve Falkenburg  <sfalken@apple.com>
-
-        Fix Windows nightlies.
-        
-        Include both nightly and production CLSIDs in our interfaces, type library.
-        Remove COM registration code.
-
-        Reviewed by Dave Hyatt.
-
-        * ForEachCoClass.cpp:
-        (setUseOpenSourceWebKit):
-        * Interfaces/WebKit.idl:
-
 2008-09-05  Dave Hyatt  <hyatt@apple.com>
 
         Add support for runtime switchability of the Aqua look and the native look on Windows.
index 59715b3..1e7b3c6 100644 (file)
 #include "WebKitDLL.h"
 #include "ForEachCoClass.h"
 
+#include <JavaScriptCore/Assertions.h>
+#include <WebCore/COMPtr.h>
+
+#include <tchar.h>
+
+#if __PRODUCTION__
+#define VERSION_INDEPENDENT_PROGID(className) VERSION_INDEPENDENT_PRODUCTION_PROGID(className)
+#else
+#define VERSION_INDEPENDENT_PROGID(className) VERSION_INDEPENDENT_OPENSOURCE_PROGID(className)
+#endif
+#define CURRENT_VERSIONED_PROGID(className) VERSIONED_PROGID(VERSION_INDEPENDENT_PROGID(className), CURRENT_PROGID_VERSION)
+#define VERSIONED_303_PROGID(className) VERSIONED_PROGID(VERSION_INDEPENDENT_PROGID(className), 3)
+
+//key                                                                                       value name              value }
+#define KEYS_FOR_CLASS(cls) \
+{ TEXT("CLSID\\{########-####-####-####-############}"),                                    0,                      TEXT(#cls) }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\InprocServer32"),                    0,                      (LPCTSTR)-1 }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\InprocServer32"),                    TEXT("ThreadingModel"), TEXT("Apartment") }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\ProgID"),                            0,                      CURRENT_VERSIONED_PROGID(cls) }, \
+{ CURRENT_VERSIONED_PROGID(cls),                                                            0,                      TEXT(#cls) }, \
+{ CURRENT_VERSIONED_PROGID(cls) TEXT("\\CLSID"),                                            0,                      TEXT("{########-####-####-####-############}") }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\VersionIndependentProgID"),          0,                      VERSION_INDEPENDENT_PROGID(cls) }, \
+{ VERSION_INDEPENDENT_PROGID(cls),                                                          0,                      TEXT(#cls) }, \
+{ VERSION_INDEPENDENT_PROGID(cls) TEXT("\\CLSID"),                                          0,                      TEXT("{########-####-####-####-############}") }, \
+{ VERSION_INDEPENDENT_PROGID(cls) TEXT("\\CurVer"),                                         0,                      STRINGIFIED_VERSION(CURRENT_PROGID_VERSION) }, \
+{ VERSIONED_303_PROGID(cls),                                                                0,                      TEXT(#cls) },
+// end of macro
+
+static const int gSlotsPerEntry = 11;
+static LPCTSTR gRegTable[][3] = {
+    FOR_EACH_COCLASS(KEYS_FOR_CLASS)
+};
+#undef KEYS_FOR_CLASS
+
+static void substituteGUID(LPTSTR str, const UUID* guid)
+{
+    if (!guid || !str)
+        return;
+
+    TCHAR uuidString[40];
+    _stprintf_s(uuidString, ARRAYSIZE(uuidString), TEXT("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"), guid->Data1, guid->Data2, guid->Data3,
+        guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+
+    LPCTSTR guidPattern = TEXT("########-####-####-####-############");
+    size_t patternLength = _tcslen(guidPattern);
+    size_t strLength = _tcslen(str);    LPTSTR guidSubStr = str;
+    while (strLength) {
+        guidSubStr = _tcsstr(guidSubStr, guidPattern);
+        if (!guidSubStr)
+            break;
+        _tcsncpy(guidSubStr, uuidString, patternLength);
+        guidSubStr += patternLength;
+        strLength -= (guidSubStr - str);
+    }
+}
+
+// deprecated - remove once a registry-free version of Safari has shipped (first major version after 3.1.1)
+static void registerWebKitNightly()
+{
+    // look up server's file name
+    TCHAR szFileName[MAX_PATH];
+    GetModuleFileName(gInstance, szFileName, MAX_PATH);
+
+    typedef HRESULT (WINAPI *RegisterTypeLibForUserPtr)(ITypeLib*, OLECHAR*, OLECHAR*);
+    COMPtr<ITypeLib> typeLib;
+    LoadTypeLibEx(szFileName, REGKIND_NONE, &typeLib);
+    if (RegisterTypeLibForUserPtr registerTypeLibForUser = reinterpret_cast<RegisterTypeLibForUserPtr>(GetProcAddress(GetModuleHandle(TEXT("oleaut32.dll")), "RegisterTypeLibForUser")))
+        registerTypeLibForUser(typeLib.get(), szFileName, 0);
+    else
+        RegisterTypeLib(typeLib.get(), szFileName, 0);
+
+    HKEY userClasses;
+    if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\CLASSES"), 0, KEY_WRITE, &userClasses) != ERROR_SUCCESS)
+        userClasses = 0;
+
+    // register entries from table
+    int nEntries = ARRAYSIZE(gRegTable);
+    HRESULT hr = S_OK;
+    for (int i = 0; SUCCEEDED(hr) && i < nEntries; i++) {
+        LPTSTR pszKeyName   = _tcsdup(gRegTable[i][0]);
+        LPTSTR pszValueName = gRegTable[i][1] ? _tcsdup(gRegTable[i][1]) : 0;
+        LPTSTR allocatedValue   = (gRegTable[i][2] != (LPTSTR)-1) ? _tcsdup(gRegTable[i][2]) : (LPTSTR)-1;
+        LPTSTR pszValue     = allocatedValue;
+
+        if (pszKeyName && pszValue) {
+
+            int clsidIndex = i/gSlotsPerEntry;
+            substituteGUID(pszKeyName, &gRegCLSIDs[clsidIndex]);
+            substituteGUID(pszValueName, &gRegCLSIDs[clsidIndex]);
+
+            // map rogue value to module file name
+            if (pszValue == (LPTSTR)-1)
+                pszValue = szFileName;
+            else
+                substituteGUID(pszValue, &gRegCLSIDs[clsidIndex]);
+
+            // create the key
+            HKEY hkey;
+            LONG err = RegCreateKey(HKEY_CLASSES_ROOT, pszKeyName, &hkey);
+            if (err != ERROR_SUCCESS && userClasses)
+                err = RegCreateKey(userClasses, pszKeyName, &hkey);
+            if (err == ERROR_SUCCESS) {
+                // set the value
+                err = RegSetValueEx(hkey, pszValueName, 0, REG_SZ, (const BYTE*)pszValue, (DWORD) sizeof(pszValue[0])*(_tcslen(pszValue) + 1));
+                RegCloseKey(hkey);
+            }
+        }
+        if (pszKeyName)
+            free(pszKeyName);
+        if (pszValueName)
+            free(pszValueName);
+        if (allocatedValue && allocatedValue != (LPTSTR)-1)
+            free(allocatedValue);
+    }
+
+    if (userClasses)
+        RegCloseKey(userClasses);
+}
+
 // deprecated - do not use - remove once a registry-free version of Safari has shipped (first major version after 3.1.1)
-void setUseOpenSourceWebKit(bool)
+void setUseOpenSourceWebKit(bool b)
 {
+    if (b)
+        registerWebKitNightly();
 }
 
 // deprecated - do not use - remove once a registry-free version of Safari has shipped (first major version after 3.1.1)
index 4748a0a..103652d 100644 (file)
@@ -229,29 +229,30 @@ import "ocidl.idl";
 cpp_quote("void shutDownWebKit();")
 
 [
+#if __PRODUCTION__
     uuid(2a748656-625d-4207-b29f-40c95bfeb3a9),
     helpstring("WebKit " __BUILD_NUMBER_SHORT__ " Type Library"),
+#else
+    uuid(76E5F7F0-18FD-48a2-B549-1159435B513B),
+    helpstring("OpenSourceWebKit " __BUILD_NUMBER_SHORT__ " Type Library"),
+#endif
     version(__TYPELIB_VERSION__)
 ]
+#if __PRODUCTION__
 library WebKit
+#else
+library OpenSourceWebKit
+#endif
 {
     // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
     importlib("STDOLE2.TLB");
 
+#if __PRODUCTION__
     [uuid(d6bca079-f61c-4e1e-b453-32a0477d02e3)]
-    coclass WebView {
-        [default] interface IWebView;
-        interface IWebIBActions;
-        interface IWebViewCSS;
-        interface IWebViewEditing;
-        interface IWebViewUndoableEditing;
-        interface IWebViewEditingActions;
-        interface IWebNotificationObserver;
-        interface IWebViewPrivate;
-    }
-
+#else
     [uuid(4FF47097-3FEA-4b47-AC0E-90725C546490)]
-    coclass WebViewNightly {
+#endif
+    coclass WebView {
         [default] interface IWebView;
         interface IWebIBActions;
         interface IWebViewCSS;
@@ -262,233 +263,210 @@ library WebKit
         interface IWebViewPrivate;
     }
 
+#if __PRODUCTION__
     [uuid(66827ec1-3aef-4241-bac5-f776b44f030f)]
-    coclass WebIconDatabase {
-        [default] interface IWebIconDatabase;
-    }
-
+#else
     [uuid(BE8EE509-9894-44ba-9E2F-E29780BCB25C)]
-    coclass WebIconDatabaseNightly {
+#endif
+    coclass WebIconDatabase {
         [default] interface IWebIconDatabase;
     }
 
+#if __PRODUCTION__
     [uuid(a062ecc3-bb1b-4694-a569-f59e0ad6be0c)]
-    coclass WebMutableURLRequest {
-        [default] interface IWebMutableURLRequest;
-    }
-
+#else
     [uuid(97F3EB52-9EAC-4062-82E1-E5C1E7789DEE)]
-    coclass WebMutableURLRequestNightly {
+#endif
+    coclass WebMutableURLRequest {
         [default] interface IWebMutableURLRequest;
     }
 
+#if __PRODUCTION__
     [uuid(ba590766-0a6f-46c7-b96e-743490d94cb7)]
-    coclass WebNotificationCenter {
-        [default] interface IWebNotificationCenter;
-    }
-
+#else
     [uuid(99B9D99A-060D-4695-8C8F-3AB53156054C)]
-    coclass WebNotificationCenterNightly {
+#endif
+    coclass WebNotificationCenter {
         [default] interface IWebNotificationCenter;
     }
 
+#if __PRODUCTION__
     [uuid(a4b9b45d-949f-4c8c-9b92-6fbfcc1caaa2)]
-    coclass WebHistory {
-        [default] interface IWebHistory;
-    }
-
+#else
     [uuid(4D043991-E844-48b0-8EF7-85FE1AB8829E)]
-    coclass WebHistoryNightly {
+#endif
+    coclass WebHistory {
         [default] interface IWebHistory;
     }
 
+#if __PRODUCTION__
     [uuid(dd653964-4d37-4fb2-9cb6-6a9a97719332)]
-    coclass CFDictionaryPropertyBag {
-        [default] interface IPropertyBag;
-    }
-
+#else
     [uuid(97795891-293D-4855-800E-E21987568537)]
-    coclass CFDictionaryPropertyBagNightly {
+#endif
+    coclass CFDictionaryPropertyBag {
         [default] interface IPropertyBag;
     }
 
+#if __PRODUCTION__
     [uuid(6be190e9-1725-4e4a-88db-6a9fe242c9e5)]
-    coclass WebHistoryItem {
-        [default] interface IWebHistoryItem;
-    }
-
+#else
     [uuid(82F6400A-3CD0-40a3-8EA1-7A23B26D6153)]
-    coclass WebHistoryItemNightly {
+#endif
+    coclass WebHistoryItem {
         [default] interface IWebHistoryItem;
     }
 
+#if __PRODUCTION__
     [uuid(f71071fd-a51b-4b69-9eb6-44374405e80c)]
-    coclass WebCache {
-        [default] interface IWebCache;
-    }
-
+#else
     [uuid(CB0111F6-168B-467e-8613-23AB37D0493E)]
-    coclass WebCacheNightly {
+#endif
+    coclass WebCache {
         [default] interface IWebCache;
     }
 
+#if __PRODUCTION__
     [uuid(1820D883-42FE-4b78-88C8-5456BB19D224)]
-    coclass WebJavaScriptCollector {
-        [default] interface IWebJavaScriptCollector;
-    }
-
+#else
     [uuid(5D911A44-4316-4a02-A2B5-BAE7036357B9)]
-    coclass WebJavaScriptCollectorNightly {
+#endif
+    coclass WebJavaScriptCollector {
         [default] interface IWebJavaScriptCollector;
     }
 
+#if __PRODUCTION__
     [uuid(67B89F90-F778-438b-ABBF-34D1ACBF8651)]
-    coclass WebPreferences {
-        [default] interface IWebPreferences;
-    }
-
+#else
     [uuid(CC914F49-2385-4943-9B3F-E17501383F5B)]
-    coclass WebPreferencesNightly {
+#endif
+    coclass WebPreferences {
         [default] interface IWebPreferences;
     }
 
+#if __PRODUCTION__
     [uuid(E93AA8D7-F362-4a4a-A95D-325906BEB5F0)]
-    coclass WebKitStatistics {
-        [default] interface IWebKitStatistics;
-    }
-
+#else
     [uuid(87689DC6-5F8C-4194-90D5-CE6083837AB5)]
-    coclass WebKitStatisticsNightly {
+#endif
+    coclass WebKitStatistics {
         [default] interface IWebKitStatistics;
     }
 
+#if __PRODUCTION__
     [uuid(6C6AF3F9-36B4-4bf7-8BDE-74DCD4AD75A4)]
-    coclass WebError {
-        [default] interface IWebError;
-    }
-
+#else
     [uuid(319B38AC-2794-47fa-AE18-A14A7576A6D8)]
-    coclass WebErrorNightly {
+#endif
+    coclass WebError {
         [default] interface IWebError;
     }
 
+#if __PRODUCTION__
     [uuid(7433F53B-7FE9-484a-9432-72909457A646)]
-    coclass WebURLCredential {
-        [default] interface IWebURLCredential;
-    }
-
+#else
     [uuid(BCF988AF-9A2F-403f-A1D8-BD815C46401D)]
-    coclass WebURLCredentialNightly {
+#endif
+    coclass WebURLCredential {
         [default] interface IWebURLCredential;
     }
 
+#if __PRODUCTION__
     [uuid(C0F98BD9-3B1C-413d-904A-E2D1453EAF1F)]
-    coclass WebDownload {
-        [default] interface IWebDownload;
-    }
-
+#else
     [uuid(3FE547FC-4EC1-4062-9DE2-9FC3DA0A08FF)]
-    coclass WebDownloadNightly {
+#endif
+    coclass WebDownload {
         [default] interface IWebDownload;
     }
 
+#if __PRODUCTION__
     [uuid(2FB5499A-BB5D-4469-8517-789FEC8FD9BA)]
-    coclass WebURLRequest {
-        [default] interface IWebURLRequest;
-    }
-
+#else
     [uuid(20B9702D-B41F-449b-84FE-3E32DB5D775F)]
-    coclass WebURLRequestNightly {
+#endif
+    coclass WebURLRequest {
         [default] interface IWebURLRequest;
     }
 
+#if __PRODUCTION__
     [uuid(F366A6E8-E43C-4fd4-AAB0-8E6E79C73E6E)]
-    coclass WebURLProtectionSpace {
-        [default] interface IWebURLProtectionSpace;
-    }
-
+#else
     [uuid(41EFBA9A-63E4-4c49-A012-CCC48694D7A5)]
-    coclass WebURLProtectionSpaceNightly {
+#endif
+    coclass WebURLProtectionSpace {
         [default] interface IWebURLProtectionSpace;
     }
 
+#if __PRODUCTION__
     [uuid(24A53AD5-AA9F-44e6-AA22-2C7C250B661A)]
-    coclass WebScrollBar {
-        [default] interface IWebScrollBarPrivate;
-    }
-
+#else
     [uuid(0F34FB95-301F-4ea1-943E-B5E6E6D94121)]
-    coclass WebScrollBarNightly {
+#endif
+    coclass WebScrollBar {
         [default] interface IWebScrollBarPrivate;
     }
 
+#if __PRODUCTION__
     [uuid(715636C4-59E7-4b85-BBC5-B555888787D7)]
-    coclass WebScriptDebugServer {
-        [default] interface IWebScriptDebugServer;
-    }
-
+#else
     [uuid(5BE39DBA-5887-4a69-9157-EBEE96BA3309)]
-    coclass WebScriptDebugServerNightly {
+#endif
+    coclass WebScriptDebugServer {
         [default] interface IWebScriptDebugServer;
     }
 
+#if __PRODUCTION__
     [uuid(AB201196-8DD2-4d45-AEBD-029B6A37AA27)]
-    coclass WebURLResponse {
-        [default] interface IWebURLResponse;
-    }
-
+#else
     [uuid(EA2FCB14-072B-48b5-B9B5-1BBEFBABC7BC)]
-    coclass WebURLResponseNightly {
+#endif
+    coclass WebURLResponse {
         [default] interface IWebURLResponse;
     }
 
+#if __PRODUCTION__
     [uuid(24040cd6-aff4-4a51-9c8b-71539580ee76)]
-    coclass WebTextRenderer {
-        [default] interface IWebTextRenderer;
-    }
-
+#else
     [uuid(1fbff564-5ff4-484f-b3d9-217483f9f5fc)]
-    coclass WebTextRendererNightly {
+#endif
+    coclass WebTextRenderer {
         [default] interface IWebTextRenderer;
     }
 
+#if __PRODUCTION__
     [uuid(C2A1BFC2-1E7C-49fe-8592-D0C7FB440BC0)]
-    coclass WebDatabaseManager {
-        [default] interface IWebDatabaseManager;
-    }
-
+#else
     [uuid(1F7B8CEE-5D74-4974-8A47-C5733B422644)]
-    coclass WebDatabaseManagerNightly {
+#endif
+    coclass WebDatabaseManager {
         [default] interface IWebDatabaseManager;
     }
 
+#if __PRODUCTION__
     [uuid(1B63D781-9BC4-4a04-899F-C4B05BBD3BE5)]
-    coclass WebArchive {
-        [default] interface IWebArchive;
-    }
-
+#else
     [uuid(EE627CCF-0FEC-4557-AAAE-6283FEA2B823)]
-    coclass WebArchiveNightly {
+#endif
+    coclass WebArchive{
         [default] interface IWebArchive;
     }
 
+#if __PRODUCTION__
     [uuid(96B93356-9D61-4b3f-A6CF-A78283AC9649)]
-    coclass WebCoreStatistics {
-        [default] interface IWebCoreStatistics;
-    }
-
+#else
     [uuid(69038EB7-AF7B-4653-BB02-E48DCCC41559)]
-    coclass WebCoreStatisticsNightly {
+#endif
+    coclass WebCoreStatistics{
         [default] interface IWebCoreStatistics;
     }
 
+#if __PRODUCTION__
     [uuid(3F35F332-BB2B-49b3-AEDD-27B317687E07)]
-    coclass WebCookieManager {
-        [default] interface IWebCookieManager;
-    }
-
+#else
     [uuid(38A38A69-E8C7-480b-9AD3-CB75F7ADDF46)]
-    coclass WebCookieManagerNightly {
+#endif
+    coclass WebCookieManager{
         [default] interface IWebCookieManager;
     }
 }