Unreviewed, rolling out r110994 due to Chromium crash
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Mar 2012 23:50:01 +0000 (23:50 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Mar 2012 23:50:01 +0000 (23:50 +0000)
* CMakeLists.txt:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* notifications/DOMWindowNotifications.cpp: Removed.
* notifications/DOMWindowNotifications.h: Removed.
* notifications/DOMWindowNotifications.idl: Removed.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::~DOMWindow):
(WebCore::DOMWindow::willDetachPage):
(WebCore::DOMWindow::disconnectDOMWindowProperties):
(WebCore::DOMWindow::clearDOMWindowProperties):
(WebCore):
(WebCore::DOMWindow::webkitNotifications):
(WebCore::DOMWindow::resetNotifications):
* page/DOMWindow.h:
(WebCore):
(DOMWindow):
* page/DOMWindow.idl:
* page/Frame.cpp:
(WebCore::Frame::willDetachPage):
(WebCore::Frame::transferChildFrameToNewDocument):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/notifications/DOMWindowNotifications.cpp [deleted file]
Source/WebCore/notifications/DOMWindowNotifications.h [deleted file]
Source/WebCore/notifications/DOMWindowNotifications.idl [deleted file]
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindow.idl
Source/WebCore/page/Frame.cpp

index 9ac4b89..47dc137 100644 (file)
@@ -1623,14 +1623,12 @@ ENDIF ()
 
 IF (ENABLE_NOTIFICATIONS)
     LIST(APPEND WebCore_SOURCES
-        notifications/DOMWindowNotifications.cpp
         notifications/NotificationCenter.cpp
         notifications/NotificationController.cpp
         notifications/Notification.cpp
     )
 
     LIST(APPEND WebCore_IDL_FILES
-        notifications/DOMWindowNotifications.idl
         notifications/Notification.idl
         notifications/NotificationCenter.idl
     )
index 1ddb119..f3a0d21 100644 (file)
@@ -1,5 +1,36 @@
 2012-03-18  Kentaro Hara  <haraken@chromium.org>
 
+        Unreviewed, rolling out r110994 due to Chromium crash
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * DerivedSources.pri:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * notifications/DOMWindowNotifications.cpp: Removed.
+        * notifications/DOMWindowNotifications.h: Removed.
+        * notifications/DOMWindowNotifications.idl: Removed.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::~DOMWindow):
+        (WebCore::DOMWindow::willDetachPage):
+        (WebCore::DOMWindow::disconnectDOMWindowProperties):
+        (WebCore::DOMWindow::clearDOMWindowProperties):
+        (WebCore):
+        (WebCore::DOMWindow::webkitNotifications):
+        (WebCore::DOMWindow::resetNotifications):
+        * page/DOMWindow.h:
+        (WebCore):
+        (DOMWindow):
+        * page/DOMWindow.idl:
+        * page/Frame.cpp:
+        (WebCore::Frame::willDetachPage):
+        (WebCore::Frame::transferChildFrameToNewDocument):
+
+2012-03-18  Kentaro Hara  <haraken@chromium.org>
+
         Unreviewed, rolling out r111086.
         http://trac.webkit.org/changeset/111086
         https://bugs.webkit.org/show_bug.cgi?id=81374
index eff0d85..ac25bbf 100644 (file)
@@ -356,7 +356,6 @@ BINDING_IDLS = \
     $(WebCore)/inspector/ScriptProfile.idl \
     $(WebCore)/inspector/ScriptProfileNode.idl \
     $(WebCore)/loader/appcache/DOMApplicationCache.idl \
-    $(WebCore)/notifications/DOMWindowNotifications.idl \
     $(WebCore)/notifications/Notification.idl \
     $(WebCore)/notifications/NotificationCenter.idl \
     $(WebCore)/page/AbstractView.idl \
index 866a450..ee825d9 100644 (file)
@@ -375,7 +375,6 @@ IDL_BINDINGS += \
     $$PWD/inspector/ScriptProfile.idl \
     $$PWD/inspector/ScriptProfileNode.idl \
     $$PWD/loader/appcache/DOMApplicationCache.idl \
-    $$PWD/notifications/DOMWindowNotifications.idl \
     $$PWD/notifications/Notification.idl \
     $$PWD/notifications/NotificationCenter.idl \
     $$PWD/page/BarInfo.idl \
index 32ce0af..bcb029d 100644 (file)
@@ -2829,8 +2829,6 @@ webcore_sources += \
        Source/WebCore/mathml/MathMLMathElement.h \
        Source/WebCore/mathml/MathMLTextElement.cpp \
        Source/WebCore/mathml/MathMLTextElement.h \
