Bug 53810 - WebKit2 clients fail to launch on Windows if client exe is in a different directory from WebKit
Summary: WebKit2 clients fail to launch on Windows if client exe is in a different dir...
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Steve Falkenburg
Depends on:
Reported: 2011-02-04 14:02 PST by Steve Falkenburg
Modified: 2011-02-04 14:56 PST (History)
2 users (show)

See Also:

Patch (3.57 KB, patch)
2011-02-04 14:07 PST, Steve Falkenburg
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Falkenburg 2011-02-04 14:02:38 PST
WebKit2 clients fail to launch on Windows if client exe is in a different directory from WebKit
Comment 1 Steve Falkenburg 2011-02-04 14:07:38 PST
Created attachment 81284 [details]
Comment 2 WebKit Review Bot 2011-02-04 14:09:03 PST
Attachment 81284 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/win/MainWin.cpp:26:  Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 1 in 3 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Adam Roben (:aroben) 2011-02-04 14:18:51 PST
Comment on attachment 81284 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=81284&action=review

> Source/WebKit2/win/MainWin.cpp:50
> +    ::GetModuleFileNameW(0, webKitPath, ARRAYSIZE(webKitPath));

You could also use _countof or WTF_ARRAY_LENGTH. Maybe the latter is best, since it can be used in cross-platform code, too?

> Source/WebKit2/win/MainWin.cpp:57
> +    // set to 0. We want both the WebKit client app DLL path and the WebKit directory DLL path in
> +    // the DLL search order, and we want the current directory set to the WebKit client app path.
> +    ::SetDllDirectoryW(webKitPath);

How does this guarantee that the "client app DLL path" is in the DLL search order, or that the current directory is set to the WebKit client app path?
Comment 4 Steve Falkenburg 2011-02-04 14:36:11 PST
Since we're using ARRAYSIZE directly within a Win32 call, it seems ok to keep.
The file doesn't use any WTF headers now, so this would be the only dependency.

The client app path will be in the search order, since the default use of CreateProcess sets the working directory to the same directory as the launching app. The current directory will be set to that path in the client app by Windows Explorer when it launches that app.
Comment 5 Steve Falkenburg 2011-02-04 14:37:29 PST
Committed r77678: <http://trac.webkit.org/changeset/77678>
Comment 6 Build Bot 2011-02-04 14:56:28 PST
Attachment 81284 [details] did not build on win:
Build output: http://queues.webkit.org/results/7698620