Changeset 80240 in webkit


Ignore:
Timestamp:
Mar 3, 2011 8:21:05 AM (13 years ago)
Author:
Adam Roben
Message:

Make Inspector tests work in WebKit2 on Windows

Fixes <http://webkit.org/b/55672> <rdar://problem/9080867> All inspector tests time out or crash on
Windows 7 Release (WebKit2 Tests)

Reviewed by Darin Adler.

Source/WebKit2:

Create the CFBundleRef for WebKit.dll on Windows if needed

  • Shared/win/WebKitBundle.cpp: Added.

(WebKit::createWebKitBundle): Returns a pre-existing bundle, if possible, otherwise creates
and returns a new bundle.
(WebKit::webKitBundle): Creates and caches a bundle, and returns it.

  • Shared/win/WebKitBundle.h: Added.
  • UIProcess/win/WebInspectorProxyWin.cpp:

(WebKit::WebInspectorProxy::inspectorPageURL):

  • WebProcess/WebPage/win/WebInspectorWin.cpp:

(WebKit::WebInspector::localizedStringsURL):
Changed to use webKitBundle() to ensure that the bundle has been created.

  • win/WebKit2.vcproj: Added new files.

Tools:

Look for Windows-style paths when checking whether a test is an Inspector test

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::shouldOpenWebInspector): Also look for backslashes, since that's what we'll get on
Windows.

