OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 V8WorkerContextErrorHandler::V8WorkerContextErrorHandler(v8::Local<v8::Object> l
istener, bool isInline) | 42 V8WorkerContextErrorHandler::V8WorkerContextErrorHandler(v8::Local<v8::Object> l
istener, bool isInline) |
43 : V8WorkerContextEventListener(listener, isInline) | 43 : V8WorkerContextEventListener(listener, isInline) |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 v8::Local<v8::Value> V8WorkerContextErrorHandler::callListenerFunction(ScriptExe
cutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event) | 47 v8::Local<v8::Value> V8WorkerContextErrorHandler::callListenerFunction(ScriptExe
cutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event) |
48 { | 48 { |
49 ASSERT(event->hasInterface(eventNames().interfaceForErrorEvent)); | 49 ASSERT(event->hasInterface(eventNames().interfaceForErrorEvent)); |
50 v8::Local<v8::Object> listener = getListenerObject(context); | 50 v8::Local<v8::Object> listener = getListenerObject(context); |
51 v8::Isolate* isolate = toV8Context(context, worldContext())->GetIsolate(); | 51 v8::Isolate* isolate = toV8Context(context, world())->GetIsolate(); |
52 v8::Local<v8::Value> returnValue; | 52 v8::Local<v8::Value> returnValue; |
53 if (!listener.IsEmpty() && listener->IsFunction()) { | 53 if (!listener.IsEmpty() && listener->IsFunction()) { |
54 ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event); | 54 ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event); |
55 v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(lis
tener); | 55 v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(lis
tener); |
56 v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global(); | 56 v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global(); |
57 v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message(),
isolate), v8String(errorEvent->filename(), isolate), v8Integer(errorEvent->linen
o(), isolate) }; | 57 v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message(),
isolate), v8String(errorEvent->filename(), isolate), v8Integer(errorEvent->linen
o(), isolate) }; |
58 V8RecursionScope recursionScope(context); | 58 V8RecursionScope recursionScope(context); |
59 returnValue = callFunction->Call(thisValue, 3, parameters); | 59 returnValue = callFunction->Call(thisValue, 3, parameters); |
60 } | 60 } |
61 return returnValue; | 61 return returnValue; |
62 } | 62 } |
63 | 63 |
64 bool V8WorkerContextErrorHandler::shouldPreventDefault(v8::Local<v8::Value> retu
rnValue) | 64 bool V8WorkerContextErrorHandler::shouldPreventDefault(v8::Local<v8::Value> retu
rnValue) |
65 { | 65 { |
66 return returnValue->IsBoolean() && returnValue->BooleanValue(); | 66 return returnValue->IsBoolean() && returnValue->BooleanValue(); |
67 } | 67 } |
68 | 68 |
69 } // namespace WebCore | 69 } // namespace WebCore |
OLD | NEW |