-       Source/WebCore/notifications/DOMWindowNotifications.cpp \
-       Source/WebCore/notifications/DOMWindowNotifications.h \
        Source/WebCore/notifications/NotificationCenter.cpp \
        Source/WebCore/notifications/NotificationCenter.h \
        Source/WebCore/notifications/NotificationClient.h \
index 327c6e2..d9f9486 100644 (file)
@@ -979,7 +979,6 @@ SOURCES += \
     loader/SubresourceLoader.cpp \
     loader/TextResourceDecoder.cpp \
     loader/ThreadableLoader.cpp \
-    notifications/DOMWindowNotifications.cpp \
     notifications/Notification.cpp \
     notifications/NotificationCenter.cpp \
     notifications/NotificationController.cpp \
@@ -2076,7 +2075,6 @@ HEADERS += \
     mathml/MathMLInlineContainerElement.h \
     mathml/MathMLMathElement.h \
     mathml/MathMLTextElement.h \
-    notifications/DOMWindowNotifications.h \
     notifications/Notification.h \
     notifications/NotificationCenter.h \
     notifications/NotificationClient.h \
index 3e6f482..06bf9f0 100644 (file)
             'inspector/ScriptProfile.idl',
             'inspector/ScriptProfileNode.idl',
             'loader/appcache/DOMApplicationCache.idl',
-            'notifications/DOMWindowNotifications.idl',
             'notifications/Notification.idl',
             'notifications/NotificationCenter.idl',
             'page/AbstractView.idl',
             'mathml/MathMLMathElement.h',
             'mathml/MathMLTextElement.cpp',
             'mathml/MathMLTextElement.h',
-            'notifications/DOMWindowNotifications.cpp',
-            'notifications/DOMWindowNotifications.h',
             'notifications/Notification.cpp',
             'notifications/Notification.h',
             'notifications/NotificationCenter.cpp',
index e07a731..9c00075 100755 (executable)
                        Name="notifications"
                        >
                        <File
-                               RelativePath="..\notifications\DOMWindowNotifications.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\notifications\DOMWindowNotifications.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\notifications\Notification.cpp"
                                >
                        </File>
index 77ddd76..bebcea4 100644 (file)
                A8748BE012CBF2DC001FBA41 /* HashTools.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748BDF12CBF2DC001FBA41 /* HashTools.h */; };
                A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */; };
                A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = A883DF260F3D045D00F19BF6 /* VisibleSelection.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               A886CF761512301700D279F4 /* DOMWindowNotifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A886CF731512301700D279F4 /* DOMWindowNotifications.cpp */; };
-               A886CF771512301700D279F4 /* DOMWindowNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = A886CF741512301700D279F4 /* DOMWindowNotifications.h */; };
                A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */; };
                A88DD4870B4629A300C02990 /* PathTraversalState.h in Headers */ = {isa = PBXBuildFile; fileRef = A88DD4860B4629A300C02990 /* PathTraversalState.h */; };
                A88DD4890B4629B000C02990 /* PathTraversalState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A88DD4880B4629B000C02990 /* PathTraversalState.cpp */; };
                A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; };
                A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; };
                A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; };
