Bug 51616 - [GTK] Can't find webinspector and error page redirection on Windows
Summary: [GTK] Can't find webinspector and error page redirection on Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-26 00:57 PST by Bakhtiar Hasmanan
Modified: 2012-02-19 21:24 PST (History)
2 users (show)

See Also:


Attachments
fix DATADIR path (4.72 KB, patch)
2011-01-20 06:39 PST, Bakhtiar Hasmanan
no flags Details | Formatted Diff | Diff
Patch (6.87 KB, patch)
2012-02-19 10:09 PST, tuxator
no flags Details | Formatted Diff | Diff
Patch updated with Changelog entry (8.58 KB, patch)
2012-02-19 15:12 PST, tuxator
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bakhtiar Hasmanan 2010-12-26 00:57:54 PST
DATA_DIR that use DllMain to find toplevel path only defined in ImageGTK.cpp, other two files affected still return invalid path ($PREFIX): FrameLoaderClientGtk.cpp and InspectorClientGtk.cpp while there should only one DllMain exists.
Comment 1 Bakhtiar Hasmanan 2011-01-10 13:59:25 PST
I found this trick http://stackoverflow.com/questions/2396328/get-hmodule-from-inside-a-dll and I use it like this (in FrameLoaderClientGtk.cpp):

....
#ifdef _WIN32
#  include <shlobj.h>
#  include <assert.h>

static HMODULE GetThisDllHandle()
{
  MEMORY_BASIC_INFORMATION info;
  size_t len = VirtualQueryEx(GetCurrentProcess(), (void*)GetThisDllHandle, &info, sizeof(info));
  assert(len == sizeof(info));
  return len ? (HMODULE)info.AllocationBase : NULL;
}

const gchar *
get_webkit_datadir(void)
{
    gchar *retval;
    retval = g_build_filename (g_win32_get_package_installation_directory_of_module (GetThisDllHandle()), "/share", NULL);
    return retval;
}

#undef DATA_DIR
#define DATA_DIR get_webkit_datadir ()
#endif

....

So far in Win32 it return the correct path, and it doesn't have "initialize once" limitation as DllMain()
Comment 2 Bakhtiar Hasmanan 2011-01-20 06:39:44 PST
Created attachment 79594 [details]
fix DATADIR path

Umm is this patch legal then?
Comment 3 tuxator 2012-02-19 10:09:02 PST
Created attachment 127735 [details]
Patch
Comment 4 tuxator 2012-02-19 15:12:02 PST
Created attachment 127744 [details]
Patch updated with Changelog entry
Comment 5 Martin Robinson 2012-02-19 19:04:58 PST
Comment on attachment 127744 [details]
Patch updated with Changelog entry

Great work.
Comment 6 Bakhtiar Hasmanan 2012-02-19 20:03:18 PST
Thanks pawel
Comment 7 WebKit Review Bot 2012-02-19 21:24:30 PST
Comment on attachment 127744 [details]
Patch updated with Changelog entry

Clearing flags on attachment: 127744

Committed r108206: <http://trac.webkit.org/changeset/108206>
Comment 8 WebKit Review Bot 2012-02-19 21:24:35 PST
All reviewed patches have been landed.  Closing bug.