[webkit-dev] WebCore: Exposing exceptions through WebFrameImpl::executeScriptAndReturnValue and ScriptController::executeScript.

Yury Semikhatsky yurys at chromium.org
Wed Dec 22 06:35:01 PST 2010


Hi Tom,

In case of uncaught JS exception returned v8::Handle will always be empty
(v8::Handle<v8::Value>::IsEmpty() will return true) while in case of
successful
evaluation the result is always non-empty. Also uncaught JS exception will
be
reported to the console object(see Console.cpp) which will propagate them
to
InspectorController and ChromeClient.

Thanks,
Yury


On Wed, Dec 22, 2010 at 12:58 PM, Tom Rathbone <tom.rathbone at gmail.com>wrote:

> Hi Guys,
>
> I was wondering if it would be possible to expose v8 exceptions
> through WebFrameImpl::executeScriptAndReturnValue and
> ScriptController::executeScript, perhaps as an output reference
> argument.
>
> The effected methods would be:
>
> v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue(const
> WebScriptSource& source)
> ScriptValue ScriptController::executeScript(const ScriptSourceCode&
> sourceCode, ShouldAllowXSS shouldAllowXSS)
> ScriptValue ScriptController::evaluate(const ScriptSourceCode&
> sourceCode, ShouldAllowXSS shouldAllowXSS)
> v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source,
> Node* node)
>
> If I've read the source correctly V8 exceptions are caught in
> V8Proxy::evaluate and swallowed.  This means clients calling
> executeScriptAndReturnValue have no easy way of determining what went
> wrong or of responding to script errors.
>
> Maybe...
>
> v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue(const
> WebScriptSource& source, bool& exceptionReturned)
>
> If others think these changes are worthwhile then I'll have a go at
> crafting a patch.
>
> Thanks,
>
> Tom.
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20101222/ffda5cab/attachment.html>


More information about the webkit-dev mailing list