OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 : V8EventListener(listener, isInline, scriptState) | 49 : V8EventListener(listener, isInline, scriptState) |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 void V8WorkerGlobalScopeEventListener::handleEvent(ScriptState* scriptState, Eve
nt* event) | 53 void V8WorkerGlobalScopeEventListener::handleEvent(ScriptState* scriptState, Eve
nt* event) |
54 { | 54 { |
55 // The callback function on XMLHttpRequest can clear the event listener and
destroys 'this' object. Keep a local reference to it. | 55 // The callback function on XMLHttpRequest can clear the event listener and
destroys 'this' object. Keep a local reference to it. |
56 // See issue 889829. | 56 // See issue 889829. |
57 RefPtr<V8AbstractEventListener> protect(this); | 57 RefPtr<V8AbstractEventListener> protect(this); |
58 | 58 |
59 WorkerScriptController* script = toWorkerGlobalScope(scriptState->executionC
ontext())->script(); | 59 WorkerScriptController* script = toWorkerGlobalScope(scriptState->executionC
ontext())->scriptController(); |
60 if (!script) | 60 if (!script) |
61 return; | 61 return; |
62 | 62 |
63 ScriptState::Scope scope(scriptState); | 63 ScriptState::Scope scope(scriptState); |
64 | 64 |
65 // Get the V8 wrapper for the event object. | 65 // Get the V8 wrapper for the event object. |
66 v8::Local<v8::Value> jsEvent = toV8(event, scriptState->context()->Global(),
isolate()); | 66 v8::Local<v8::Value> jsEvent = toV8(event, scriptState->context()->Global(),
isolate()); |
67 | 67 |
68 invokeEventHandler(scriptState, event, v8::Local<v8::Value>::New(isolate(),
jsEvent)); | 68 invokeEventHandler(scriptState, event, v8::Local<v8::Value>::New(isolate(),
jsEvent)); |
69 } | 69 } |
(...skipping 30 matching lines...) Expand all Loading... |
100 return listener; | 100 return listener; |
101 | 101 |
102 EventTarget* target = event->currentTarget(); | 102 EventTarget* target = event->currentTarget(); |
103 v8::Local<v8::Value> value = toV8(target, scriptState->context()->Global(),
isolate()); | 103 v8::Local<v8::Value> value = toV8(target, scriptState->context()->Global(),
isolate()); |
104 if (value.IsEmpty()) | 104 if (value.IsEmpty()) |
105 return v8::Local<v8::Object>(); | 105 return v8::Local<v8::Object>(); |
106 return v8::Local<v8::Object>::New(isolate(), v8::Local<v8::Object>::Cast(val
ue)); | 106 return v8::Local<v8::Object>::New(isolate(), v8::Local<v8::Object>::Cast(val
ue)); |
107 } | 107 } |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |