| Index: webkit/port/bindings/v8/v8_events.cpp
|
| ===================================================================
|
| --- webkit/port/bindings/v8/v8_events.cpp (revision 8470)
|
| +++ webkit/port/bindings/v8/v8_events.cpp (working copy)
|
| @@ -1,10 +1,10 @@
|
| // Copyright (c) 2008, Google Inc.
|
| // All rights reserved.
|
| -//
|
| +//
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| -//
|
| +//
|
| // * Redistributions of source code must retain the above copyright
|
| // notice, this list of conditions and the following disclaimer.
|
| // * Redistributions in binary form must reproduce the above
|
| @@ -14,7 +14,7 @@
|
| // * Neither the name of Google Inc. nor the names of its
|
| // contributors may be used to endorse or promote products derived from
|
| // this software without specific prior written permission.
|
| -//
|
| +//
|
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| @@ -83,6 +83,10 @@
|
|
|
| v8::Handle<v8::Value> jsevent = V8Proxy::EventToV8Object(event);
|
|
|
| + // For compatibility, we store the event object as a property on the window
|
| + // called "event". Because this is the global namespace, we save away any
|
| + // existing "event" property, and then restore it after executing the
|
| + // javascript handler.
|
| v8::Local<v8::String> event_symbol = v8::String::NewSymbol("event");
|
|
|
| // Save the old 'event' property.
|
| @@ -106,6 +110,10 @@
|
| ret = CallListenerFunction(jsevent, event, isWindowEvent);
|
| }
|
|
|
| + // Restore the old event. This must be done for all exit paths through
|
| + // this method.
|
| + context->Global()->Set(event_symbol, saved_evt);
|
| +
|
| if (V8Proxy::HandleOutOfMemory())
|
| ASSERT(ret.IsEmpty());
|
|
|
| @@ -127,9 +135,6 @@
|
| }
|
| }
|
|
|
| - // Restore the old event.
|
| - context->Global()->Set(event_symbol, saved_evt);
|
| -
|
| Document::updateDocumentsRendering();
|
| }
|
|
|
| @@ -145,6 +150,7 @@
|
| }
|
|
|
|
|
| +
|
| V8EventListener::V8EventListener(Frame* frame, v8::Local<v8::Object> listener,
|
| bool html)
|
| : V8AbstractEventListener(frame, html) {
|
|
|