From 047b877c94a31f3bc6d4fa7350b8df03821e1d73 Mon Sep 17 00:00:00 2001 From: "abarth@webkit.org" Date: Wed, 22 Feb 2012 02:22:15 +0000 Subject: [PATCH] Frame and Navigator shouldn't need to worry about Geolocation https://bugs.webkit.org/show_bug.cgi?id=78860 Reviewed by Eric Seidel. This patch removes some Geolocation-specific code from Frame and Navigator in favor of our new supplemental module mechanism. We're still refining the module system, but we seem to be converging on a simple Observer/Supplement design. In a future patch, I'll move the remaining Geolocation-related files in WebCore into Modules/geolocation. This patch appears to be the first patch that introduces a module used by all the various build systems, which is why there's a bit more build system overhead than usual. * Modules/geolocation: Added. * Modules/geolocation/NavigatorGeolocation.cpp: Added. (WebCore): (WebCore::NavigatorGeolocation::NavigatorGeolocation): (WebCore::NavigatorGeolocation::~NavigatorGeolocation): (WebCore::NavigatorGeolocation::pageDestroyed): (WebCore::NavigatorGeolocation::from): (WebCore::NavigatorGeolocation::geolocation): * Modules/geolocation/NavigatorGeolocation.h: Added. (WebCore): (NavigatorGeolocation): * Modules/geolocation/NavigatorGeolocation.idl: Added. - I've temporarily disabled this API for GObject because it generates a strange compile error. Once I land this patch, I'll spend some more time fixing the compile error. * page/DOMWindow.cpp: (WebCore): * page/DOMWindow.h: (DOMWindow): * page/Frame.cpp: (WebCore::Frame::pageDestroyed): (WebCore::Frame::transferChildFrameToNewDocument): * page/FrameDestructionObserver.cpp: (WebCore::FrameDestructionObserver::pageDestroyed): (WebCore): * page/FrameDestructionObserver.h: (FrameDestructionObserver): * page/Navigator.cpp: (WebCore): * page/Navigator.h: (WebCore): (Navigator): * page/Navigator.idl: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108428 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/CMakeLists.txt | 6 ++ Source/WebCore/ChangeLog | 51 ++++++++++++++ Source/WebCore/DerivedSources.make | 2 + Source/WebCore/DerivedSources.pri | 2 + Source/WebCore/GNUmakefile.am | 2 + Source/WebCore/GNUmakefile.list.am | 3 + .../Modules/geolocation/NavigatorGeolocation.cpp | 77 ++++++++++++++++++++++ .../Modules/geolocation/NavigatorGeolocation.h | 56 ++++++++++++++++ .../Modules/geolocation/NavigatorGeolocation.idl | 32 +++++++++ Source/WebCore/Target.pri | 2 + Source/WebCore/WebCore.exp.in | 1 + Source/WebCore/WebCore.gyp/WebCore.gyp | 1 + Source/WebCore/WebCore.gypi | 3 + Source/WebCore/WebCore.pri | 1 + Source/WebCore/WebCore.vcproj/WebCore.vcproj | 16 +++++ .../WebCore/WebCore.vcproj/WebCoreCommon.vsprops | 2 +- Source/WebCore/WebCore.xcodeproj/project.pbxproj | 26 ++++++++ .../bindings/scripts/CodeGeneratorGObject.pm | 2 +- .../scripts/test/CPP/WebDOMTestInterface.cpp | 20 ++++++ .../scripts/test/CPP/WebDOMTestInterface.h | 5 ++ .../test/GObject/WebKitDOMTestInterface.cpp | 55 ++++++++++++++++ .../scripts/test/GObject/WebKitDOMTestInterface.h | 21 ++++++ .../bindings/scripts/test/JS/JSTestInterface.cpp | 32 ++++++++- .../bindings/scripts/test/JS/JSTestInterface.h | 2 + .../bindings/scripts/test/ObjC/DOMTestInterface.h | 5 ++ .../bindings/scripts/test/ObjC/DOMTestInterface.mm | 17 +++++ .../bindings/scripts/test/TestSupplemental.idl | 1 + .../bindings/scripts/test/V8/V8TestInterface.cpp | 29 ++++++++ Source/WebCore/loader/FrameLoader.cpp | 6 +- Source/WebCore/page/DOMWindow.cpp | 32 +++++---- Source/WebCore/page/DOMWindow.h | 8 +-- Source/WebCore/page/DOMWindowProperty.cpp | 5 ++ Source/WebCore/page/DOMWindowProperty.h | 2 + Source/WebCore/page/Frame.cpp | 25 +++---- Source/WebCore/page/Frame.h | 3 +- Source/WebCore/page/FrameDestructionObserver.cpp | 5 ++ Source/WebCore/page/FrameDestructionObserver.h | 3 + Source/WebCore/page/Navigator.cpp | 13 ---- Source/WebCore/page/Navigator.h | 6 -- Source/WebCore/page/Navigator.idl | 4 -- Source/WebCore/page/Page.cpp | 2 +- Source/WebKit2/win/WebKit2.def | 1 + Source/autotools/symbols.filter | 1 + 43 files changed, 519 insertions(+), 69 deletions(-) create mode 100644 Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp create mode 100644 Source/WebCore/Modules/geolocation/NavigatorGeolocation.h create mode 100644 Source/WebCore/Modules/geolocation/NavigatorGeolocation.idl diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 651fe52..20470c8 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1,5 +1,6 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}" + "${WEBCORE_DIR}/Modules/geolocation" "${WEBCORE_DIR}/accessibility" "${WEBCORE_DIR}/bindings" "${WEBCORE_DIR}/bindings/generic" @@ -87,6 +88,7 @@ SET(WebCore_INCLUDE_DIRECTORIES ) SET(WebCore_IDL_INCLUDES + Modules/geolocation bindings/generic css dom @@ -105,6 +107,8 @@ SET(WebCore_IDL_INCLUDES ) SET(WebCore_IDL_FILES + Modules/geolocation/NavigatorGeolocation.idl + css/Counter.idl css/CSSCharsetRule.idl css/CSSFontFaceRule.idl @@ -400,6 +404,8 @@ SET(WebCore_IDL_FILES ) SET(WebCore_SOURCES + Modules/geolocation/NavigatorGeolocation.cpp + accessibility/AXObjectCache.cpp accessibility/AccessibilityARIAGrid.cpp accessibility/AccessibilityARIAGridCell.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 1a5c998..b14ddca 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,54 @@ +2012-02-21 Adam Barth + + Frame and Navigator shouldn't need to worry about Geolocation + https://bugs.webkit.org/show_bug.cgi?id=78860 + + Reviewed by Eric Seidel. + + This patch removes some Geolocation-specific code from Frame and + Navigator in favor of our new supplemental module mechanism. We're + still refining the module system, but we seem to be converging on a + simple Observer/Supplement design. + + In a future patch, I'll move the remaining Geolocation-related files in + WebCore into Modules/geolocation. This patch appears to be the first + patch that introduces a module used by all the various build systems, + which is why there's a bit more build system overhead than usual. + + * Modules/geolocation: Added. + * Modules/geolocation/NavigatorGeolocation.cpp: Added. + (WebCore): + (WebCore::NavigatorGeolocation::NavigatorGeolocation): + (WebCore::NavigatorGeolocation::~NavigatorGeolocation): + (WebCore::NavigatorGeolocation::pageDestroyed): + (WebCore::NavigatorGeolocation::from): + (WebCore::NavigatorGeolocation::geolocation): + * Modules/geolocation/NavigatorGeolocation.h: Added. + (WebCore): + (NavigatorGeolocation): + * Modules/geolocation/NavigatorGeolocation.idl: Added. + - I've temporarily disabled this API for GObject because it generates + a strange compile error. Once I land this patch, I'll spend some + more time fixing the compile error. + * page/DOMWindow.cpp: + (WebCore): + * page/DOMWindow.h: + (DOMWindow): + * page/Frame.cpp: + (WebCore::Frame::pageDestroyed): + (WebCore::Frame::transferChildFrameToNewDocument): + * page/FrameDestructionObserver.cpp: + (WebCore::FrameDestructionObserver::pageDestroyed): + (WebCore): + * page/FrameDestructionObserver.h: + (FrameDestructionObserver): + * page/Navigator.cpp: + (WebCore): + * page/Navigator.h: + (WebCore): + (Navigator): + * page/Navigator.idl: + 2012-02-21 Shawn Singh [chromium] Refactor CCLayerTreeHostCommon: merge scattered setTargetRenderSurface logic diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 6c12aa8..92ee23c 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -28,6 +28,7 @@ VPATH = \ $(WebCore) \ + $(WebCore)/Modules/geolocation \ $(WebCore)/bindings/generic \ $(WebCore)/bindings/js \ $(WebCore)/bindings/objc \ @@ -53,6 +54,7 @@ VPATH = \ # BINDING_IDLS = \ + $(WebCore)/Modules/geolocation/NavigatorGeolocation.idl \ $(WebCore)/css/CSSCharsetRule.idl \ $(WebCore)/css/CSSFontFaceRule.idl \ $(WebCore)/css/CSSImportRule.idl \ diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index fa6dba2..d6eb175 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -86,6 +86,7 @@ STYLESHEETS_EMBED = \ $$PWD/css/mobileThemeQt.css IDL_BINDINGS += \ + $$PWD/Modules/geolocation/NavigatorGeolocation.idl \ $$PWD/css/Counter.idl \ $$PWD/css/CSSCharsetRule.idl \ $$PWD/css/CSSFontFaceRule.idl \ @@ -684,6 +685,7 @@ else: generator = JS generateBindings.commands = perl -I$$PWD/bindings/scripts $$generateBindings.script \ --defines \"$${FEATURE_DEFINES_JAVASCRIPT}\" \ --generator $$generator \ + --include $$PWD/Modules/geolocation \ --include $$PWD/dom \ --include $$PWD/fileapi \ --include $$PWD/html \ diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index d25e66f..ce9a5fa 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -11,6 +11,7 @@ webcore_cppflags += \ -I$(srcdir)/Source/ThirdParty/ANGLE/include \ -I$(srcdir)/Source/ThirdParty/ANGLE/include/GLSLANG \ -I$(srcdir)/Source/WebCore \ + -I$(srcdir)/Source/WebCore/Modules/geolocation \ -I$(srcdir)/Source/WebCore/accessibility \ -I$(srcdir)/Source/WebCore/bindings \ -I$(srcdir)/Source/WebCore/bindings/generic \ @@ -758,6 +759,7 @@ DerivedSources/ANGLE/glslang_tab.cpp: Source/ThirdParty/ANGLE/src/compiler/glsla DerivedSources/ANGLE/glslang_tab.h: DerivedSources/ANGLE/glslang_tab.cpp IDL_PATH := \ + $(WebCore)/Modules/geolocation \ $(WebCore)/bindings/js \ $(WebCore)/css \ $(WebCore)/dom \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index b31e48b..7cb6107 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -650,6 +650,7 @@ webcore_built_sources += \ DerivedSources/WebCore/XPathGrammar.h dom_binding_idls += \ + $(WebCore)/Modules/geolocation/NavigatorGeolocation.idl \ $(WebCore)/css/CSSCharsetRule.idl \ $(WebCore)/css/CSSFontFaceRule.idl \ $(WebCore)/css/CSSImportRule.idl \ @@ -951,6 +952,8 @@ dom_binding_idls += \ $(WebCore)/xml/XSLTProcessor.idl webcore_sources += \ + Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp \ + Source/WebCore/Modules/geolocation/NavigatorGeolocation.h \ Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp \ Source/WebCore/accessibility/AccessibilityARIAGridCell.h \ Source/WebCore/accessibility/AccessibilityARIAGrid.cpp \ diff --git a/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp b/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp new file mode 100644 index 0000000..b8a47c1 --- /dev/null +++ b/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012, 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 INC. AND ITS 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 APPLE INC. OR ITS 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 "NavigatorGeolocation.h" + +#include "Geolocation.h" +#include "Navigator.h" + +namespace WebCore { + +NavigatorGeolocation::NavigatorGeolocation(Frame* frame) + : DOMWindowProperty(frame) +{ +} + +NavigatorGeolocation::~NavigatorGeolocation() +{ +} + +void NavigatorGeolocation::willDetachPage() +{ + // FIXME: We should ideally allow existing Geolocation activities to continue + // when the Geolocation's iframe is reparented. (Assuming we continue to + // support reparenting iframes.) + // See https://bugs.webkit.org/show_bug.cgi?id=55577 + // and https://bugs.webkit.org/show_bug.cgi?id=52877 + if (m_geolocation) + m_geolocation->reset(); +} + +NavigatorGeolocation* NavigatorGeolocation::from(Navigator* navigator) +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorGeolocation")); + NavigatorGeolocation* supplement = static_cast(NavigatorSupplement::from(navigator, name)); + if (!supplement) { + supplement = new NavigatorGeolocation(navigator->frame()); + provideTo(navigator, name, adoptPtr(supplement)); + } + return supplement; +} + +Geolocation* NavigatorGeolocation::geolocation(Navigator* navigator) +{ + return NavigatorGeolocation::from(navigator)->geolocation(); +} + +Geolocation* NavigatorGeolocation::geolocation() const +{ + if (!m_geolocation) + m_geolocation = Geolocation::create(frame()); + return m_geolocation.get(); +} + +} // namespace WebCore diff --git a/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h b/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h new file mode 100644 index 0000000..b8c92e6 --- /dev/null +++ b/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h @@ -0,0 +1,56 @@ +/* + * 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 INC. AND ITS 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 APPLE INC. OR ITS 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 NavigatorGeolocation_h +#define NavigatorGeolocation_h + +#include "DOMWindowProperty.h" +#include "NavigatorSupplement.h" + +namespace WebCore { + +class Frame; +class Geolocation; +class Navigator; + +class NavigatorGeolocation : public NavigatorSupplement, public DOMWindowProperty { +public: + virtual ~NavigatorGeolocation(); + static NavigatorGeolocation* from(Navigator*); + + static Geolocation* geolocation(Navigator*); + Geolocation* geolocation() const; + +private: + NavigatorGeolocation(Frame*); + + virtual void willDetachPage() OVERRIDE; + + mutable RefPtr m_geolocation; +}; + +} // namespace WebCore + +#endif // NavigatorGeolocation_h diff --git a/Source/WebCore/Modules/geolocation/NavigatorGeolocation.idl b/Source/WebCore/Modules/geolocation/NavigatorGeolocation.idl new file mode 100644 index 0000000..ef58438 --- /dev/null +++ b/Source/WebCore/Modules/geolocation/NavigatorGeolocation.idl @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * 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. + */ + +module window { + + interface [ + Conditional=GEOLOCATION, + Supplemental=Navigator + ] NavigatorGeolocation { +#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT + // FIXME: Enable this interface for GOBJECT. + readonly attribute [V8EnabledAtRuntime] Geolocation geolocation; +#endif + }; + +} diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 146b225..38fcd62 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -34,6 +34,8 @@ include_webinspector { } SOURCES += \ + Modules/geolocation/NavigatorGeolocation.cpp \ + \ accessibility/AccessibilityImageMapLink.cpp \ accessibility/AccessibilityMediaControls.cpp \ accessibility/AccessibilityMenuList.cpp \ diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 9d55461..accc44c 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -672,6 +672,7 @@ __ZN7WebCore24FrameDestructionObserverD2Ev __ZN7WebCore24FrameDestructionObserverC2EPNS_5FrameE __ZN7WebCore24FrameDestructionObserver12observeFrameEPNS_5FrameE __ZN7WebCore24FrameDestructionObserver14frameDestroyedEv +__ZN7WebCore24FrameDestructionObserver14willDetachPageEv __ZN7WebCore24keyIdentifierForKeyEventEP7NSEvent __ZN7WebCore24notifyHistoryItemChangedE __ZN7WebCore25HistoryPropertyListWriter11releaseDataEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index 72c824f..d319496 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -52,6 +52,7 @@ '../', '../..', '../Modules/gamepad', + '../Modules/geolocation', '../Modules/intents', '../Modules/indexeddb', '../accessibility', diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index f113b05..5f57c4c 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -720,6 +720,7 @@ 'Modules/gamepad/Gamepad.idl', 'Modules/gamepad/GamepadList.idl', 'Modules/gamepad/NavigatorGamepad.idl', + 'Modules/geolocation/NavigatorGeolocation.idl', 'Modules/indexeddb/DOMWindowIndexedDatabase.idl', 'Modules/intents/DOMWindowIntents.idl', 'Modules/intents/Intent.idl', @@ -1277,6 +1278,8 @@ 'Modules/gamepad/GamepadList.h', 'Modules/gamepad/NavigatorGamepad.cpp', 'Modules/gamepad/NavigatorGamepad.h', + 'Modules/geolocation/NavigatorGeolocation.cpp', + 'Modules/geolocation/NavigatorGeolocation.h', 'Modules/indexeddb/DOMWindowIndexedDatabase.cpp', 'Modules/indexeddb/DOMWindowIndexedDatabase.h', 'Modules/intents/Intent.cpp', diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 4f47c1b..af9941a 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -18,6 +18,7 @@ WEBCORE_GENERATED_SOURCES_DIR = $${ROOT_BUILD_DIR}/Source/WebCore/$${GENERATED_S INCLUDEPATH += \ $$SOURCE_DIR \ + $$SOURCE_DIR/Modules/geolocation \ $$SOURCE_DIR/accessibility \ $$SOURCE_DIR/bindings \ $$SOURCE_DIR/bindings/generic \ diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 8725a57..76efcea 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -24051,6 +24051,22 @@ + + + + + + + + ptr = coreSelf->${getPropNameFunction}(" . (@{$attribute->getterExceptions} ? "ec" : "") . ");\n"); + push(@txtGetProps, " RefPtr ptr = ${getterFunctionName}(" . join(", ", @getterArguments) . ");\n"); push(@txtGetProps, " g_value_set_object(value, WebKit::kit(ptr.get()));\n"); $done = 1; } diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp index 2508b22..37392bc 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -25,8 +25,10 @@ #include "WebDOMTestInterface.h" #include "KURL.h" +#include "Node.h" #include "TestInterface.h" #include "TestSupplemental.h" +#include "WebDOMNode.h" #include "WebDOMString.h" #include "WebExceptionHandler.h" #include "wtf/text/AtomicString.h" @@ -106,6 +108,24 @@ void WebDOMTestInterface::setSupplementalStr2(const WebDOMString& newSupplementa } #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +WebDOMNode WebDOMTestInterface::supplementalNode() const +{ + if (!impl()) + return WebDOMNode(); + + return toWebKit(WTF::getPtr(TestSupplemental::supplementalNode(impl()))); +} + +void WebDOMTestInterface::setSupplementalNode(const WebDOMNode& newSupplementalNode) +{ + if (!impl()) + return; + + TestSupplemental::setSupplementalNode(impl(), toWebCore(newSupplementalNode)); +} + +#endif #if ENABLE(Condition11) || ENABLE(Condition12) void WebDOMTestInterface::supplementalMethod1() diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h index 66512c4..1a874d9 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -32,6 +32,7 @@ namespace WebCore { class TestInterface; }; +class WebDOMNode; class WebDOMTestInterface : public WebDOMObject { public: @@ -58,6 +59,10 @@ public: WebDOMString supplementalStr2() const; void setSupplementalStr2(const WebDOMString&); #endif +#if ENABLE(Condition11) || ENABLE(Condition12) + WebDOMNode supplementalNode() const; + void setSupplementalNode(const WebDOMNode&); +#endif void supplementalMethod1(); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index 26ab91b..b205ae7 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -28,11 +28,14 @@ #include "DOMObjectCache.h" #include "ExceptionCode.h" #include "JSMainThreadExecState.h" +#include "Node.h" #include "TestInterface.h" #include "TestObj.h" #include "TestSupplemental.h" #include "WebKitDOMBinding.h" #include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMNode.h" +#include "webkit/WebKitDOMNodePrivate.h" #include "webkit/WebKitDOMTestInterface.h" #include "webkit/WebKitDOMTestInterfacePrivate.h" #include "webkit/WebKitDOMTestObj.h" @@ -135,6 +138,38 @@ webkit_dom_test_interface_set_supplemental_str2(WebKitDOMTestInterface* self, co #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ } +WebKitDOMNode* +webkit_dom_test_interface_get_supplemental_node(WebKitDOMTestInterface* self) +{ +#if ENABLE(Condition11) || ENABLE(Condition12) + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestInterface * item = WebKit::core(self); + PassRefPtr g_res = WTF::getPtr(TestSupplemental::supplementalNode(item)); + WebKitDOMNode* res = WebKit::kit(g_res.get()); + return res; +#else + return NULL; +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +} + +void +webkit_dom_test_interface_set_supplemental_node(WebKitDOMTestInterface* self, WebKitDOMNode* value) +{ +#if ENABLE(Condition11) || ENABLE(Condition12) + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestInterface * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::Node * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + TestSupplemental::setSupplementalNode(item, converted_value); +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +} + G_DEFINE_TYPE(WebKitDOMTestInterface, webkit_dom_test_interface, WEBKIT_TYPE_DOM_OBJECT) @@ -159,6 +194,9 @@ enum { #if ENABLE(Condition11) || ENABLE(Condition12) PROP_SUPPLEMENTAL_STR2, #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +#if ENABLE(Condition11) || ENABLE(Condition12) + PROP_SUPPLEMENTAL_NODE, +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ }; @@ -218,6 +256,14 @@ static void webkit_dom_test_interface_get_property(GObject* object, guint prop_i break; } #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +#if ENABLE(Condition11) || ENABLE(Condition12) + case PROP_SUPPLEMENTAL_NODE: + { + RefPtr ptr = TestSupplemental::supplementalNode(coreSelf); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -258,6 +304,15 @@ static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* re "", /* default */ WEBKIT_PARAM_READWRITE)); #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +#if ENABLE(Condition11) || ENABLE(Condition12) + g_object_class_install_property(gobjectClass, + PROP_SUPPLEMENTAL_NODE, + g_param_spec_object("supplemental-node", /* name */ + "test_interface_supplemental-node", /* short description */ + "read-write WebKitDOMNode* TestInterface.supplemental-node", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_NODE, /* gobject type */ + WEBKIT_PARAM_READWRITE)); +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ } diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h index ea1a7b1..7947bf3 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h @@ -100,6 +100,27 @@ webkit_dom_test_interface_get_supplemental_str2(WebKitDOMTestInterface* self); WEBKIT_API void webkit_dom_test_interface_set_supplemental_str2(WebKitDOMTestInterface* self, const gchar* value); +/** + * webkit_dom_test_interface_get_supplemental_node: + * @self: A #WebKitDOMTestInterface + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMNode* +webkit_dom_test_interface_get_supplemental_node(WebKitDOMTestInterface* self); + +/** + * webkit_dom_test_interface_set_supplemental_node: + * @self: A #WebKitDOMTestInterface + * @value: A #WebKitDOMNode + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_interface_set_supplemental_node(WebKitDOMTestInterface* self, WebKitDOMNode* value); + G_END_DECLS #endif /* WebKitDOMTestInterface_h */ diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 3d6c9ec..41f7061 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -35,10 +35,15 @@ #include #if ENABLE(Condition11) || ENABLE(Condition12) +#include "JSNode.h" #include "KURL.h" #include #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +#include "Node.h" +#endif + using namespace JSC; namespace WebCore { @@ -57,11 +62,14 @@ static const HashTableValue JSTestInterfaceTableValues[] = #if ENABLE(Condition11) || ENABLE(Condition12) { "supplementalStr3", DontDelete, (intptr_t)static_cast(jsTestInterfaceSupplementalStr3), (intptr_t)setJSTestInterfaceSupplementalStr3, NoIntrinsic }, #endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalNode", DontDelete, (intptr_t)static_cast(jsTestInterfaceSupplementalNode), (intptr_t)setJSTestInterfaceSupplementalNode, NoIntrinsic }, +#endif { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsTestInterfaceConstructor), (intptr_t)0, NoIntrinsic }, { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfaceTable = { 9, 7, JSTestInterfaceTableValues, 0 }; +static const HashTable JSTestInterfaceTable = { 16, 15, JSTestInterfaceTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestInterfaceConstructorTableValues[] = @@ -257,6 +265,18 @@ JSValue jsTestInterfaceSupplementalStr3(ExecState* exec, JSValue slotBase, const #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceSupplementalNode(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestInterface* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + TestInterface* impl = static_cast(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalNode(impl))); + return result; +} + +#endif + JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestInterface* domObject = static_cast(asObject(slotBase)); @@ -290,6 +310,16 @@ void setJSTestInterfaceSupplementalStr3(ExecState* exec, JSObject* thisObject, J #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +void setJSTestInterfaceSupplementalNode(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestInterface* castedThis = static_cast(thisObject); + TestInterface* impl = static_cast(castedThis->impl()); + TestSupplemental::setSupplementalNode(impl, toNode(value)); +} + +#endif + JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor(exec, static_cast(globalObject)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h index bf4889f..14d9812 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -159,6 +159,8 @@ JSC::JSValue jsTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::JSValue, cons void setJSTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestInterfaceSupplementalNode(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestInterfaceSupplementalNode(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); // Constants diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h index da6f209..67970c4 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h @@ -28,6 +28,7 @@ #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST +@class DOMNode; @class DOMTestObj; @class NSString; @@ -53,6 +54,10 @@ enum { - (NSString *)supplementalStr3; - (void)setSupplementalStr3:(NSString *)newSupplementalStr3; #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +- (DOMNode *)supplementalNode; +- (void)setSupplementalNode:(DOMNode *)newSupplementalNode; +#endif - (void)supplementalMethod1; - (DOMTestObj *)supplementalMethod2:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (void)supplementalMethod3; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm index d8a17a0..b1fc2ea 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm @@ -43,6 +43,7 @@ #import "ExceptionHandlers.h" #import "JSMainThreadExecState.h" #import "KURL.h" +#import "Node.h" #import "TestInterface.h" #import "TestObj.h" #import "TestSupplemental.h" @@ -108,6 +109,22 @@ } #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +- (DOMNode *)supplementalNode +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(TestSupplemental::supplementalNode(IMPL))); +} + +- (void)setSupplementalNode:(DOMNode *)newSupplementalNode +{ + WebCore::JSMainThreadNullState state; + ASSERT(newSupplementalNode); + + TestSupplemental::setSupplementalNode(IMPL, core(newSupplementalNode)); +} +#endif + #if ENABLE(Condition11) || ENABLE(Condition12) - (void)supplementalMethod1 diff --git a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl index 2355d6d..c553312 100644 --- a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl +++ b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl @@ -36,6 +36,7 @@ module test { readonly attribute DOMString supplementalStr1; attribute DOMString supplementalStr2; attribute [CustomGetter, CustomSetter] DOMString supplementalStr3; + attribute Node supplementalNode; void supplementalMethod1(); [CallWith=ScriptExecutionContext] TestObj supplementalMethod2(in DOMString strArg, in TestObj objArg) raises(DOMException); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index abdf823..bfc69e9 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -31,6 +31,7 @@ #include "V8BindingState.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" +#include "V8Node.h" #include "V8Proxy.h" #include "V8TestObj.h" #include @@ -83,6 +84,30 @@ static void supplementalStr2AttrSetter(v8::Local name, v8::Local supplementalNodeAttrGetter(v8::Local name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalNode._get"); + TestInterface* imp = V8TestInterface::toNative(info.Holder()); + return toV8(TestSupplemental::supplementalNode(imp)); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + +static void supplementalNodeAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalNode._set"); + TestInterface* imp = V8TestInterface::toNative(info.Holder()); + Node* v = V8Node::HasInstance(value) ? V8Node::toNative(v8::Handle::Cast(value)) : 0; + TestSupplemental::setSupplementalNode(imp, WTF::getPtr(v)); + return; +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + static v8::Handle supplementalMethod1Callback(const v8::Arguments& args) { INC_STATS("DOM.TestInterface.supplementalMethod1"); @@ -135,6 +160,10 @@ static const BatchedAttribute TestInterfaceAttrs[] = { // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter CustomGetter Conditional ImplementedBy') {"supplementalStr3", V8TestInterface::supplementalStr3AccessorGetter, V8TestInterface::supplementalStr3AccessorSetter, 0 /* no data */, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) +#if ENABLE(Condition11) || ENABLE(Condition12) + // Attribute 'supplementalNode' (Type: 'attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalNode", TestInterfaceInternal::supplementalNodeAttrGetter, TestInterfaceInternal::supplementalNodeAttrSetter, 0 /* no data */, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition11) || ENABLE(Condition12) }; static const BatchedCallback TestInterfaceCallbacks[] = { diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index cd228d4..6babd67 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -2439,8 +2439,7 @@ void FrameLoader::closeAndRemoveChild(Frame* child) child->setView(0); if (child->ownerElement() && child->page()) child->page()->decrementFrameCount(); - // FIXME: The page isn't being destroyed, so it's not right to call a function named pageDestroyed(). - child->pageDestroyed(); + child->detachFromPage(); m_frame->tree()->removeChild(child); } @@ -2518,8 +2517,7 @@ void FrameLoader::detachFromParent() parent->loader()->scheduleCheckCompleted(); } else { m_frame->setView(0); - // FIXME: The page isn't being destroyed, so it's not right to call a function named pageDestroyed(). - m_frame->pageDestroyed(); + m_frame->detachFromPage(); } } diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 5413bdb..e00b53e 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -480,6 +480,21 @@ void DOMWindow::frameDestroyed() clear(); } +void DOMWindow::willDetachPage() +{ + InspectorInstrumentation::frameWindowDiscarded(m_frame, this); + +#if ENABLE(NOTIFICATIONS) + // Clearing Notifications requests involves accessing the client so it must be done + // before the frame is detached. + resetNotifications(); +#endif + + HashSet::iterator stop = m_properties.end(); + for (HashSet::iterator it = m_properties.begin(); it != stop; ++it) + (*it)->willDetachPage(); +} + void DOMWindow::registerProperty(DOMWindowProperty* property) { m_properties.add(property); @@ -731,23 +746,6 @@ void DOMWindow::resetNotifications() } #endif -void DOMWindow::pageDestroyed() -{ - InspectorInstrumentation::frameWindowDiscarded(m_frame, this); -#if ENABLE(NOTIFICATIONS) - // Clearing Notifications requests involves accessing the client so it must be done - // before the frame is detached. - resetNotifications(); -#endif -} - -void DOMWindow::resetGeolocation() -{ - // Geolocation should cancel activities and permission requests when the page is detached. - if (m_navigator) - m_navigator->resetGeolocation(); -} - #if ENABLE(INDEXED_DATABASE) void DOMWindow::setIDBFactory(PassRefPtr idbFactory) { diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index 96a58e5..2d772c4 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -92,8 +92,6 @@ namespace WebCore { virtual DOMWindow* toDOMWindow(); - virtual void frameDestroyed() OVERRIDE; - void registerProperty(DOMWindowProperty*); void unregisterProperty(DOMWindowProperty*); @@ -231,9 +229,6 @@ namespace WebCore { void printErrorMessage(const String&); String crossDomainAccessErrorMessage(DOMWindow* activeWindow); - void pageDestroyed(); - void resetGeolocation(); - void postMessage(PassRefPtr message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); // FIXME: remove this when we update the ObjC bindings (bug #28774). void postMessage(PassRefPtr message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); @@ -419,6 +414,9 @@ namespace WebCore { private: explicit DOMWindow(Frame*); + virtual void frameDestroyed() OVERRIDE; + virtual void willDetachPage() OVERRIDE; + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } virtual EventTargetData* eventTargetData(); diff --git a/Source/WebCore/page/DOMWindowProperty.cpp b/Source/WebCore/page/DOMWindowProperty.cpp index b6a9aba..82f9316 100644 --- a/Source/WebCore/page/DOMWindowProperty.cpp +++ b/Source/WebCore/page/DOMWindowProperty.cpp @@ -49,4 +49,9 @@ void DOMWindowProperty::disconnectFrame() m_frame = 0; } +void DOMWindowProperty::willDetachPage() +{ + // Subclasses should override this function to handle this notification. +} + } diff --git a/Source/WebCore/page/DOMWindowProperty.h b/Source/WebCore/page/DOMWindowProperty.h index 41baf43..cd2d837 100644 --- a/Source/WebCore/page/DOMWindowProperty.h +++ b/Source/WebCore/page/DOMWindowProperty.h @@ -33,7 +33,9 @@ class Frame; class DOMWindowProperty { public: explicit DOMWindowProperty(Frame*); + virtual void disconnectFrame(); + virtual void willDetachPage(); Frame* frame() const { return m_frame; } diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index 575e736..9344e12 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -660,21 +660,19 @@ DOMWindow* Frame::domWindow() const return m_domWindow.get(); } -void Frame::pageDestroyed() +void Frame::willDetachPage() { - // FIXME: Rename this function, since it's called not only from Page destructor, but in several other cases. - // This cleanup is needed whenever we remove a frame from page. - if (Frame* parent = tree()->parent()) parent->loader()->checkLoadComplete(); - if (m_domWindow) { - m_domWindow->resetGeolocation(); #if ENABLE(NOTIFICATIONS) + if (m_domWindow) m_domWindow->resetNotifications(); #endif - m_domWindow->pageDestroyed(); - } + + HashSet::iterator stop = m_destructionObservers.end(); + for (HashSet::iterator it = m_destructionObservers.begin(); it != stop; ++it) + (*it)->willDetachPage(); // FIXME: It's unclear as to why this is called more than once, but it is, // so page() could be NULL. @@ -683,8 +681,6 @@ void Frame::pageDestroyed() script()->clearScriptObjects(); script()->updatePlatformScriptObjects(); - - detachFromPage(); } void Frame::disconnectOwnerElement() @@ -718,17 +714,16 @@ void Frame::transferChildFrameToNewDocument() m_page->decrementFrameCount(); } - // FIXME: We should ideally allow existing Geolocation activities to continue - // when the Geolocation's iframe is reparented. - // See https://bugs.webkit.org/show_bug.cgi?id=55577 - // and https://bugs.webkit.org/show_bug.cgi?id=52877 if (m_domWindow) { - m_domWindow->resetGeolocation(); #if ENABLE(NOTIFICATIONS) m_domWindow->resetNotifications(); #endif } + HashSet::iterator stop = m_destructionObservers.end(); + for (HashSet::iterator it = m_destructionObservers.begin(); it != stop; ++it) + (*it)->willDetachPage(); + m_page = newPage; if (newPage) diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h index a7ac619..82f49d9 100644 --- a/Source/WebCore/page/Frame.h +++ b/Source/WebCore/page/Frame.h @@ -89,8 +89,8 @@ namespace WebCore { void addDestructionObserver(FrameDestructionObserver*); void removeDestructionObserver(FrameDestructionObserver*); + void willDetachPage(); void detachFromPage(); - void pageDestroyed(); void disconnectOwnerElement(); Page* page() const; @@ -348,6 +348,7 @@ namespace WebCore { inline void Frame::detachFromPage() { + willDetachPage(); m_page = 0; } diff --git a/Source/WebCore/page/FrameDestructionObserver.cpp b/Source/WebCore/page/FrameDestructionObserver.cpp index 358bf94..94bf336 100644 --- a/Source/WebCore/page/FrameDestructionObserver.cpp +++ b/Source/WebCore/page/FrameDestructionObserver.cpp @@ -58,4 +58,9 @@ void FrameDestructionObserver::frameDestroyed() m_frame = 0; } +void FrameDestructionObserver::willDetachPage() +{ + // Subclasses should override this function to handle this notification. +} + } diff --git a/Source/WebCore/page/FrameDestructionObserver.h b/Source/WebCore/page/FrameDestructionObserver.h index 7110922..8989e4a 100644 --- a/Source/WebCore/page/FrameDestructionObserver.h +++ b/Source/WebCore/page/FrameDestructionObserver.h @@ -33,7 +33,10 @@ class Frame; class FrameDestructionObserver { public: explicit FrameDestructionObserver(Frame*); + virtual void frameDestroyed(); + virtual void willDetachPage(); + Frame* frame() const { return m_frame; } protected: diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp index 70a15e7..d06e888 100644 --- a/Source/WebCore/page/Navigator.cpp +++ b/Source/WebCore/page/Navigator.cpp @@ -67,12 +67,6 @@ NavigatorSupplement* Navigator::requireSupplement(const AtomicString& name) return m_suppliments.get(name.impl()); } -void Navigator::resetGeolocation() -{ - if (m_geolocation) - m_geolocation->reset(); -} - // If this function returns true, we need to hide the substring "4." that would otherwise // appear in the appVersion string. This is to avoid problems with old versions of a // library called OpenCube QuickMenu, which as of this writing is still being used on @@ -151,13 +145,6 @@ bool Navigator::javaEnabled() const return m_frame->settings()->isJavaEnabled(); } -Geolocation* Navigator::geolocation() const -{ - if (!m_geolocation) - m_geolocation = Geolocation::create(m_frame); - return m_geolocation.get(); -} - #if ENABLE(POINTER_LOCK) PointerLock* Navigator::webkitPointer() const { diff --git a/Source/WebCore/page/Navigator.h b/Source/WebCore/page/Navigator.h index 2cd1ea9..dd5c5740 100644 --- a/Source/WebCore/page/Navigator.h +++ b/Source/WebCore/page/Navigator.h @@ -34,7 +34,6 @@ namespace WebCore { class DOMMimeTypeArray; class DOMPluginArray; class Frame; -class Geolocation; class PointerLock; class PluginData; @@ -45,8 +44,6 @@ public: static PassRefPtr create(Frame* frame) { return adoptRef(new Navigator(frame)); } virtual ~Navigator(); - void resetGeolocation(); - String appVersion() const; String language() const; DOMPluginArray* plugins() const; @@ -56,8 +53,6 @@ public: virtual String userAgent() const; - Geolocation* geolocation() const; - #if ENABLE(POINTER_LOCK) PointerLock* webkitPointer() const; #endif @@ -80,7 +75,6 @@ private: mutable RefPtr m_plugins; mutable RefPtr m_mimeTypes; - mutable RefPtr m_geolocation; #if ENABLE(POINTER_LOCK) mutable RefPtr m_pointer; #endif diff --git a/Source/WebCore/page/Navigator.idl b/Source/WebCore/page/Navigator.idl index 4747217..59cc7e7 100644 --- a/Source/WebCore/page/Navigator.idl +++ b/Source/WebCore/page/Navigator.idl @@ -40,10 +40,6 @@ module window { readonly attribute boolean onLine; -#if defined(ENABLE_GEOLOCATION) && ENABLE_GEOLOCATION - readonly attribute [V8EnabledAtRuntime] Geolocation geolocation; -#endif - #if defined(ENABLE_POINTER_LOCK) && ENABLE_POINTER_LOCK readonly attribute [V8EnabledAtRuntime] PointerLock webkitPointer; #endif diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index d1603fd..ab9ef66 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -200,7 +200,7 @@ Page::~Page() allPages->remove(this); for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) - frame->pageDestroyed(); + frame->detachFromPage(); m_editorClient->pageDestroyed(); diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 2aa70df..718dfa1 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -201,3 +201,4 @@ EXPORTS ?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ ?view@Document@WebCore@@QBEPAVFrameView@2@XZ + ?willDetachPage@FrameDestructionObserver@WebCore@@UAEXXZ diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index 85ec02b..ef70d81 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -96,6 +96,7 @@ _ZN7WebCore24FrameDestructionObserverD2Ev; _ZN7WebCore24FrameDestructionObserverC2EPNS_5FrameE; _ZN7WebCore24FrameDestructionObserver12observeFrameEPNS_5FrameE; _ZN7WebCore24FrameDestructionObserver14frameDestroyedEv; +_ZN7WebCore24FrameDestructionObserver14willDetachPageEv; _ZN7WebCore22RuntimeEnabledFeatures31isMultipleShadowSubtreesEnabledE; local: _Z*; -- 2.7.4