Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: Source/bindings/v8/V8AbstractEventListener.cpp

Issue 22893051: Add support for BeforeUnloadEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/V8AbstractEventListener.cpp
diff --git a/Source/bindings/v8/V8AbstractEventListener.cpp b/Source/bindings/v8/V8AbstractEventListener.cpp
index f1f0c8aa7ea2b6925c1c6338417a4a8739945394..0164867d5592525511a5a553144580070e5259ce 100644
--- a/Source/bindings/v8/V8AbstractEventListener.cpp
+++ b/Source/bindings/v8/V8AbstractEventListener.cpp
@@ -37,6 +37,7 @@
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8EventListenerList.h"
#include "bindings/v8/V8HiddenPropertyName.h"
+#include "core/dom/BeforeUnloadEvent.h"
#include "core/dom/Document.h"
#include "core/dom/Event.h"
#include "core/dom/EventNames.h"
@@ -157,8 +158,8 @@ void V8AbstractEventListener::invokeEventHandler(ScriptExecutionContext* context
if (returnValue.IsEmpty())
return;
- if (!returnValue->IsNull() && !returnValue->IsUndefined() && event->storesResultAsString())
- event->storeResult(toWebCoreString(returnValue));
+ if (event->type() == eventNames().beforeunloadEvent && !returnValue->IsNull() && !returnValue->IsUndefined())
arv (Not doing code reviews) 2013/08/23 13:56:49 This doesn't look safe. What if someone dispatches
do-not-use 2013/08/23 14:20:40 Oops, you're right. I believe the most common patt
do-not-use 2013/08/23 14:27:54 Done.
+ static_cast<BeforeUnloadEvent*>(event)->setReturnValue(toWebCoreString(returnValue));
if (m_isAttribute && shouldPreventDefault(returnValue))
event->preventDefault();

Powered by Google App Engine
This is Rietveld 408576698