[webkit-dev] Executing stand alone Javascipt without HTML

guru prasad guru_webkit at in.com
Thu Jul 9 03:03:39 PDT 2009


Hi All, We are using webkit and developing web based application which uses OPENAPI provided by various service provider. We have a javascript as given below test.jsfunction createEvent() { xmlhttp = new XMLHttpRequest();xmlhttp.open("GET", url, true);xmlhttp.send(null);alert("xmlhttp end"); } function eventCreated() {alert("xmlhttp callback"); }As i went through the webkit code and i could execute simple javascript which dosn't have XHR, If XHR is there then result i am getting is "undefined". code.cppJSValueRef CTestScriptAppUi::JSEvaluateScripttestscipt(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception){ JSLock lock;ExecState* exec = toJS(ctx);JSObject* jsThisObject = toJS(thisObject);UString::Rep* scriptRep = toJS(script);UString::Rep* sourceURLRep = sourceURL ? toJS(sourceURL) : NULL;// Interpreter::evaluate sets "this" to the global object if it is NULL//evaluate(const UString& sourceURL, i
 nt startingLineNumber, const UString& code, JSValue* thisV)//JSValue *jsval = new JSValue;Completion completion = exec>dynamicInterpreter()>evaluate(UString(sourceURLRep), startingLineNumber, UString(scriptRep), (JSValue *)jsThisObject);if (completion.complType() == Throw) {if (exception)*exception = toRef(completion.value());return 0;}if (completion.value())return toRef(completion.value());// happens, for example, when the only statement is an empty (';') statementreturn toRef(jsUndefined());} To establish a XHR from javascript we need a document. can any one help us for creating document and handling the above script. Any reference url or classes which i need to use. Thanks in Advance, Guru Dear webkitdev! Get Yourself a cool, short @in.com Email ID now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090709/87f34bf8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.js
Type: text/x-c++
Size: 1136 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090709/87f34bf8/attachment.bin>


More information about the webkit-dev mailing list