2009-12-03 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Dec 2009 22:10:56 +0000 (22:10 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Dec 2009 22:10:56 +0000 (22:10 +0000)
        Reviewed by Adam Roben.

        ~96 regression tests fail when using QuickTime 7.6 (they pass with QuickTime 7.3)
        https://bugs.webkit.org/show_bug.cgi?id=30256

        Add the QuickTime dll directory to the PATH environment variable so
        inialization can succeed.

        * DumpRenderTree/win/DumpRenderTree.cpp:
        (addQTDirToPATH):
        (initialize):

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp

index 4c899fae01b6da8e154a65f34e4c53d019e78496..934dbe4ec219b9b982db287a89d628d9a5d32cc5 100644 (file)
@@ -1,3 +1,17 @@
+2009-12-03  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Adam Roben.
+
+        ~96 regression tests fail when using QuickTime 7.6 (they pass with QuickTime 7.3)
+        https://bugs.webkit.org/show_bug.cgi?id=30256
+
+        Add the QuickTime dll directory to the PATH environment variable so
+        inialization can succeed.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (addQTDirToPATH):
+        (initialize):
+
 2009-12-03  Shu Chang  <Chang.Shu@nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
index 61a15f892884023a57ffca33c4c01b782cc5efea..bd7f7f4eb561b8cac445d8b6aac5afeada354432 100644 (file)
@@ -201,6 +201,43 @@ static const wstring& fontsPath()
     return path;
 }
 
+static void addQTDirToPATH()
+{
+    static LPCWSTR pathEnvironmentVariable = L"PATH";
+    static LPCWSTR quickTimeKeyName = L"Software\\Apple Computer, Inc.\\QuickTime";
+    static LPCWSTR quickTimeSysDir = L"QTSysDir";
+    static bool initialized;
+
+    if (initialized)
+        return;
+    initialized = true;
+
+    // Get the QuickTime dll directory from the registry. The key can be in either HKLM or HKCU.
+    WCHAR qtPath[MAX_PATH];
+    DWORD qtPathBufferLen = sizeof(qtPath);
+    DWORD keyType;
+    HRESULT result = SHGetValue(HKEY_LOCAL_MACHINE, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen);
+    if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ) {
+        qtPathBufferLen = sizeof(qtPath);
+        result = SHGetValue(HKEY_CURRENT_USER, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen);
+        if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ)
+            return;
+    }
+
+    // Read the current PATH.
+    DWORD pathSize = GetEnvironmentVariableW(pathEnvironmentVariable, 0, 0);
+    Vector<WCHAR> oldPath(pathSize);
+    if (!GetEnvironmentVariable(pathEnvironmentVariable, oldPath.data(), oldPath.size()))
+        return;
+
+    // And add the QuickTime dll.
+    wstring newPath;
+    newPath.append(qtPath);
+    newPath.append(L";");
+    newPath.append(oldPath.data(), oldPath.size());
+    SetEnvironmentVariableW(pathEnvironmentVariable, newPath.data());
+}
+
 #ifdef DEBUG_ALL
 #define WEBKITDLL TEXT("WebKit_debug.dll")
 #else
@@ -263,6 +300,10 @@ static void initialize()
         for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i)
             textRenderer->registerPrivateFont(wstring(resourcesPath + fontsToInstall[i]).c_str());
 
+    // Add the QuickTime dll directory to PATH or QT 7.6 will fail to initialize on systems
+    // linked with older versions of qtmlclientlib.dll.
+    addQTDirToPATH();
+
     // Register a host window
     WNDCLASSEX wcex;