Re: [webkit-dev] How is JSConsole used/accessible in current webkit?

2008-03-19 Thread Richard Bailey
Thanks for the responses, I should have been more clear in my request.  From
within my own browser code how can I use JSConsole?  Is the Safari browser
code availible for reference?
Thanks for your guidance,
Richard



On Tue, Mar 18, 2008 at 8:54 PM, Timothy Hatcher <[EMAIL PROTECTED]>
wrote:

>  In Safari 3.1 you can enable the Web Inspector from Safari's Advanced
> preferences with the "Show Develop menu" checkbox.
>
>   On Mar 18, 2008, at 6:47 PM, Maciej Stachowiak wrote:
>
>
> On Mar 18, 2008, at 5:44 PM, Richard Bailey wrote:
>
> I've been reading through the code and seem to be missing how I can
>
> activate JSConsole.
>
>
> It is functioning, or disabled in current webkit?
>
>
> If you use Safari 3.1 with a WebKit nightly, the Web Inspector's
> console will be used as the JS error console.
>
> Regards,
> Maciej
>
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
>  — Timothy Hatcher
>
>
>
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] How is JSConsole used/accessible in current webkit?

2008-03-18 Thread Richard Bailey
I've been reading through the code and seem to be missing how I can activate
JSConsole.

It is functioning, or disabled in current webkit?

Richard
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Need advise and code review for use of JSAPI to read and write html values from C++

2008-03-18 Thread Richard Bailey
I looked for but did not find samples for doing this.  If I missed such
samples and documentation, please send me links.

The code below is my first draft (compiled and verified) to read and write
values from an HTML page.

I appreciate any suggestions you can offer.

Also, is the JS API the best route to use?

Thanks!
Richard


static JSValueRef myMesssageBox(JSContextRef ctx, JSObjectRef /*function*/,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
JSValueRef* /*exception*/)
{
JSValueRef undefined = JSValueMakeUndefined(ctx);

MessageBox( NULL, TEXT("Test"), TEXT("test2"), MB_OK);
return undefined;
}

static JSValueRef myTestReadPageData(JSContextRef ctx, JSObjectRef
/*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef
arguments[], JSValueRef* /*exception*/)
{
JSValueRef undefined = JSValueMakeUndefined(ctx);

const char* const script =
" document.getElementById('editableText').innerHTML;\
";

JSStringRef scriptRef = JSStringCreateWithUTF8CString(script);

JSValueRef exception = 0;
JSValueRef resultRef = 0;
resultRef = JSEvaluateScript(ctx, scriptRef, 0, 0, 0, &exception);
_ASSERT(!exception);

JSStringRef strResult = JSValueToStringCopy( ctx, resultRef,
&exception);
_ASSERT(!exception);

size_t strLen = JSStringGetLength(strResult);
const JSChar* jsstr = JSStringGetCharactersPtr( strResult);


TCHAR str[MAX_PATH];
wcsncpy( str, jsstr, strLen);
str[strLen] = 0;

MessageBox( NULL, str, TEXT("test2"), MB_OK);
return undefined;
}

static JSValueRef myTestWritePageData(JSContextRef ctx, JSObjectRef
/*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef
arguments[], JSValueRef* /*exception*/)
{
JSValueRef undefined = JSValueMakeUndefined(ctx);

const char* const script =
" document.getElementById('setableText').innerHTML='Text set from CPP';\
";

JSStringRef scriptRef = JSStringCreateWithUTF8CString(script);

JSValueRef exception = 0;
JSValueRef resultRef = 0;
resultRef = JSEvaluateScript(ctx, scriptRef, 0, 0, 0, &exception);
_ASSERT(!exception);

JSStringRef strResult = JSValueToStringCopy( ctx, resultRef,
&exception);
_ASSERT(!exception);

size_t strLen = JSStringGetLength(strResult);
const JSChar* jsstr = JSStringGetCharactersPtr( strResult);


TCHAR str[MAX_PATH];
wcsncpy( str, jsstr, strLen);
str[strLen] = 0;

MessageBox( NULL, str, TEXT("test2"), MB_OK);
return undefined;
}


HRESULT WinPrototypeWebHost::windowScriptObjectAvailable(
/* [in] */ IWebView *webView,
/* [in] */ JSContextRef context,
/* [in] */ JSObjectRef windowScriptObject)
{
if (!m_mainFrame)
return S_OK;

static JSStaticFunction staticFunctions[] = {
{ "MyMessageBox", myMesssageBox, kJSPropertyAttributeNone },
{ "TestReadPageData", myTestReadPageData, kJSPropertyAttributeNone
},
{ "TestWritePageData", myTestWritePageData, kJSPropertyAttributeNone
},
{ 0, 0, 0 }
};

JSClassDefinition myControllerDefinition = {
0, kJSClassAttributeNone, "MyController", 0, 0, staticFunctions,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

JSClassRef controllerClass = JSClassCreate(&myControllerDefinition);
_ASSERT(controllerClass);

m_controllerScriptObject = JSObjectMake(context, controllerClass,
reinterpret_cast(this));
_ASSERT(m_controllerScriptObject);

JSRetainPtr controllerObjectString(Adopt,
JSStringCreateWithUTF8CString("MyController"));
JSObjectSetProperty(context, windowScriptObject,
controllerObjectString.get(), m_controllerScriptObject,
kJSPropertyAttributeNone, 0);

return S_OK;
}
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Build problems on Vista

2008-03-11 Thread Richard Bailey
When I build on Vista I'm getting the following errors in Javascript core

Performing Pre-Build Event...
Project : error PRJ0002 : Error result 1 returned from
'c:\Windows\system32\cmd.exe'.

I tried within VC++2005 hoping to see more error info and found:
1>-- Build started: Project: JavaScriptCoreGenerated, Configuration:
Release Win32 --
1>Performing Makefile project actions
1> set PATH=%PATH%;%SystemDrive%\cygwin\bin
1> touch "C:\Users\Richard\WebKit\Output\buildfailed"
1> bash build-generated-files.sh "C:\Users\Richard\WebKit\Output"
"C:\Users\Richard\WebKit\WebKitLibraries\win"
1>/cygdrive/c/Users/Richard/WebKit/JAVASC~1/pcre/dftables chartables.c
1>/cygdrive/c/Users/Richard/WebKit/JAVASC~1/kjs/create_hash_table
/cygdrive/c/Users/Richard/WebKit/JAVASC~1/kjs/number_object.cpp -i >
number_object.lut.h
1>Creating hashtable for
/cygdrive/c/Users/Richard/WebKit/JAVASC~1/kjs/number_object.cpp
1>Error in tempfile() using /tmp/dftables-.in: Parent directory
(/tmp/) is not writable
1> at /cygdrive/c/Users/Richard/WebKit/JAVASC~1/pcre/dftables line 236
1>make: *** [chartables.c] Error 255
1>make: *** Waiting for unfinished jobs
1>NMAKE : fatal error U1077: 'bash' : return code '0x1'

I had read through the script files, verified disk space and that I could
write to /tmp/ from cygwin prompt.

What is going wrong here?

-Richard
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Vista Install of development tools

2008-03-05 Thread Richard Bailey
wrt. the page: http://webkit.org/building/tools.html

After several attempts to get cygwin to install correctly in Vista, I found
I needed to launch setup.exe by right-clicking and choosing "Run as
Administrator"

After this, the install worked fine.

Is this the apropriate way to report this?

Thanks,
Richard
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev