diff --git a/engine/bindings/core/v8/V8AbstractEventListener.cpp b/engine/bindings/core/v8/V8AbstractEventListener.cpp index e023575972d..2d862a0985d 100644 --- a/engine/bindings/core/v8/V8AbstractEventListener.cpp +++ b/engine/bindings/core/v8/V8AbstractEventListener.cpp @@ -37,7 +37,6 @@ #include "bindings/core/v8/V8EventTarget.h" #include "bindings/core/v8/V8HiddenValue.h" #include "core/dom/Document.h" -#include "core/events/BeforeUnloadEvent.h" #include "core/events/Event.h" #include "core/inspector/InspectorCounters.h" @@ -141,11 +140,6 @@ void V8AbstractEventListener::invokeEventHandler(Event* event, v8::LocalIsNull() && !returnValue->IsUndefined() && event->isBeforeUnloadEvent()) { - TOSTRING_VOID(V8StringResource<>, stringReturnValue, returnValue); - toBeforeUnloadEvent(event)->setReturnValue(stringReturnValue); - } - if (m_isAttribute && shouldPreventDefault(returnValue)) event->preventDefault(); } diff --git a/engine/core/core.gni b/engine/core/core.gni index 1f395065aa9..bcf15cd31e4 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -619,8 +619,6 @@ sky_core_files = [ "events/AnimationPlayerEvent.h", "events/BeforeTextInsertedEvent.cpp", "events/BeforeTextInsertedEvent.h", - "events/BeforeUnloadEvent.cpp", - "events/BeforeUnloadEvent.h", "events/CompositionEvent.cpp", "events/CompositionEvent.h", "events/CustomEvent.cpp", @@ -1289,7 +1287,6 @@ core_idl_files = get_path_info([ "dom/shadow/ShadowRoot.idl", "editing/Selection.idl", "events/AnimationPlayerEvent.idl", - "events/BeforeUnloadEvent.idl", "events/CompositionEvent.idl", "events/CustomEvent.idl", "events/ErrorEvent.idl", @@ -1411,7 +1408,6 @@ core_event_idl_files = get_path_info([ "css/FontFaceSetLoadEvent.idl", "css/MediaQueryListEvent.idl", "events/AnimationPlayerEvent.idl", - "events/BeforeUnloadEvent.idl", "events/CompositionEvent.idl", "events/CustomEvent.idl", "events/ErrorEvent.idl", diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index d2130e7755e..fbce9f2115a 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -83,7 +83,6 @@ #include "core/editing/FrameSelection.h" #include "core/editing/SpellChecker.h" #include "core/editing/markup.h" -#include "core/events/BeforeUnloadEvent.h" #include "core/events/Event.h" #include "core/events/EventFactory.h" #include "core/events/EventListener.h" @@ -1617,8 +1616,6 @@ void Document::dispatchUnloadEvents() Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const { - if (m_loadEventProgress == BeforeUnloadEventInProgress) - return BeforeUnloadDismissal; if (m_loadEventProgress == PageHideInProgress) return PageHideDismissal; if (m_loadEventProgress == UnloadEventInProgress) diff --git a/engine/core/dom/Document.h b/engine/core/dom/Document.h index 495a5028e34..42547dae151 100644 --- a/engine/core/dom/Document.h +++ b/engine/core/dom/Document.h @@ -361,7 +361,6 @@ public: enum PageDismissalType { NoDismissal = 0, - BeforeUnloadDismissal = 1, PageHideDismissal = 2, UnloadDismissal = 3 }; @@ -574,8 +573,6 @@ public: LoadEventTried, LoadEventInProgress, LoadEventCompleted, - BeforeUnloadEventInProgress, - BeforeUnloadEventCompleted, PageHideInProgress, UnloadEventInProgress, UnloadEventHandled diff --git a/engine/core/events/BeforeUnloadEvent.cpp b/engine/core/events/BeforeUnloadEvent.cpp deleted file mode 100644 index 32d19e178e5..00000000000 --- a/engine/core/events/BeforeUnloadEvent.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) - * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) - * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc. - * Copyright (C) 2013 Samsung Electronics. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "core/events/BeforeUnloadEvent.h" - - -namespace blink { - -BeforeUnloadEvent::BeforeUnloadEvent() - : Event(EventTypeNames::beforeunload, false, true) -{ - ScriptWrappable::init(this); -} - -BeforeUnloadEvent::~BeforeUnloadEvent() -{ -} - -bool BeforeUnloadEvent::isBeforeUnloadEvent() const -{ - return true; -} - -void BeforeUnloadEvent::trace(Visitor* visitor) -{ - Event::trace(visitor); -} - -} // namespace blink diff --git a/engine/core/events/BeforeUnloadEvent.h b/engine/core/events/BeforeUnloadEvent.h deleted file mode 100644 index ef7dedd5a6d..00000000000 --- a/engine/core/events/BeforeUnloadEvent.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) - * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) - * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. - * Copyright (C) 2013 Samsung Electronics. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef BeforeUnloadEvent_h -#define BeforeUnloadEvent_h - -#include "core/events/Event.h" - -namespace blink { - -class BeforeUnloadEvent FINAL : public Event { - DEFINE_WRAPPERTYPEINFO(); -public: - virtual ~BeforeUnloadEvent(); - - static PassRefPtrWillBeRawPtr create() - { - return adoptRefWillBeNoop(new BeforeUnloadEvent); - } - - virtual bool isBeforeUnloadEvent() const OVERRIDE; - - void setReturnValue(const String& returnValue) { m_returnValue = returnValue; } - String returnValue() const { return m_returnValue; } - - virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::BeforeUnloadEvent; } - - virtual void trace(Visitor*) OVERRIDE; - -private: - BeforeUnloadEvent(); - - String m_returnValue; -}; - -DEFINE_EVENT_TYPE_CASTS(BeforeUnloadEvent); - -} // namespace blink - -#endif // BeforeUnloadEvent_h diff --git a/engine/core/events/BeforeUnloadEvent.idl b/engine/core/events/BeforeUnloadEvent.idl deleted file mode 100644 index 618d5580939..00000000000 --- a/engine/core/events/BeforeUnloadEvent.idl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. 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 - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * 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 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -interface BeforeUnloadEvent : Event { - attribute DOMString returnValue; -}; diff --git a/engine/core/events/Event.cpp b/engine/core/events/Event.cpp index e63a237857f..9765f3b0212 100644 --- a/engine/core/events/Event.cpp +++ b/engine/core/events/Event.cpp @@ -188,11 +188,6 @@ bool Event::isBeforeTextInsertedEvent() const return false; } -bool Event::isBeforeUnloadEvent() const -{ - return false; -} - void Event::setTarget(PassRefPtrWillBeRawPtr target) { if (m_target == target) diff --git a/engine/core/events/Event.h b/engine/core/events/Event.h index 4b1143bccda..57a1d83312a 100644 --- a/engine/core/events/Event.h +++ b/engine/core/events/Event.h @@ -154,8 +154,6 @@ public: virtual bool isClipboardEvent() const; virtual bool isBeforeTextInsertedEvent() const; - virtual bool isBeforeUnloadEvent() const; - bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; } bool immediatePropagationStopped() const { return m_immediatePropagationStopped; } diff --git a/engine/core/events/EventTarget.cpp b/engine/core/events/EventTarget.cpp index 17f7b0b4ea1..c4ff0cb7d3f 100644 --- a/engine/core/events/EventTarget.cpp +++ b/engine/core/events/EventTarget.cpp @@ -289,10 +289,7 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList // index |size|, so iterating up to (but not including) |size| naturally excludes // new event listeners. - if (event->type() == EventTypeNames::beforeunload) { - if (LocalDOMWindow* executingWindow = this->executingWindow()) - UseCounter::count(executingWindow->document(), UseCounter::DocumentBeforeUnloadFired); - } else if (event->type() == EventTypeNames::unload) { + if (event->type() == EventTypeNames::unload) { if (LocalDOMWindow* executingWindow = this->executingWindow()) UseCounter::count(executingWindow->document(), UseCounter::DocumentUnloadFired); } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == EventTypeNames::DOMFocusOut) { diff --git a/engine/core/events/EventTypeNames.in b/engine/core/events/EventTypeNames.in index 513d0dc6232..18966e3bf42 100644 --- a/engine/core/events/EventTypeNames.in +++ b/engine/core/events/EventTypeNames.in @@ -26,7 +26,6 @@ autocompleteerror beforecopy beforecut beforepaste -beforeunload beginEvent blocked blur diff --git a/engine/core/frame/DOMWindowEventHandlers.h b/engine/core/frame/DOMWindowEventHandlers.h index 8b0b5abdb3d..b7cae609829 100644 --- a/engine/core/frame/DOMWindowEventHandlers.h +++ b/engine/core/frame/DOMWindowEventHandlers.h @@ -35,7 +35,6 @@ namespace blink { namespace DOMWindowEventHandlers { -DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(beforeunload); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(hashchange); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(languagechange); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(message); diff --git a/engine/core/frame/LocalDOMWindow.cpp b/engine/core/frame/LocalDOMWindow.cpp index ec0b93616e9..9a3871b94cf 100644 --- a/engine/core/frame/LocalDOMWindow.cpp +++ b/engine/core/frame/LocalDOMWindow.cpp @@ -112,12 +112,6 @@ static DOMWindowSet& windowsWithUnloadEventListeners() return windowsWithUnloadEventListeners; } -static DOMWindowSet& windowsWithBeforeUnloadEventListeners() -{ - DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithBeforeUnloadEventListeners, ()); - return windowsWithBeforeUnloadEventListeners; -} - static void addUnloadEventListener(LocalDOMWindow* domWindow) { DOMWindowSet& set = windowsWithUnloadEventListeners(); @@ -148,42 +142,6 @@ static void removeAllUnloadEventListeners(LocalDOMWindow* domWindow) enableSuddenTermination(); } -static void addBeforeUnloadEventListener(LocalDOMWindow* domWindow) -{ - DOMWindowSet& set = windowsWithBeforeUnloadEventListeners(); - if (set.isEmpty()) - disableSuddenTermination(); - set.add(domWindow); -} - -static void removeBeforeUnloadEventListener(LocalDOMWindow* domWindow) -{ - DOMWindowSet& set = windowsWithBeforeUnloadEventListeners(); - DOMWindowSet::iterator it = set.find(domWindow); - if (it == set.end()) - return; - set.remove(it); - if (set.isEmpty()) - enableSuddenTermination(); -} - -static void removeAllBeforeUnloadEventListeners(LocalDOMWindow* domWindow) -{ - DOMWindowSet& set = windowsWithBeforeUnloadEventListeners(); - DOMWindowSet::iterator it = set.find(domWindow); - if (it == set.end()) - return; - set.removeAll(it); - if (set.isEmpty()) - enableSuddenTermination(); -} - -static bool allowsBeforeUnloadListeners(LocalDOMWindow* window) -{ - ASSERT_ARG(window, window); - return window->frame(); -} - unsigned LocalDOMWindow::pendingUnloadEventListeners() const { return windowsWithUnloadEventListeners().count(const_cast(this)); @@ -855,19 +813,7 @@ bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr< if (eventType == EventTypeNames::unload) { UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); addUnloadEventListener(this); - } else if (eventType == EventTypeNames::beforeunload) { - UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered); - if (allowsBeforeUnloadListeners(this)) { - // This is confusingly named. It doesn't actually add the listener. It just increments a count - // so that we know we have listeners registered for the purposes of determining if we can - // fast terminate the renderer process. - addBeforeUnloadEventListener(this); - } else { - // Subframes return false from allowsBeforeUnloadListeners. - UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegistered); - } } - return true; } @@ -883,8 +829,6 @@ bool LocalDOMWindow::removeEventListener(const AtomicString& eventType, PassRefP if (eventType == EventTypeNames::unload) { removeUnloadEventListener(this); - } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadListeners(this)) { - removeBeforeUnloadEventListener(this); } return true; @@ -928,7 +872,6 @@ void LocalDOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mo } removeAllUnloadEventListeners(this); - removeAllBeforeUnloadEventListeners(this); } void LocalDOMWindow::removeAllEventListeners() diff --git a/engine/core/frame/UseCounter.h b/engine/core/frame/UseCounter.h index 4ffe5e1da15..2aab8ca57b3 100644 --- a/engine/core/frame/UseCounter.h +++ b/engine/core/frame/UseCounter.h @@ -121,8 +121,6 @@ public: SVGAnimationElement = 90, KeyboardEventKeyLocation = 91, LineClamp = 96, - SubFrameBeforeUnloadRegistered = 97, - SubFrameBeforeUnloadFired = 98, TextReplaceWholeText = 100, ConsoleMarkTimeline = 102, CSSPseudoElementUserAgentCustomPseudo = 103, @@ -185,8 +183,6 @@ public: InputTypePasswordMaxLength = 193, PrefixedPageVisibility = 196, CSSStyleSheetInsertRuleOptionalArg = 198, // Inconsistent with the specification and other browsers. - DocumentBeforeUnloadRegistered = 200, - DocumentBeforeUnloadFired = 201, DocumentUnloadRegistered = 202, DocumentUnloadFired = 203, SVGLocatableNearestViewportElement = 204, diff --git a/engine/core/frame/WindowEventHandlers.idl b/engine/core/frame/WindowEventHandlers.idl index 95de525822a..594fdbc1f7b 100644 --- a/engine/core/frame/WindowEventHandlers.idl +++ b/engine/core/frame/WindowEventHandlers.idl @@ -36,7 +36,6 @@ ] interface WindowEventHandlers { //attribute EventHandler onafterprint; //attribute EventHandler onbeforeprint; - attribute EventHandler onbeforeunload; attribute EventHandler onhashchange; attribute EventHandler onlanguagechange; attribute EventHandler onmessage;