2012년 11월 23일 금요일

[work-around] Using proxy on GTK MiniBrowser

Caveat : This code is not contributable!! Just for local test! :-)

Just export http_proxy on your machine.(bashrc, profile, environment .. whatever)

    diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
    index f17ac6c..bb93511 100644
    --- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
    +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
    @@ -71,6 +71,13 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
         g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
                      SOUP_SESSION_SSL_STRICT, FALSE, NULL);
     
    +    const char *httpProxy = g_getenv("http_proxy");
    +    if (httpProxy) {
    +        SoupURI *proxyUri = soup_uri_new(httpProxy);
    +        g_object_set(session, SOUP_SESSION_PROXY_URI, proxyUri, NULL);
    +        soup_uri_free(proxyUri);
    +    }
    +
         GOwnPtr<char> soupCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL));
         GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(soupCacheDirectory.get(), SOUP_CACHE_SINGLE_USER));
         soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get()));

2012년 11월 15일 목요일

[WebKit] Render code flow when you set src on img tag.

 Aside from setting value via idl interface, rendering has its own flow.

As you can see below, from the loader, RenderObject has callback for its resource change. Then, it will compare the width and height if it really has been changed and trigger setNeedsLayout with relevant value.

1   0x7fa41cac6cd8 WebCore::RenderObject::setNeedsLayout(bool, WebCore::MarkingBehavior)
2   0x7fa41d2d2c47 WebCore::RenderImage::imageDimensionsChanged(bool, WebCore::IntRect const*)
3   0x7fa41d2d2926 WebCore::RenderImage::imageChanged(void*, WebCore::IntRect const*)
4   0x7fa41d346911 WebCore::RenderObject::imageChanged(WebCore::CachedImage*, WebCore::IntRect const*)
5   0x7fa41cf80c42 WebCore::CachedImage::didAddClient(WebCore::CachedResourceClient*)
6   0x7fa41cf869e3 WebCore::CachedResource::addClient(WebCore::CachedResourceClient*)
7   0x7fa41d2d59d9 WebCore::RenderImageResource::setCachedImage(WebCore::CachedImage*)
8   0x7fa41cf2baed WebCore::ImageLoader::updateRenderer()
9   0x7fa41cf2b6a1 WebCore::ImageLoader::notifyFinished(WebCore::CachedResource*)
10  0x7fa41ccef60e WebCore::HTMLImageLoader::notifyFinished(WebCore::CachedResource*)
11  0x7fa41cf861d0 WebCore::CachedResource::checkNotify()
12  0x7fa41cf81eb9 WebCore::CachedImage::data(WTF::PassRefPtr<WebCore::ResourceBuffer>, bool)
13  0x7fa41cf48ca2 WebCore::SubresourceLoader::didFinishLoading(double)
14  0x7fa41cf43fd1 WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double)

How to download webkitgtk-test-fonts archive when you are behind firewall.

As WebKitten, it is unfortunate that I am working behind firewall.
I don't think this is acceptable for web developers.
Anyway, I have no power to get rid of it from my surroundings :-), alternatively here I leave how we can download files, specifically those repositories are not certified.

Easy. Add '--no-check-certificate' option!

wget --no-check-certificate https://github.com/downloads/mrobinson/webkitgtk-test-fonts/webkitgtk-test-fonts-0.0.3.tar.gz

Have fun!

2012년 6월 20일 수요일

When got os error no 38, function not implemented, on emulation environment

I had got an os error no 38, function not implemented, on emulation environment. This was about shared memory. For this, I made a simple test program.

[test.cpp]

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

extern int errno;

int main()
{
    int fd;

    fd = shm_open("/Test/123456789", O_CREAT | O_CLOEXEC | O_RDWR, S_IRUSR | S_IWUSR);

    if (fd == -1)
        fprintf(stderr, "errno[%d] \n", errno);

    return 0;
}

$ gcc test.cpp -lrt
$ ./a.out
errno[38] // usually return 2, path problem

I first thought it is absurd because shm_open function is really basic function provided by glibc. Later, I got realized this was from emulation environment specifically mount problem.

There was '/dev/shm' linked to '/run/...' but actually '/run/...' path wasn't existed. So I mounted '/run' to virtual path on emulator like '/var/tmp/blahblah/run' and solved the problem. You can do like this 'sudo mount -o bind /run /var/tmp/blahblah/run'.

Hope this might help.

2012년 3월 4일 일요일

Setting some environment variables

We can avoid unnecessary conflict between two glib 2.0 (new one vs default) by setting env variables in bashrc.


export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

export LD_INCLUDE_PATH=/usr/local/include:$LD_INCLUDE_PATH

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Using latest libsoup for WebKit EFL

WebKit EFL requires newer version of libsoup 2.4 than default in Ubuntu 11.10
Moreover, libsoup has strong dependency on glib 2.0 and more.
So I am writing here about my latest successful assembling.

2012년 1월 25일 수요일