Location:
trunk
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r80218 r80240  
     12011-03-03  Adam Roben  <aroben@apple.com>
     2
     3        Create the CFBundleRef for WebKit.dll on Windows if needed
     4
     5        WebKit part of <http://webkit.org/b/55672> <rdar://problem/9080867> All inspector tests time
     6        out or crash on Windows 7 Release (WebKit2 Tests)
     7
     8        Reviewed by Darin Adler.
     9
     10        * Shared/win/WebKitBundle.cpp: Added.
     11        (WebKit::createWebKitBundle): Returns a pre-existing bundle, if possible, otherwise creates
     12        and returns a new bundle.
     13        (WebKit::webKitBundle): Creates and caches a bundle, and returns it.
     14
     15        * Shared/win/WebKitBundle.h: Added.
     16
     17        * UIProcess/win/WebInspectorProxyWin.cpp:
     18        (WebKit::WebInspectorProxy::inspectorPageURL):
     19        * WebProcess/WebPage/win/WebInspectorWin.cpp:
     20        (WebKit::WebInspector::localizedStringsURL):
     21        Changed to use webKitBundle() to ensure that the bundle has been created.
     22
     23        * win/WebKit2.vcproj: Added new files.
     24
    1252011-03-03  Peter Kasting  <pkasting@google.com>
    226
  • trunk/Source/WebKit2/Shared/win/WebKitBundle.cpp

    r80237 r80240  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2525
    2626#include "config.h"
    27 #include "WebInspector.h"
     27#include "WebKitBundle.h"
    2828
    29 #if ENABLE(INSPECTOR)
     29#include <CoreFoundation/CFBundle.h>
     30#include <wtf/RetainPtr.h>
     31#include <wtf/StdLibExtras.h>
    3032
    31 #include <wtf/RetainPtr.h>
    32 #include <wtf/text/WTFString.h>
     33extern "C" HINSTANCE gInstance;
    3334
    3435namespace WebKit {
    3536
    36 String WebInspector::localizedStringsURL() const
     37static CFBundleRef createWebKitBundle()
    3738{
    38     RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("localizedStrings"), CFSTR("js"), 0));
    39     if (!localizedStringsURLRef)
    40         return String();
     39    if (CFBundleRef existingBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit"))) {
     40        CFRetain(existingBundle);
     41        return existingBundle;
     42    }
    4143
    42     return String(CFURLGetString(localizedStringsURLRef.get()));
     44    wchar_t dllPathBuffer[MAX_PATH];
     45    DWORD length = ::GetModuleFileNameW(gInstance, dllPathBuffer, WTF_ARRAY_LENGTH(dllPathBuffer));
     46    ASSERT(length && length < WTF_ARRAY_LENGTH(dllPathBuffer));
     47
     48    RetainPtr<CFStringRef> dllPath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(dllPathBuffer), length, kCFAllocatorNull));
     49    RetainPtr<CFURLRef> dllURL(AdoptCF, CFURLCreateWithFileSystemPath(0, dllPath.get(), kCFURLWindowsPathStyle, false));
     50    RetainPtr<CFURLRef> dllDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, dllURL.get()));
     51    RetainPtr<CFURLRef> resourcesDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, dllDirectoryURL.get(), CFSTR("WebKit.resources"), true));
     52
     53    return CFBundleCreate(0, resourcesDirectoryURL.get());
     54}
     55
     56CFBundleRef webKitBundle()
     57{
     58    static CFBundleRef bundle = createWebKitBundle();
     59    ASSERT(bundle);
     60    return bundle;
    4361}
    4462
    4563} // namespace WebKit
    46 
    47 #endif // ENABLE(INSPECTOR)
  • trunk/Source/WebKit2/Shared/win/WebKitBundle.h

    r80237 r80240  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "WebInspector.h"
     26#ifndef WebKitBundle_h
     27#define WebKitBundle_h
    2828
    29 #if ENABLE(INSPECTOR)
    30 
    31 #include <wtf/RetainPtr.h>
    32 #include <wtf/text/WTFString.h>
     29typedef struct __CFBundle* CFBundleRef;
    3330
    3431namespace WebKit {
    3532
    36 String WebInspector::localizedStringsURL() const
    37 {
    38     RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("localizedStrings"), CFSTR("js"), 0));
    39     if (!localizedStringsURLRef)
    40         return String();
    41 
    42     return String(CFURLGetString(localizedStringsURLRef.get()));
    43 }
     33CFBundleRef webKitBundle();
    4434
    4535} // namespace WebKit
    4636
    47 #endif // ENABLE(INSPECTOR)
     37#endif // WebKitBundle_h
  • trunk/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp

    r79274 r80240  
    2929#if ENABLE(INSPECTOR)
    3030
     31#include "WebKitBundle.h"
    3132#include "WebPageProxy.h"
    3233#include "WebView.h"
     
    195196String WebInspectorProxy::inspectorPageURL() const
    196197{
    197     RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
     198    RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
    198199    if (!htmlURLRef)
    199200        return String();
  • trunk/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp

    r76916 r80240  
    2929#if ENABLE(INSPECTOR)
    3030
     31#include "WebKitBundle.h"
    3132#include <wtf/RetainPtr.h>
    3233#include <wtf/text/WTFString.h>
     
    3637String WebInspector::localizedStringsURL() const
    3738{
    38     RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("localizedStrings"), CFSTR("js"), 0));
     39    RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle(), CFSTR("localizedStrings"), CFSTR("js"), 0));
    3940    if (!localizedStringsURLRef)
    4041        return String();
  • trunk/Source/WebKit2/win/WebKit2.vcproj

    r80051 r80240  
    11751175                                </File>
    11761176                                <File
     1177                                        RelativePath="..\Shared\win\WebKitBundle.cpp"
     1178                                        >
     1179                                </File>
     1180                                <File
     1181                                        RelativePath="..\Shared\win\WebKitBundle.h"
     1182                                        >
     1183                                </File>
     1184                                <File
    11771185                                        RelativePath="..\Shared\win\WebURLRequestWin.cpp"
    11781186                                        >
  • trunk/Tools/ChangeLog

    r80237 r80240  
     12011-03-03  Adam Roben  <aroben@apple.com>
     2
     3        Look for Windows-style paths when checking whether a test is an Inspector test
     4
     5        WTR part of <http://webkit.org/b/55672> <rdar://problem/9080867> All inspector tests time
     6        out or crash on Windows 7 Release (WebKit2 Tests)
     7
     8        Reviewed by Darin Adler.
     9
     10        * WebKitTestRunner/TestInvocation.cpp:
     11        (WTR::shouldOpenWebInspector): Also look for backslashes, since that's what we'll get on
     12        Windows.
     13
    1142011-03-03  Adam Roben  <aroben@apple.com>
    215
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r79626 r80240  
    125125static bool shouldOpenWebInspector(const char* pathOrURL)
    126126{
    127     return strstr(pathOrURL, "inspector/");
     127    return strstr(pathOrURL, "inspector/") || strstr(pathOrURL, "inspector\\");
    128128}
    129129
Note: See TracChangeset for help on using the changeset viewer.