Hi all,
I have an issue in Chrome with absolutely normal script which from time to 
time throw "Uncaught SyntaxError: Unexpected token )".
It happens only when I use our proxy server which decrypt HTTPS traffic for 
me. In DevTools this script looks absolutely normal without any lost or 
wrong symbols in it.
Trying to investigate it further I placed several breakpoints and ended up 
with such stacktrace:

    
v8::internal::ParserBase<v8::internal::ParserTraits>::ReportUnexpectedToken(v8::internal::Token::Value
 
token)
    v8::internal::Parser::ParseFunctionLiteral(const 
v8::internal::AstRawString * function_name, v8::internal::Scanner::Location 
function_name_location, v8::internal::FunctionNameValidity 
function_name_validity, v8::internal::FunctionKind kind, int 
function_token_pos, v8::internal::FunctionLiteral::FunctionType 
function_type, v8::internal::LanguageMode language_mode, bool * ok)
    v8::internal::Parser::ParseLazy(v8::internal::Isolate * isolate, 
v8::internal::ParseInfo * info, v8::internal::Utf16CharacterStream * source)
    v8::internal::Parser::ParseLazy(v8::internal::Isolate * isolate, 
v8::internal::ParseInfo * info)
    v8::internal::Parser::Parse(v8::internal::ParseInfo * info)
    v8::internal::Parser::ParseStatic(v8::internal::ParseInfo * info)
    v8::internal::`anonymous 
namespace'::GetUnoptimizedCodeCommon(v8::internal::CompilationInfo * info)
    v8::internal::`anonymous 
namespace'::GetLazyCode(v8::internal::Handle<v8::internal::JSFunction> 
function)
    
v8::internal::Compiler::Compile(v8::internal::Handle<v8::internal::JSFunction> 
function, v8::internal::Compiler::ClearExceptionFlag flag)
    v8::internal::__RT_impl_Runtime_CompileLazy(v8::internal::Arguments 
args, v8::internal::Isolate * isolate)
    v8::internal::Runtime_CompileLazy(int args_length, v8::internal::Object 
* * args_object, v8::internal::Isolate * isolate)
    [External Code] 
    [Frames below may be incorrect and/or missing] 
    v8::internal::`anonymous namespace'::Invoke(v8::internal::Isolate * 
isolate, bool is_construct, v8::internal::Handle<v8::internal::Object> 
target, v8::internal::Handle<v8::internal::Object> receiver, int argc, 
v8::internal::Handle<v8::internal::Object> * args, 
v8::internal::Handle<v8::internal::Object> new_target)
    v8::internal::Execution::Call(v8::internal::Isolate * isolate, 
v8::internal::Handle<v8::internal::Object> callable, 
v8::internal::Handle<v8::internal::Object> receiver, int argc, 
v8::internal::Handle<v8::internal::Object> * argv)
    v8::Function::Call(v8::Local<v8::Context> context, v8::Local<v8::Value> 
recv, int argc, v8::Local<v8::Value> * argv)
    blink::V8ScriptRunner::callFunction(v8::Local<v8::Function> function, 
blink::ExecutionContext * context, v8::Local<v8::Value> receiver, int argc, 
v8::Local<v8::Value> * args, v8::Isolate * isolate)
    blink::ScriptController::callFunction(blink::ExecutionContext * 
context, v8::Local<v8::Function> function, v8::Local<v8::Value> receiver, 
int argc, v8::Local<v8::Value> * info, v8::Isolate * isolate)
    blink::ScriptController::callFunction(v8::Local<v8::Function> function, 
v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> * info)
    blink::V8EventListener::callListenerFunction(blink::ScriptState * 
scriptState, v8::Local<v8::Value> jsEvent, blink::Event * event)
    blink::V8AbstractEventListener::invokeEventHandler(blink::ScriptState * 
scriptState, blink::Event * event, v8::Local<v8::Value> jsEvent)
    blink::V8AbstractEventListener::handleEvent(blink::ScriptState * 
scriptState, blink::Event * event)
    blink::V8AbstractEventListener::handleEvent(blink::ExecutionContext * 
executionContext, blink::Event * event)
    blink::EventTarget::fireEventListeners(blink::Event * event, 
blink::EventTargetData * d, 
blink::HeapVector<blink::RegisteredEventListener,1> & entry)
    blink::EventTarget::fireEventListeners(blink::Event * event)
    blink::Node::handleLocalEvents(blink::Event & event)
    blink::NodeEventContext::handleLocalEvents(blink::Event & event)
    blink::EventDispatcher::dispatchEventAtTarget()
    blink::EventDispatcher::dispatch()
    blink::EventDispatchMediator::dispatchEvent(blink::EventDispatcher & 
dispatcher)
    blink::EventDispatcher::dispatchEvent(blink::Node & node, 
blink::EventDispatchMediator * mediator)
    blink::Node::dispatchEventInternal(blink::Event * event)

I met several pages with this problem and their stacktrace always looked 
similar. Exception always pointed to something like this:
$(function() {
 // some long and complicated function...
});

>From what I managed to gather now it seems like in 
function Parser::ParseLazy(Isolate* isolate, ParseInfo* info) in parser.cc, 
shared_info->start_position() points to the wrong position. But script text 
is Ok. Unfortunately I don't have reliably working test case for the issue 
so I can't file a bug for it. Just trying to figure out myself. But I don't 
familiar with blink and v8 sources so I need some help. Could you show me 
where to look now? Parser logic rather complicated for me and I'm not quite 
sure that I'll be able to find a correct place where start_position was set.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to