-               A86E87711512DCEA00AD14C1 /* DOMWindowNotifications.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DOMWindowNotifications.idl; path = notifications/DOMWindowNotifications.idl; sourceTree = "<group>"; };
                A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; };
                A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; };
                A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; };
                A8748BDF12CBF2DC001FBA41 /* HashTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashTools.h; sourceTree = "<group>"; };
                A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleSelection.cpp; sourceTree = "<group>"; };
                A883DF260F3D045D00F19BF6 /* VisibleSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleSelection.h; sourceTree = "<group>"; };
-               A886CF731512301700D279F4 /* DOMWindowNotifications.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DOMWindowNotifications.cpp; path = notifications/DOMWindowNotifications.cpp; sourceTree = "<group>"; };
-               A886CF741512301700D279F4 /* DOMWindowNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMWindowNotifications.h; path = notifications/DOMWindowNotifications.h; sourceTree = "<group>"; };
                A88DD4860B4629A300C02990 /* PathTraversalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathTraversalState.h; sourceTree = "<group>"; };
                A88DD4880B4629B000C02990 /* PathTraversalState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PathTraversalState.cpp; sourceTree = "<group>"; };
                A89943260B42338700D7C802 /* BitmapImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitmapImage.h; sourceTree = "<group>"; };
                333F703D0FB49C16008E12A6 /* notifications */ = {
                        isa = PBXGroup;
                        children = (
-                               A886CF731512301700D279F4 /* DOMWindowNotifications.cpp */,
-                               A886CF741512301700D279F4 /* DOMWindowNotifications.h */,
-                               A86E87711512DCEA00AD14C1 /* DOMWindowNotifications.idl */,
                                33503CC61017A1B1003B47E1 /* Notification.cpp */,
                                333F704F0FB49CA2008E12A6 /* Notification.h */,
                                333F704E0FB49CA2008E12A6 /* Notification.idl */,
diff --git a/Source/WebCore/notifications/DOMWindowNotifications.cpp b/Source/WebCore/notifications/DOMWindowNotifications.cpp
deleted file mode 100644 (file)
index 6706581..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
- */
-
-#include "config.h"
-#include "DOMWindowNotifications.h"
-
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-
-#include "DOMWindow.h"
-#include "Document.h"
-#include "NotificationCenter.h"
-#include "NotificationController.h"
-#include "Page.h"
-
-namespace WebCore {
-
-DOMWindowNotifications::DOMWindowNotifications(DOMWindow* window)
-    : DOMWindowProperty(window->frame())
-    , m_window(window)
-{
-}
-
-DOMWindowNotifications::~DOMWindowNotifications()
-{
-}
-
-DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window)
-{
-    DEFINE_STATIC_LOCAL(AtomicString, supplementName, ("DOMWindowNotifications"));
-    DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName));
-    if (!supplement) {
-        supplement = new DOMWindowNotifications(window);
-        Supplement<DOMWindow>::provideTo(window, supplementName, adoptPtr(supplement));
-    }
-    return supplement;
-}
-
-NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow* window)
-{
-    return DOMWindowNotifications::from(window)->ensureWebkitNotifications();
-}
-
-NotificationCenter* DOMWindowNotifications::ensureWebkitNotifications()
-{
-    if (!m_window->isCurrentlyDisplayedInFrame())
-        return 0;
-
-    if (m_notificationCenter)
-        return m_notificationCenter.get();
-
-    Document* document = m_window->document();
-    if (!document)
-        return 0;
-
-    Page* page = document->page();
-    if (!page)
-        return 0;
-
-    NotificationClient* provider = NotificationController::clientFrom(page);
-    if (provider)
-        m_notificationCenter = NotificationCenter::create(m_window->scriptExecutionContext(), provider);
-    return m_notificationCenter.get();
-}
-
-void DOMWindowNotifications::disconnectFrame()
-{
-    if (m_notificationCenter) {
-        m_notificationCenter->disconnectFrame();
-        m_notificationCenter = 0;
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
diff --git a/Source/WebCore/notifications/DOMWindowNotifications.h b/Source/WebCore/notifications/DOMWindowNotifications.h
deleted file mode 100644 (file)
index e8d8f90..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
- */
-
-#ifndef DOMWindowNotifications_h
-#define DOMWindowNotifications_h
-
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-
-#include "DOMWindowProperty.h"
-#include "PlatformString.h"
-#include "Supplementable.h"
-
-namespace WebCore {
-
-class DOMWindow;
-class NotificationCenter;
-class ScriptExecutionContext;
-
-class DOMWindowNotifications : public Supplement<DOMWindow>, public DOMWindowProperty {
-public:
-    virtual ~DOMWindowNotifications();
-
-    static NotificationCenter* webkitNotifications(DOMWindow*);
-    static DOMWindowNotifications* from(DOMWindow*);
-
-private:
-    explicit DOMWindowNotifications(DOMWindow*);
-
-    NotificationCenter* ensureWebkitNotifications();
-    void disconnectFrame() OVERRIDE;
-
-    RefPtr<NotificationCenter> m_notificationCenter;
-    DOMWindow* m_window;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
-
-#endif // DOMWindowNotifications_h
diff --git a/Source/WebCore/notifications/DOMWindowNotifications.idl b/Source/WebCore/notifications/DOMWindowNotifications.idl
deleted file mode 100644 (file)
index 057b666..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2011 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:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
- */
-
-module window {
-
-    interface [
-        Conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS,
-        Supplemental=DOMWindow
-    ] DOMWindowNotifications {
-        readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
-    };
-
-}
index 67ddf96..dbec37b 100644 (file)
@@ -72,6 +72,8 @@
 #include "MediaQueryMatcher.h"
 #include "MessageEvent.h"
 #include "Navigator.h"
+#include "NotificationCenter.h"
+#include "NotificationController.h"
 #include "Page.h"
 #include "PageGroup.h"
 #include "PageTransitionEvent.h"
@@ -416,6 +418,9 @@ DOMWindow::~DOMWindow()
         ASSERT(!m_sessionStorage);
         ASSERT(!m_localStorage);
         ASSERT(!m_applicationCache);
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+        ASSERT(!m_notifications);
+#endif
 #if ENABLE(BLOB)
         ASSERT(!m_domURL);
 #endif
@@ -473,6 +478,12 @@ void DOMWindow::willDetachPage()
 {
     InspectorInstrumentation::frameWindowDiscarded(m_frame, this);
 
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+    // Clearing Notifications requests involves accessing the client so it must be done
+    // before the frame is detached.
+    resetNotifications();
+#endif
+
     HashSet<DOMWindowProperty*>::iterator stop = m_properties.end();
     for (HashSet<DOMWindowProperty*>::iterator it = m_properties.begin(); it != stop; ++it)
         (*it)->willDetachPage();
@@ -516,6 +527,15 @@ void DOMWindow::disconnectDOMWindowProperties()
     HashSet<DOMWindowProperty*>::iterator stop = m_properties.end();
     for (HashSet<DOMWindowProperty*>::iterator it = m_properties.begin(); it != stop; ++it)
         (*it)->disconnectFrame();
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+    // FIXME: Notifications shouldn't have different disconnection logic than
+    // the rest of the DOMWindowProperties.
+    // There is currently no way to reconnect them in resumeFromPageCache() so
+    // they will be broken after returning to a cached page.
+    // This should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=79636
+    resetNotifications();
+#endif
 }
 
 void DOMWindow::reconnectDOMWindowProperties()
@@ -551,6 +571,11 @@ void DOMWindow::clearDOMWindowProperties()
     m_sessionStorage = 0;
     m_localStorage = 0;
     m_applicationCache = 0;
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+    // FIXME: Notifications shouldn't have different disconnection logic than
+    // the rest of the DOMWindowProperties.
+    resetNotifications();
+#endif
 #if ENABLE(BLOB)
     m_domURL = 0;
 #endif
@@ -759,6 +784,38 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const
     return m_localStorage.get();
 }
 
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+NotificationCenter* DOMWindow::webkitNotifications() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (m_notifications)
+        return m_notifications.get();
+
+    Document* document = this->document();
+    if (!document)
+        return 0;
+    
+    Page* page = document->page();
+    if (!page)
+        return 0;
+
+    NotificationClient* provider = NotificationController::clientFrom(page);
+    if (provider) 
+        m_notifications = NotificationCenter::create(document, provider);    
+      
+    return m_notifications.get();
+}
+
+void DOMWindow::resetNotifications()
+{
+    if (!m_notifications)
+        return;
+    m_notifications->disconnectFrame();
+    m_notifications = 0;
+}
+#endif
+
 void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
 {
     MessagePortArray ports;
index 7014d96..bd81b48 100644 (file)
@@ -56,6 +56,7 @@ namespace WebCore {
     class MediaQueryList;
     class Navigator;
     class Node;
+    class NotificationCenter;
     class Page;
     class Performance;
     class PostMessageTimer;
@@ -355,6 +356,13 @@ namespace WebCore {
         Storage* sessionStorage(ExceptionCode&) const;
         Storage* localStorage(ExceptionCode&) const;
 
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+        NotificationCenter* webkitNotifications() const;
+        // Renders webkitNotifications object safely inoperable, disconnects
+        // if from embedder-provided NotificationClient.
+        void resetNotifications();
+#endif
+
 #if ENABLE(QUOTA)
         StorageInfo* webkitStorageInfo() const;
 #endif
@@ -442,6 +450,10 @@ namespace WebCore {
         mutable RefPtr<Storage> m_localStorage;
         mutable RefPtr<DOMApplicationCache> m_applicationCache;
 
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+        mutable RefPtr<NotificationCenter> m_notifications;
+#endif
+
 #if ENABLE(WEB_TIMING)
         mutable RefPtr<Performance> m_performance;
 #endif
index 0efa7bf..f2b90ce 100644 (file)
@@ -170,6 +170,10 @@ module window {
         readonly attribute [V8EnabledAtRuntime] Storage localStorage
             getter raises(DOMException);
 
+#if (defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS) || (defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS)
+        readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
+#endif
+
 #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
         // This is the interface orientation in degrees. Some examples are:
         //  0 is straight up; -90 is when the device is rotated 90 clockwise;
index fbd2db3..b313649 100644 (file)
@@ -687,6 +687,11 @@ void Frame::willDetachPage()
     if (Frame* parent = tree()->parent())
         parent->loader()->checkLoadComplete();
 
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+    if (m_domWindow)
+        m_domWindow->resetNotifications();
+#endif
+
     HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
     for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
         (*it)->willDetachPage();
@@ -731,6 +736,12 @@ void Frame::transferChildFrameToNewDocument()
              m_page->decrementFrameCount();
         }
 
+        if (m_domWindow) {
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+            m_domWindow->resetNotifications();
+#endif
+        }
+
         HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
         for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
             (*it)->willDetachPage();