WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Address navigator properties enumeration, add test for when Geolocation is not implmented
GeoLocation-WebKit.org.patch.txt (text/plain), 103.38 KB, created by
Greg Bolsinga
on 2008-10-15 13:11:44 PDT
(
hide
)
Description:
Address navigator properties enumeration, add test for when Geolocation is not implmented
Filename:
MIME Type:
Creator:
Greg Bolsinga
Created:
2008-10-15 13:11:44 PDT
Size:
103.38 KB
patch
obsolete
>Index: JavaScriptCore/ChangeLog >=================================================================== >--- JavaScriptCore/ChangeLog (revision 37609) >+++ JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2008-10-15 Greg Bolsinga <bolsinga@apple.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=21475 >+ >+ Provide support for the Geolocation API >+ >+ http://dev.w3.org/geo/api/spec-source.html >+ >+ * wtf/Platform.h: ENABLE_GEOLOCATION defaults to 0 >+ > 2008-10-15 Joerg Bornemann <joerg.bornemann@trolltech.com> > > Reviewed by Darin Adler. >Index: JavaScriptCore/wtf/Platform.h >=================================================================== >--- JavaScriptCore/wtf/Platform.h (revision 37609) >+++ JavaScriptCore/wtf/Platform.h (working copy) >@@ -343,6 +343,10 @@ > #define ENABLE_SAMPLING_TOOL 0 > #endif > >+#if !defined(ENABLE_GEOLOCATION) >+#define ENABLE_GEOLOCATION 0 >+#endif >+ > // CTI only supports x86 at the moment, and has only been tested on Mac and Windows. > #if !defined(ENABLE_CTI) && PLATFORM(X86) && (PLATFORM(MAC) || PLATFORM(WIN)) > #define ENABLE_CTI 1 >Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 37609) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,105 @@ >+2008-10-15 Greg Bolsinga <bolsinga@apple.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=21475 >+ >+ Provide support for the Geolocation API >+ >+ http://dev.w3.org/geo/api/spec-source.html >+ >+ Test: geolocation/geolocation-not-implemented.html >+ >+ * DerivedSources.make: >+ * GNUmakefile.am: Added Geolocation support >+ * WebCore.pro: Added Geolocation support >+ * WebCore.vcproj/WebCore.vcproj: Added Geolocation support >+ * WebCore.xcodeproj/project.pbxproj: Added Geolocation support >+ * WebCoreSources.bkl: Added Geolocation support >+ * bindings/js/JSCustomPositionCallback.cpp: Added. >+ (WebCore::JSCustomPositionCallback::JSCustomPositionCallback): >+ (WebCore::JSCustomPositionCallback::handleEvent): >+ * bindings/js/JSCustomPositionCallback.h: Added. >+ (WebCore::JSCustomPositionCallback::create): >+ * bindings/js/JSCustomPositionErrorCallback.cpp: Added. >+ (WebCore::JSCustomPositionErrorCallback::JSCustomPositionErrorCallback): >+ (WebCore::JSCustomPositionErrorCallback::handleEvent): >+ * bindings/js/JSCustomPositionErrorCallback.h: Added. >+ (WebCore::JSCustomPositionErrorCallback::create): >+ * bindings/js/JSDOMBinding.cpp: move markDOMObjectWrapper here from JSDOMWindowCustom >+ (WebCore::markDOMObjectWrapper): >+ * bindings/js/JSDOMBinding.h: move markDOMObjectWrapper here from JSDOMWindowCustom >+ * bindings/js/JSDOMWindowCustom.cpp: move markDOMObjectWrapper to JSDOMBinding >+ * bindings/js/JSGeolocationCustom.cpp: Added. >+ (WebCore::JSGeolocation::getCurrentPosition): >+ (WebCore::JSGeolocation::watchPosition): >+ * bindings/js/JSNavigatorCustom.cpp: handle marking Geolocation >+ (WebCore::JSNavigator::mark): >+ * page/Geolocation.cpp: Added. >+ (WebCore::Geolocation::GeoNotifier::GeoNotifier): >+ (WebCore::Geolocation::GeoNotifier::timerFired): >+ (WebCore::Geolocation::Geolocation): >+ (WebCore::Geolocation::disconnectFrame): >+ (WebCore::Geolocation::getCurrentPosition): >+ (WebCore::Geolocation::watchPosition): >+ (WebCore::Geolocation::clearWatch): >+ (WebCore::Geolocation::stopUpdatingIfEmpty): >+ (WebCore::Geolocation::handleError): >+ (WebCore::Geolocation::geolocationServicePositionChanged): >+ (WebCore::Geolocation::geolocationServiceErrorOccurred): >+ * page/Geolocation.h: Added. >+ (WebCore::Geolocation::~Geolocation): >+ (WebCore::Geolocation::lastPosition): >+ * page/Geolocation.idl: Added. >+ * page/Geoposition.cpp: Added. >+ (WebCore::Geoposition::toString): >+ * page/Geoposition.h: Added. >+ (WebCore::Geoposition::Geoposition): >+ (WebCore::Geoposition::latitude): >+ (WebCore::Geoposition::longitude): >+ (WebCore::Geoposition::altitude): >+ (WebCore::Geoposition::accuracy): >+ (WebCore::Geoposition::altitudeAccuracy): >+ (WebCore::Geoposition::heading): >+ (WebCore::Geoposition::velocity): >+ (WebCore::Geoposition::timestamp): >+ * page/Geoposition.idl: Added. >+ * page/Navigator.cpp: >+ (WebCore::Navigator::disconnectFrame): disconnect Geolocation >+ (WebCore::Navigator::geolocation): accessor for Geolocation >+ * page/Navigator.h: >+ (WebCore::Navigator::optionalGeolocation): accessor for Geolocation >+ * page/Navigator.idl: accessor for Geolocation >+ * page/PositionCallback.h: Added. >+ (WebCore::PositionCallback::~PositionCallback): >+ * page/PositionCallback.idl: Added. >+ * page/PositionError.h: Added. >+ (WebCore::PositionError::PositionError): >+ (WebCore::PositionError::code): >+ (WebCore::PositionError::setCode): >+ (WebCore::PositionError::message): >+ (WebCore::PositionError::setMessage): >+ * page/PositionError.idl: Added. >+ * page/PositionErrorCallback.h: Added. >+ (WebCore::PositionErrorCallback::~PositionErrorCallback): >+ * page/PositionErrorCallback.idl: Added. >+ * page/PositionOptions.h: Added. >+ (WebCore::PositionOptions::PositionOptions): >+ (WebCore::PositionOptions::enableHighAccuracy): >+ (WebCore::PositionOptions::setEnableHighAccuracy): >+ (WebCore::PositionOptions::timeout): >+ (WebCore::PositionOptions::setTimeout): >+ * page/PositionOptions.idl: Added. >+ * platform/GeolocationService.cpp: Added. >+ (WebCore::GeolocationService::GeolocationService): >+ (WebCore::GeolocationService::positionChanged): >+ (WebCore::GeolocationService::errorOccurred): >+ * platform/GeolocationService.h: Added. >+ (WebCore::GeolocationServiceClient::~GeolocationServiceClient): >+ (WebCore::GeolocationServiceClient::geolocationServicePositionChanged): >+ (WebCore::GeolocationServiceClient::geolocationServiceErrorOccurred): >+ (WebCore::GeolocationService::~GeolocationService): >+ > 2008-10-15 Dirk Schulze <vbs85@gmx.de> > > Reviewed by Eric Seidel. >Index: WebCore/DerivedSources.make >=================================================================== >--- WebCore/DerivedSources.make (revision 37609) >+++ WebCore/DerivedSources.make (working copy) >@@ -92,6 +92,8 @@ DOM_CLASSES = \ > EventTargetNode \ > File \ > FileList \ >+ Geolocation \ >+ Geoposition \ > HTMLAnchorElement \ > HTMLAppletElement \ > HTMLAreaElement \ >@@ -179,6 +181,10 @@ DOM_CLASSES = \ > OverflowEvent \ > Plugin \ > PluginArray \ >+ PositionCallback \ >+ PositionError \ >+ PositionErrorCallback \ >+ PositionOptions \ > ProcessingInstruction \ > ProgressEvent \ > RGBColor \ >Index: WebCore/GNUmakefile.am >=================================================================== >--- WebCore/GNUmakefile.am (revision 37609) >+++ WebCore/GNUmakefile.am (working copy) >@@ -325,6 +325,10 @@ webcore_sources += \ > WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp \ > WebCore/bindings/js/JSClipboardCustom.cpp \ > WebCore/bindings/js/JSConsoleCustom.cpp \ >+ WebCore/bindings/js/JSCustomPositionCallback.cpp \ >+ WebCore/bindings/js/JSCustomPositionCallback.h \ >+ WebCore/bindings/js/JSCustomPositionErrorCallback.cpp \ >+ WebCore/bindings/js/JSCustomPositionErrorCallback.h \ > WebCore/bindings/js/JSCustomVoidCallback.cpp \ > WebCore/bindings/js/JSCustomVoidCallback.h \ > WebCore/bindings/js/JSCustomXPathNSResolver.cpp \ >@@ -347,6 +351,7 @@ webcore_sources += \ > WebCore/bindings/js/JSEventTarget.h \ > WebCore/bindings/js/JSEventTargetBase.h \ > WebCore/bindings/js/JSEventTargetNodeCustom.cpp \ >+ WebCore/bindings/js/JSGeolocationCustom.cpp \ > WebCore/bindings/js/JSHTMLAllCollection.cpp \ > WebCore/bindings/js/JSHTMLAllCollection.h \ > WebCore/bindings/js/JSHTMLAppletElementCustom.cpp \ >@@ -1186,6 +1191,10 @@ webcore_sources += \ > WebCore/page/FrameTree.h \ > WebCore/page/FrameView.cpp \ > WebCore/page/FrameView.h \ >+ WebCore/page/Geolocation.cpp \ >+ WebCore/page/Geolocation.h \ >+ WebCore/page/Geoposition.cpp \ >+ WebCore/page/Geoposition.h \ > WebCore/page/History.cpp \ > WebCore/page/History.h \ > WebCore/page/Location.cpp \ >@@ -1198,6 +1207,10 @@ webcore_sources += \ > WebCore/page/Page.h \ > WebCore/page/PageGroup.cpp \ > WebCore/page/PageGroup.h \ >+ WebCore/page/PositionCallback.h \ >+ WebCore/page/PositionError.h \ >+ WebCore/page/PositionErrorCallback.h \ >+ WebCore/page/PositionOptions.h \ > WebCore/page/PrintContext.cpp \ > WebCore/page/PrintContext.h \ > WebCore/page/Screen.cpp \ >@@ -1243,6 +1256,8 @@ webcore_sources += \ > WebCore/platform/FileChooser.h \ > WebCore/platform/FileSystem.h \ > WebCore/platform/FloatConversion.h \ >+ WebCore/platform/GeolocationService.cpp \ >+ WebCore/platform/GeolocationService.h \ > WebCore/platform/HostWindow.h \ > WebCore/platform/KURL.cpp \ > WebCore/platform/KURL.h \ >Index: WebCore/WebCore.pro >=================================================================== >--- WebCore/WebCore.pro (revision 37609) >+++ WebCore/WebCore.pro (working copy) >@@ -775,6 +775,8 @@ SOURCES += \ > page/Frame.cpp \ > page/FrameTree.cpp \ > page/FrameView.cpp \ >+ page/Geolocation.cpp \ >+ page/Geoposition.cpp \ > page/History.cpp \ > page/Location.cpp \ > page/MouseEventWithHitTestResults.cpp \ >@@ -802,6 +804,7 @@ SOURCES += \ > platform/DragData.cpp \ > platform/DragImage.cpp \ > platform/FileChooser.cpp \ >+ platform/GeolocationService.cpp \ > platform/graphics/FontDescription.cpp \ > platform/graphics/FontFamily.cpp \ > platform/graphics/AffineTransform.cpp \ >@@ -1197,7 +1200,10 @@ contains(DEFINES, ENABLE_DATABASE=1) { > bindings/js/JSCustomSQLTransactionErrorCallback.cpp \ > bindings/js/JSDatabaseCustom.cpp \ > bindings/js/JSSQLResultSetRowListCustom.cpp \ >- bindings/js/JSSQLTransactionCustom.cpp >+ bindings/js/JSSQLTransactionCustom.cpp \ >+ bindings/js/JSGeolocationCustom.cpp \ >+ bindings/js/JSCustomPositionCallback.cpp \ >+ bindings/js/JSCustomPositionErrorCallback.cpp > > IDL_BINDINGS += \ > storage/Database.idl \ >Index: WebCore/WebCoreSources.bkl >=================================================================== >--- WebCore/WebCoreSources.bkl (revision 37609) >+++ WebCore/WebCoreSources.bkl (working copy) >@@ -42,6 +42,8 @@ This file contains the list of files nee > bindings/js/JSCSSRuleCustom.cpp > bindings/js/JSCSSStyleDeclarationCustom.cpp > bindings/js/JSCSSValueCustom.cpp >+ bindings/js/JSCustomPositionCallback.cpp >+ bindings/js/JSCustomPositionErrorCallback.cpp > bindings/js/JSCustomSQLStatementCallback.cpp > bindings/js/JSCustomSQLStatementErrorCallback.cpp > bindings/js/JSCustomSQLTransactionCallback.cpp >@@ -59,6 +61,7 @@ This file contains the list of files nee > bindings/js/JSEventCustom.cpp > bindings/js/JSEventTarget.cpp > bindings/js/JSEventTargetNodeCustom.cpp >+ bindings/js/JSGeolocationCustom.cpp > bindings/js/JSHTMLAllCollection.cpp > bindings/js/JSHistoryCustom.cpp > bindings/js/JSHTMLAppletElementCustom.cpp >@@ -238,6 +241,8 @@ This file contains the list of files nee > DerivedSources/WebCore/JSEventTargetNode.cpp > DerivedSources/WebCore/JSFile.cpp > DerivedSources/WebCore/JSFileList.cpp >+ DerivedSources/WebCore/JSGeolocation.cpp >+ DerivedSources/WebCore/JSGeoposition.cpp > DerivedSources/WebCore/JSHTMLAnchorElement.cpp > DerivedSources/WebCore/JSHTMLAppletElement.cpp > DerivedSources/WebCore/JSHTMLAreaElement.cpp >@@ -322,6 +327,8 @@ This file contains the list of files nee > DerivedSources/WebCore/JSOverflowEvent.cpp > DerivedSources/WebCore/JSPlugin.cpp > DerivedSources/WebCore/JSPluginArray.cpp >+ DerivedSources/WebCore/JSPositionError.cpp >+ DerivedSources/WebCore/JSPositionOptions.cpp > DerivedSources/WebCore/JSProcessingInstruction.cpp > DerivedSources/WebCore/JSProgressEvent.cpp > DerivedSources/WebCore/JSRange.cpp >@@ -668,6 +675,8 @@ This file contains the list of files nee > page/Frame.cpp > page/FrameTree.cpp > page/FrameView.cpp >+ page/Geolocation.cpp >+ page/Geoposition.cpp > page/History.cpp > page/Location.cpp > page/MouseEventWithHitTestResults.cpp >@@ -691,6 +700,7 @@ This file contains the list of files nee > platform/DeprecatedValueListImpl.cpp > platform/DragImage.cpp > platform/FileChooser.cpp >+ platform/GeolocationService.cpp > platform/graphics/Font.cpp > platform/graphics/FontCache.cpp > platform/graphics/FontData.cpp >Index: WebCore/WebCore.vcproj/WebCore.vcproj >=================================================================== >--- WebCore/WebCore.vcproj/WebCore.vcproj (revision 37609) >+++ WebCore/WebCore.vcproj/WebCore.vcproj (working copy) >@@ -680,6 +680,14 @@ > > > </File> > <File >+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSGeolocation.h" >+ > >+ </File> >+ <File >+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSGeoposition.h" >+ > >+ </File> >+ <File > RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEvent.h" > > > </File> >@@ -1040,6 +1048,14 @@ > > > </File> > <File >+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSPositionError.h" >+ > >+ </File> >+ <File >+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSPositionOptions.h" >+ > >+ </File> >+ <File > RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSOverflowEvent.h" > > > </File> >@@ -2260,6 +2276,38 @@ > > > </File> > <File >+ RelativePath="..\page\Geolocation.cpp" >+ > >+ <FileConfiguration >+ Name="Release_PGO|Win32" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ WholeProgramOptimization="true" >+ /> >+ </FileConfiguration> >+ </File> >+ <File >+ RelativePath="..\page\Geolocation.h" >+ > >+ </File> >+ <File >+ RelativePath="..\page\Geoposition.cpp" >+ > >+ <FileConfiguration >+ Name="Release_PGO|Win32" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ WholeProgramOptimization="true" >+ /> >+ </FileConfiguration> >+ </File> >+ <File >+ RelativePath="..\page\Geoposition.h" >+ > >+ </File> >+ <File > RelativePath="..\page\History.cpp" > > > <FileConfiguration >@@ -2388,6 +2436,22 @@ > > > </File> > <File >+ RelativePath="..\page\PositionCallback.h" >+ > >+ </File> >+ <File >+ RelativePath="..\page\PositionError.h" >+ > >+ </File> >+ <File >+ RelativePath="..\page\PositionErrorCallback.h" >+ > >+ </File> >+ <File >+ RelativePath="..\page\PositionOptions.h" >+ > >+ </File> >+ <File > RelativePath="..\page\Screen.cpp" > > > <FileConfiguration >@@ -3040,6 +3104,14 @@ > > > </File> > <File >+ RelativePath="..\platform\GeolocationService.cpp" >+ > >+ </File> >+ <File >+ RelativePath="..\platform\GeolocationService.h" >+ > >+ </File> >+ <File > RelativePath="..\platform\HostWindow.h" > > > </File> >@@ -13129,6 +13201,14 @@ > > > </File> > <File >+ RelativePath="..\bindings\js\JSCustomPositionCallback.cpp" >+ > >+ </File> >+ <File >+ RelativePath="..\bindings\js\JSCustomPositionErrorCallback.cpp" >+ > >+ </File> >+ <File > RelativePath="..\bindings\js\JSCustomSQLStatementCallback.cpp" > > > </File> >@@ -13257,6 +13337,10 @@ > > > </File> > <File >+ RelativePath="..\bindings\js\JSGeolocationCustom.cpp" >+ > >+ </File> >+ <File > RelativePath="..\bindings\js\JSHistoryCustom.cpp" > > > </File> >Index: WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >--- WebCore/WebCore.xcodeproj/project.pbxproj (revision 37609) >+++ WebCore/WebCore.xcodeproj/project.pbxproj (working copy) >@@ -4220,6 +4220,35 @@ > F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */; }; > F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; }; > F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; }; >+ FE80D7A70E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */; }; >+ FE80D7A80E9C1ED2000D6F75 /* JSCustomPositionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7A30E9C1ED2000D6F75 /* JSCustomPositionCallback.h */; }; >+ FE80D7A90E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7A40E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp */; }; >+ FE80D7AA0E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7A50E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h */; }; >+ FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */; }; >+ FE80D7C50E9C1F25000D6F75 /* Geolocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7B70E9C1F25000D6F75 /* Geolocation.cpp */; }; >+ FE80D7C60E9C1F25000D6F75 /* Geolocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7B80E9C1F25000D6F75 /* Geolocation.h */; }; >+ FE80D7C70E9C1F25000D6F75 /* Geolocation.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE80D7B90E9C1F25000D6F75 /* Geolocation.idl */; }; >+ FE80D7C80E9C1F25000D6F75 /* Geoposition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7BA0E9C1F25000D6F75 /* Geoposition.cpp */; }; >+ FE80D7C90E9C1F25000D6F75 /* Geoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */; }; >+ FE80D7CA0E9C1F25000D6F75 /* Geoposition.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE80D7BC0E9C1F25000D6F75 /* Geoposition.idl */; }; >+ FE80D7CB0E9C1F25000D6F75 /* PositionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BD0E9C1F25000D6F75 /* PositionCallback.h */; }; >+ FE80D7CC0E9C1F25000D6F75 /* PositionCallback.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE80D7BE0E9C1F25000D6F75 /* PositionCallback.idl */; }; >+ FE80D7CD0E9C1F25000D6F75 /* PositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BF0E9C1F25000D6F75 /* PositionError.h */; }; >+ FE80D7CE0E9C1F25000D6F75 /* PositionError.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE80D7C00E9C1F25000D6F75 /* PositionError.idl */; }; >+ FE80D7CF0E9C1F25000D6F75 /* PositionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */; }; >+ FE80D7D00E9C1F25000D6F75 /* PositionErrorCallback.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE80D7C20E9C1F25000D6F75 /* PositionErrorCallback.idl */; }; >+ FE80D7D10E9C1F25000D6F75 /* PositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */; }; >+ FE80D7D20E9C1F25000D6F75 /* PositionOptions.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE80D7C40E9C1F25000D6F75 /* PositionOptions.idl */; }; >+ FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */; }; >+ FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA600E9C4703000D6F75 /* JSGeolocation.h */; }; >+ FE80DA650E9C4703000D6F75 /* JSGeoposition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */; }; >+ FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA620E9C4703000D6F75 /* JSGeoposition.h */; }; >+ FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */; }; >+ FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */; }; >+ FE80DA730E9C472F000D6F75 /* JSPositionOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6F0E9C472F000D6F75 /* JSPositionOptions.cpp */; }; >+ FE80DA740E9C472F000D6F75 /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA700E9C472F000D6F75 /* JSPositionOptions.h */; }; >+ FEAB90120EA51B9C006348C3 /* GeolocationService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */; }; >+ FEAB90130EA51B9C006348C3 /* GeolocationService.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAB90110EA51B9C006348C3 /* GeolocationService.h */; }; > /* End PBXBuildFile section */ > > /* Begin PBXContainerItemProxy section */ >@@ -8834,6 +8863,35 @@ > F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEvent.h; sourceTree = "<group>"; }; > F9F0ED780DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XMLHttpRequestProgressEvent.idl; sourceTree = "<group>"; }; > FE49EF970DC51462004266E1 /* DashboardSupportCSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DashboardSupportCSSPropertyNames.in; sourceTree = "<group>"; }; >+ FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomPositionCallback.cpp; sourceTree = "<group>"; }; >+ FE80D7A30E9C1ED2000D6F75 /* JSCustomPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomPositionCallback.h; sourceTree = "<group>"; }; >+ FE80D7A40E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomPositionErrorCallback.cpp; sourceTree = "<group>"; }; >+ FE80D7A50E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomPositionErrorCallback.h; sourceTree = "<group>"; }; >+ FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeolocationCustom.cpp; sourceTree = "<group>"; }; >+ FE80D7B70E9C1F25000D6F75 /* Geolocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Geolocation.cpp; sourceTree = "<group>"; }; >+ FE80D7B80E9C1F25000D6F75 /* Geolocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Geolocation.h; sourceTree = "<group>"; }; >+ FE80D7B90E9C1F25000D6F75 /* Geolocation.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Geolocation.idl; sourceTree = "<group>"; }; >+ FE80D7BA0E9C1F25000D6F75 /* Geoposition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Geoposition.cpp; sourceTree = "<group>"; }; >+ FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Geoposition.h; sourceTree = "<group>"; }; >+ FE80D7BC0E9C1F25000D6F75 /* Geoposition.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Geoposition.idl; sourceTree = "<group>"; }; >+ FE80D7BD0E9C1F25000D6F75 /* PositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionCallback.h; sourceTree = "<group>"; }; >+ FE80D7BE0E9C1F25000D6F75 /* PositionCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PositionCallback.idl; sourceTree = "<group>"; }; >+ FE80D7BF0E9C1F25000D6F75 /* PositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionError.h; sourceTree = "<group>"; }; >+ FE80D7C00E9C1F25000D6F75 /* PositionError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PositionError.idl; sourceTree = "<group>"; }; >+ FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionErrorCallback.h; sourceTree = "<group>"; }; >+ FE80D7C20E9C1F25000D6F75 /* PositionErrorCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PositionErrorCallback.idl; sourceTree = "<group>"; }; >+ FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionOptions.h; sourceTree = "<group>"; }; >+ FE80D7C40E9C1F25000D6F75 /* PositionOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PositionOptions.idl; sourceTree = "<group>"; }; >+ FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeolocation.cpp; sourceTree = "<group>"; }; >+ FE80DA600E9C4703000D6F75 /* JSGeolocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeolocation.h; sourceTree = "<group>"; }; >+ FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeoposition.cpp; sourceTree = "<group>"; }; >+ FE80DA620E9C4703000D6F75 /* JSGeoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeoposition.h; sourceTree = "<group>"; }; >+ FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; }; >+ FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionError.h; sourceTree = "<group>"; }; >+ FE80DA6F0E9C472F000D6F75 /* JSPositionOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionOptions.cpp; sourceTree = "<group>"; }; >+ FE80DA700E9C472F000D6F75 /* JSPositionOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionOptions.h; sourceTree = "<group>"; }; >+ FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationService.cpp; sourceTree = "<group>"; }; >+ FEAB90110EA51B9C006348C3 /* GeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationService.h; sourceTree = "<group>"; }; > /* End PBXFileReference section */ > > /* Begin PBXFrameworksBuildPhase section */ >@@ -9583,6 +9641,12 @@ > 65A21483097A3F5300B9050A /* FrameTree.h */, > 65CBFEF70974F607001DAC25 /* FrameView.cpp */, > 65CBFEF80974F607001DAC25 /* FrameView.h */, >+ FE80D7B70E9C1F25000D6F75 /* Geolocation.cpp */, >+ FE80D7B80E9C1F25000D6F75 /* Geolocation.h */, >+ FE80D7B90E9C1F25000D6F75 /* Geolocation.idl */, >+ FE80D7BA0E9C1F25000D6F75 /* Geoposition.cpp */, >+ FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */, >+ FE80D7BC0E9C1F25000D6F75 /* Geoposition.idl */, > BC94D1500C275C8B006BC617 /* History.cpp */, > BC94D1510C275C8B006BC617 /* History.h */, > BC94D1520C275C8B006BC617 /* History.idl */, >@@ -9598,6 +9662,14 @@ > 65A21467097A329100B9050A /* Page.h */, > 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */, > 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */, >+ FE80D7BD0E9C1F25000D6F75 /* PositionCallback.h */, >+ FE80D7BE0E9C1F25000D6F75 /* PositionCallback.idl */, >+ FE80D7BF0E9C1F25000D6F75 /* PositionError.h */, >+ FE80D7C00E9C1F25000D6F75 /* PositionError.idl */, >+ FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */, >+ FE80D7C20E9C1F25000D6F75 /* PositionErrorCallback.idl */, >+ FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */, >+ FE80D7C40E9C1F25000D6F75 /* PositionOptions.idl */, > BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */, > BCEC01BB0C274DAC009F4EC9 /* Screen.h */, > BCEC01BC0C274DAC009F4EC9 /* Screen.idl */, >@@ -11761,6 +11833,10 @@ > 65DF322E09D1DDBC000BE325 /* JSEntity.h */, > 93F9B7720BA5FDDC00854064 /* JSEntityReference.cpp */, > 93F9B7730BA5FDDC00854064 /* JSEntityReference.h */, >+ FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */, >+ FE80DA600E9C4703000D6F75 /* JSGeolocation.h */, >+ FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */, >+ FE80DA620E9C4703000D6F75 /* JSGeoposition.h */, > BCD9C2BC0C17B69E005C90A2 /* JSNamedNodeMap.cpp */, > BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */, > 14DC0D3509FED073007B0235 /* JSNode.cpp */, >@@ -11769,6 +11845,10 @@ > BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */, > 65DF31E909D1CC60000BE325 /* JSNotation.cpp */, > 65DF31EA09D1CC60000BE325 /* JSNotation.h */, >+ FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */, >+ FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */, >+ FE80DA6F0E9C472F000D6F75 /* JSPositionOptions.cpp */, >+ FE80DA700E9C472F000D6F75 /* JSPositionOptions.h */, > 65DF31EB09D1CC60000BE325 /* JSProcessingInstruction.cpp */, > 65DF31EC09D1CC60000BE325 /* JSProcessingInstruction.h */, > E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */, >@@ -12833,6 +12913,10 @@ > BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */, > BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */, > BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */, >+ FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */, >+ FE80D7A30E9C1ED2000D6F75 /* JSCustomPositionCallback.h */, >+ FE80D7A40E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp */, >+ FE80D7A50E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h */, > 51EC925B0CE90DD400F90308 /* JSCustomSQLStatementCallback.cpp */, > 51EC925C0CE90DD400F90308 /* JSCustomSQLStatementCallback.h */, > 51EC925D0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp */, >@@ -12852,6 +12936,7 @@ > BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, > BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, > BC3B7B200E91AAF400D54065 /* JSEventTargetNodeCustom.cpp */, >+ FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */, > BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, > BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */, > BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */, >@@ -13162,6 +13247,8 @@ > 066C772A0AB603B700238CC4 /* FileChooser.h */, > 514B3F720C722047000530DF /* FileSystem.h */, > BC073BA90C399B1F000F5979 /* FloatConversion.h */, >+ FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */, >+ FEAB90110EA51B9C006348C3 /* GeolocationService.h */, > BC3BC29B0E91AB0F00835588 /* HostWindow.h */, > 6593923509AE4346002C531F /* KURL.cpp */, > 6593923609AE4346002C531F /* KURL.h */, >@@ -15975,6 +16062,18 @@ > 1C81BA0C0E97348300266E07 /* JavaScriptDebugListener.h in Headers */, > 1C81BA0E0E97348300266E07 /* JavaScriptDebugServer.h in Headers */, > BC3BE12B0E98092F00835588 /* PopupMenuStyle.h in Headers */, >+ FE80D7A80E9C1ED2000D6F75 /* JSCustomPositionCallback.h in Headers */, >+ FE80D7AA0E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h in Headers */, >+ FE80D7C60E9C1F25000D6F75 /* Geolocation.h in Headers */, >+ FE80D7C90E9C1F25000D6F75 /* Geoposition.h in Headers */, >+ FE80D7CB0E9C1F25000D6F75 /* PositionCallback.h in Headers */, >+ FE80D7CD0E9C1F25000D6F75 /* PositionError.h in Headers */, >+ FE80D7CF0E9C1F25000D6F75 /* PositionErrorCallback.h in Headers */, >+ FE80D7D10E9C1F25000D6F75 /* PositionOptions.h in Headers */, >+ FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */, >+ FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */, >+ FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */, >+ FE80DA740E9C472F000D6F75 /* JSPositionOptions.h in Headers */, > BC3BE9940E9C1C7C00835588 /* RenderScrollbar.h in Headers */, > BC3BE9950E9C1C7C00835588 /* RenderScrollbarPart.h in Headers */, > BC3BE9990E9C1E5D00835588 /* RenderScrollbarTheme.h in Headers */, >@@ -15982,6 +16081,7 @@ > 1CF6BE150E9BB4670025E1CD /* ObjCNodeFilterCondition.h in Headers */, > A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */, > 939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */, >+ FEAB90130EA51B9C006348C3 /* GeolocationService.h in Headers */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >@@ -16095,6 +16195,12 @@ > 85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */, > 1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */, > 1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */, >+ FE80D7C70E9C1F25000D6F75 /* Geolocation.idl in Resources */, >+ FE80D7CA0E9C1F25000D6F75 /* Geoposition.idl in Resources */, >+ FE80D7CC0E9C1F25000D6F75 /* PositionCallback.idl in Resources */, >+ FE80D7CE0E9C1F25000D6F75 /* PositionError.idl in Resources */, >+ FE80D7D00E9C1F25000D6F75 /* PositionErrorCallback.idl in Resources */, >+ FE80D7D20E9C1F25000D6F75 /* PositionOptions.idl in Resources */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >@@ -17842,6 +17948,15 @@ > 1C81BA020E9733CB00266E07 /* JavaScriptProfile.cpp in Sources */, > 1C81BA090E97348300266E07 /* JavaScriptCallFrame.cpp in Sources */, > 1C81BA0D0E97348300266E07 /* JavaScriptDebugServer.cpp in Sources */, >+ FE80D7A70E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp in Sources */, >+ FE80D7A90E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp in Sources */, >+ FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */, >+ FE80D7C50E9C1F25000D6F75 /* Geolocation.cpp in Sources */, >+ FE80D7C80E9C1F25000D6F75 /* Geoposition.cpp in Sources */, >+ FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */, >+ FE80DA650E9C4703000D6F75 /* JSGeoposition.cpp in Sources */, >+ FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */, >+ FE80DA730E9C472F000D6F75 /* JSPositionOptions.cpp in Sources */, > BC3BE9930E9C1C7C00835588 /* RenderScrollbar.cpp in Sources */, > BC3BE9A50E9C239600835588 /* RenderScrollbarTheme.cpp in Sources */, > BC3BE9AB0E9C242000835588 /* RenderScrollbarPart.cpp in Sources */, >@@ -17849,6 +17964,7 @@ > 1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */, > BC80FA130EA287B000B0821D /* Length.cpp in Sources */, > 939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */, >+ FEAB90120EA51B9C006348C3 /* GeolocationService.cpp in Sources */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >Index: WebCore/bindings/js/JSCustomPositionCallback.cpp >=================================================================== >--- WebCore/bindings/js/JSCustomPositionCallback.cpp (revision 0) >+++ WebCore/bindings/js/JSCustomPositionCallback.cpp (revision 0) >@@ -0,0 +1,86 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 "JSCustomPositionCallback.h" >+#include "Console.h" >+#include "CString.h" >+#include "Frame.h" >+#include "JSGeoposition.h" >+#include "Page.h" >+#include "ScriptController.h" >+#include <kjs/JSLock.h> >+ >+namespace WebCore { >+ >+using namespace JSC; >+ >+JSCustomPositionCallback::JSCustomPositionCallback(JSObject* callback, Frame* frame) >+ : m_callback(callback) >+ , m_frame(frame) >+{ >+} >+ >+void JSCustomPositionCallback::handleEvent(Geoposition* geoposition, bool& raisedException) >+{ >+ ASSERT(m_callback); >+ ASSERT(m_frame); >+ >+ if (!m_frame->script()->isEnabled()) >+ return; >+ >+ JSGlobalObject* globalObject = m_frame->script()->globalObject(); >+ ExecState* exec = globalObject->globalExec(); >+ >+ JSC::JSLock lock(false); >+ >+ JSValue* function = m_callback->get(exec, Identifier(exec, "handleEvent")); >+ CallData callData; >+ CallType callType = function->getCallData(callData); >+ if (callType == CallTypeNone) { >+ callType = m_callback->getCallData(callData); >+ if (callType == CallTypeNone) { >+ // FIXME: Should an exception be thrown here? >+ return; >+ } >+ function = m_callback; >+ } >+ >+ RefPtr<JSCustomPositionCallback> protect(this); >+ >+ ArgList args; >+ args.append(toJS(exec, geoposition)); >+ >+ globalObject->startTimeoutCheck(); >+ call(exec, function, callType, callData, m_callback, args); >+ globalObject->stopTimeoutCheck(); >+ >+ if (exec->hadException()) { >+ m_frame->domWindow()->console()->reportCurrentException(exec); >+ raisedException = true; >+ } >+} >+ >+} // namespace WebCore >Index: WebCore/bindings/js/JSCustomPositionCallback.h >=================================================================== >--- WebCore/bindings/js/JSCustomPositionCallback.h (revision 0) >+++ WebCore/bindings/js/JSCustomPositionCallback.h (revision 0) >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 JSCustomPositionCallback_h >+#define JSCustomPositionCallback_h >+ >+#include <kjs/JSObject.h> >+#include <kjs/protect.h> >+#include "PositionCallback.h" >+#include <wtf/Forward.h> >+ >+namespace JSC { >+ class JSObject; >+} >+ >+namespace WebCore { >+ >+class Frame; >+class Geoposition; >+ >+class JSCustomPositionCallback : public PositionCallback { >+public: >+ static PassRefPtr<JSCustomPositionCallback> create(JSC::JSObject* callback, Frame* frame) { return adoptRef(new JSCustomPositionCallback(callback, frame)); } >+ >+ virtual void handleEvent(Geoposition*, bool& raisedException); >+ >+private: >+ JSCustomPositionCallback(JSC::JSObject* callback, Frame*); >+ >+ JSC::ProtectedPtr<JSC::JSObject> m_callback; >+ RefPtr<Frame> m_frame; >+}; >+ >+} // namespace WebCore >+ >+#endif // JSCustomPositionCallback_h >Index: WebCore/bindings/js/JSCustomPositionErrorCallback.cpp >=================================================================== >--- WebCore/bindings/js/JSCustomPositionErrorCallback.cpp (revision 0) >+++ WebCore/bindings/js/JSCustomPositionErrorCallback.cpp (revision 0) >@@ -0,0 +1,84 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 <kjs/JSLock.h> >+#include "JSCustomPositionErrorCallback.h" >+#include "Console.h" >+#include "CString.h" >+#include "Frame.h" >+#include "JSPositionError.h" >+#include "Page.h" >+#include "ScriptController.h" >+ >+namespace WebCore { >+ >+using namespace JSC; >+ >+JSCustomPositionErrorCallback::JSCustomPositionErrorCallback(JSObject* callback, Frame* frame) >+ : m_callback(callback) >+ , m_frame(frame) >+{ >+} >+ >+void JSCustomPositionErrorCallback::handleEvent(PositionError* positionError) >+{ >+ ASSERT(m_callback); >+ ASSERT(m_frame); >+ >+ if (!m_frame->script()->isEnabled()) >+ return; >+ >+ JSGlobalObject* globalObject = m_frame->script()->globalObject(); >+ ExecState* exec = globalObject->globalExec(); >+ >+ JSC::JSLock lock(false); >+ >+ JSValue* function = m_callback->get(exec, Identifier(exec, "handleEvent")); >+ CallData callData; >+ CallType callType = function->getCallData(callData); >+ if (callType == CallTypeNone) { >+ callType = m_callback->getCallData(callData); >+ if (callType == CallTypeNone) { >+ // FIXME: Should an exception be thrown here? >+ return; >+ } >+ function = m_callback; >+ } >+ >+ RefPtr<JSCustomPositionErrorCallback> protect(this); >+ >+ ArgList args; >+ args.append(toJS(exec, positionError)); >+ >+ globalObject->startTimeoutCheck(); >+ call(exec, function, callType, callData, m_callback, args); >+ globalObject->stopTimeoutCheck(); >+ >+ if (exec->hadException()) >+ m_frame->domWindow()->console()->reportCurrentException(exec); >+} >+ >+} // namespace WebCore >Index: WebCore/bindings/js/JSCustomPositionErrorCallback.h >=================================================================== >--- WebCore/bindings/js/JSCustomPositionErrorCallback.h (revision 0) >+++ WebCore/bindings/js/JSCustomPositionErrorCallback.h (revision 0) >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 JSCustomPositionErrorCallback_h >+#define JSCustomPositionErrorCallback_h >+ >+#include "PositionErrorCallback.h" >+#include <kjs/JSObject.h> >+#include <kjs/protect.h> >+#include <wtf/Forward.h> >+ >+namespace JSC { >+ class JSObject; >+} >+ >+namespace WebCore { >+ >+class Frame; >+class PositionError; >+ >+class JSCustomPositionErrorCallback : public PositionErrorCallback { >+public: >+ static PassRefPtr<JSCustomPositionErrorCallback> create(JSC::JSObject* callback, Frame* frame) { return adoptRef(new JSCustomPositionErrorCallback(callback, frame)); } >+ >+ virtual void handleEvent(PositionError*); >+ >+private: >+ JSCustomPositionErrorCallback(JSC::JSObject* callback, Frame*); >+ >+ JSC::ProtectedPtr<JSC::JSObject> m_callback; >+ RefPtr<Frame> m_frame; >+}; >+ >+} // namespace WebCore >+ >+#endif // JSCustomPositionErrorCallback_h >Index: WebCore/bindings/js/JSDOMBinding.cpp >=================================================================== >--- WebCore/bindings/js/JSDOMBinding.cpp (revision 37609) >+++ WebCore/bindings/js/JSDOMBinding.cpp (working copy) >@@ -280,6 +280,16 @@ void updateDOMNodeDocument(Node* node, D > addWrapper(wrapper); > } > >+void markDOMObjectWrapper(JSGlobalData& globalData, void* object) >+{ >+ if (!object) >+ return; >+ DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, object); >+ if (!wrapper || wrapper->marked()) >+ return; >+ wrapper->mark(); >+} >+ > JSValue* jsStringOrNull(ExecState* exec, const String& s) > { > if (s.isNull()) >Index: WebCore/bindings/js/JSDOMBinding.h >=================================================================== >--- WebCore/bindings/js/JSDOMBinding.h (revision 37609) >+++ WebCore/bindings/js/JSDOMBinding.h (working copy) >@@ -69,6 +69,7 @@ namespace WebCore { > void updateDOMNodeDocument(Node*, Document* oldDocument, Document* newDocument); > void markDOMNodesForDocument(Document*); > void markActiveObjectsForDocument(JSC::JSGlobalData&, Document*); >+ void markDOMObjectWrapper(JSC::JSGlobalData& globalData, void* object); > > JSC::StructureID* getCachedDOMStructure(JSC::ExecState*, const JSC::ClassInfo*); > JSC::StructureID* cacheDOMStructure(JSC::ExecState*, PassRefPtr<JSC::StructureID>, const JSC::ClassInfo*); >Index: WebCore/bindings/js/JSDOMWindowCustom.cpp >=================================================================== >--- WebCore/bindings/js/JSDOMWindowCustom.cpp (revision 37609) >+++ WebCore/bindings/js/JSDOMWindowCustom.cpp (working copy) >@@ -41,16 +41,6 @@ using namespace JSC; > > namespace WebCore { > >-static void markDOMObjectWrapper(JSGlobalData& globalData, void* object) >-{ >- if (!object) >- return; >- DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, object); >- if (!wrapper || wrapper->marked()) >- return; >- wrapper->mark(); >-} >- > void JSDOMWindow::mark() > { > Base::mark(); >Index: WebCore/bindings/js/JSGeolocationCustom.cpp >=================================================================== >--- WebCore/bindings/js/JSGeolocationCustom.cpp (revision 0) >+++ WebCore/bindings/js/JSGeolocationCustom.cpp (revision 0) >@@ -0,0 +1,111 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 "JSGeolocation.h" >+#include "DOMWindow.h" >+#include "ExceptionCode.h" >+#include "Geolocation.h" >+#include "JSCustomPositionCallback.h" >+#include "JSCustomPositionErrorCallback.h" >+#include "JSDOMWindow.h" >+#include "JSPositionOptions.h" >+ >+using namespace JSC; >+ >+namespace WebCore { >+ >+JSValue* JSGeolocation::getCurrentPosition(ExecState* exec, const ArgList& args) >+{ >+ // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions >+ RefPtr<PositionCallback> positionCallback; >+ JSObject* object = args.at(exec, 0)->getObject(); >+ if (exec->hadException()) >+ return jsUndefined(); >+ if (!object) { >+ setDOMException(exec, TYPE_MISMATCH_ERR); >+ return jsUndefined(); >+ } >+ >+ if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame()) >+ positionCallback = JSCustomPositionCallback::create(object, frame); >+ >+ RefPtr<PositionErrorCallback> positionErrorCallback; >+ if (!args.at(exec, 1)->isUndefinedOrNull()) { >+ JSObject* object = args.at(exec, 1)->getObject(); >+ if (!object) { >+ setDOMException(exec, TYPE_MISMATCH_ERR); >+ return jsUndefined(); >+ } >+ >+ if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame()) >+ positionErrorCallback = JSCustomPositionErrorCallback::create(object, frame); >+ } >+ >+ RefPtr<PositionOptions> positionOptions; >+ if (!args.at(exec, 2)->isUndefinedOrNull()) >+ positionOptions = toPositionOptions(args.at(exec, 2)); >+ >+ m_impl->getCurrentPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.get()); >+ >+ return jsUndefined(); >+} >+ >+JSValue* JSGeolocation::watchPosition(ExecState* exec, const ArgList& args) >+{ >+ // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions >+ RefPtr<PositionCallback> positionCallback; >+ JSObject* object = args.at(exec, 0)->getObject(); >+ if (exec->hadException()) >+ return jsUndefined(); >+ if (!object) { >+ setDOMException(exec, TYPE_MISMATCH_ERR); >+ return jsUndefined(); >+ } >+ >+ if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame()) >+ positionCallback = JSCustomPositionCallback::create(object, frame); >+ >+ RefPtr<PositionErrorCallback> positionErrorCallback; >+ if (!args.at(exec, 1)->isUndefinedOrNull()) { >+ JSObject* object = args.at(exec, 1)->getObject(); >+ if (!object) { >+ setDOMException(exec, TYPE_MISMATCH_ERR); >+ return jsUndefined(); >+ } >+ >+ if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame()) >+ positionErrorCallback = JSCustomPositionErrorCallback::create(object, frame); >+ } >+ >+ RefPtr<PositionOptions> positionOptions; >+ if (!args.at(exec, 2)->isUndefinedOrNull()) >+ positionOptions = toPositionOptions(args.at(exec, 2)); >+ >+ int w = m_impl->watchPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.get()); >+ return jsNumber(exec, w); >+} >+ >+} // namespace WebCore >Index: WebCore/bindings/js/JSNavigatorCustom.cpp >=================================================================== >--- WebCore/bindings/js/JSNavigatorCustom.cpp (revision 37609) >+++ WebCore/bindings/js/JSNavigatorCustom.cpp (working copy) >@@ -113,4 +113,13 @@ JSValue* JSNavigator::appVersion(ExecSta > return jsString(exec, imp->appVersion()); > } > >+void JSNavigator::mark() >+{ >+ Base::mark(); >+ >+ JSGlobalData& globalData = *Heap::heap(this)->globalData(); >+ >+ markDOMObjectWrapper(globalData, impl()->optionalGeolocation()); >+} >+ > } >Index: WebCore/page/Geolocation.cpp >=================================================================== >--- WebCore/page/Geolocation.cpp (revision 0) >+++ WebCore/page/Geolocation.cpp (revision 0) >@@ -0,0 +1,174 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 "Geolocation.h" >+#include "PositionError.h" >+ >+namespace WebCore { >+ >+Geolocation::GeoNotifier::GeoNotifier(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PositionOptions* options) >+ : m_successCallback(successCallback) >+ , m_errorCallback(errorCallback) >+ , m_timer(this, &Geolocation::GeoNotifier::timerFired) >+{ >+ if (m_errorCallback && options && options->timeout() != -1) >+ m_timer.startOneShot(options->timeout() / 1000.0); >+} >+ >+void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>* timer) >+{ >+ ASSERT(m_errorCallback); >+ >+ m_timer.stop(); >+ >+ RefPtr<PositionError> error = new PositionError(4, "Timed out"); >+ m_errorCallback->handleEvent(error.get()); >+} >+ >+Geolocation::Geolocation(Frame* frame) >+ : m_frame(frame) >+ , m_service(GeolocationService::create(this)) >+{ >+} >+ >+void Geolocation::disconnectFrame() >+{ >+ m_frame = 0; >+} >+ >+void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PositionOptions* options) >+{ >+ RefPtr<GeoNotifier> notifier = new GeoNotifier(successCallback, errorCallback, options); >+ >+ if (!m_service->startUpdating(options)) { >+ if (notifier->m_errorCallback) { >+ RefPtr<PositionError> error = new PositionError(1, "Unable to Start"); >+ notifier->m_errorCallback->handleEvent(error.get()); >+ } >+ return; >+ } >+ >+ m_oneShots.add(notifier); >+} >+ >+int Geolocation::watchPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PositionOptions* options) >+{ >+ RefPtr<GeoNotifier> notifier = new GeoNotifier(successCallback, errorCallback, options); >+ >+ if (!m_service->startUpdating(options)) { >+ if (notifier->m_errorCallback) { >+ RefPtr<PositionError> error = new PositionError(1, "Unable to Start"); >+ notifier->m_errorCallback->handleEvent(error.get()); >+ } >+ return 0; >+ } >+ >+ static int sIdentifier = 0; >+ >+ m_watchers.set(++sIdentifier, notifier); >+ >+ return sIdentifier; >+} >+ >+void Geolocation::clearWatch(int watchId) >+{ >+ RefPtr<GeoNotifier> notifier = m_watchers.get(watchId); >+ if (notifier) >+ m_watchers.remove(watchId); >+ >+ stopUpdatingIfEmpty(); >+} >+ >+void Geolocation::stopUpdatingIfEmpty() >+{ >+ if (m_watchers.isEmpty() && m_oneShots.isEmpty()) >+ m_service->stopUpdating(); >+} >+ >+void Geolocation::handleError(PositionError* error) >+{ >+ GeoNotifierSet::const_iterator oneShotsEnd = m_oneShots.end(); >+ for (GeoNotifierSet::const_iterator it = m_oneShots.begin(); it != oneShotsEnd; ++it) { >+ RefPtr<GeoNotifier> notifier = *it; >+ >+ if (notifier->m_errorCallback) >+ notifier->m_errorCallback->handleEvent(error); >+ } >+ m_oneShots.clear(); >+ >+ GeoNotifierMap::const_iterator watchersEnd = m_watchers.end(); >+ for (GeoNotifierMap::const_iterator it = m_watchers.begin(); it != watchersEnd; ++it) { >+ RefPtr<GeoNotifier> notifier = (*it).second; >+ >+ if (notifier->m_errorCallback) >+ notifier->m_errorCallback->handleEvent(error); >+ } >+} >+ >+void Geolocation::geolocationServicePositionChanged(GeolocationService* service) >+{ >+ ASSERT(service->lastPosition()); >+ >+ bool shouldCallErrorCallback = false; >+ GeoNotifierSet::const_iterator oneShotsEnd = m_oneShots.end(); >+ for (GeoNotifierSet::const_iterator it = m_oneShots.begin(); it != oneShotsEnd; ++it) { >+ RefPtr<GeoNotifier> notifier = *it; >+ ASSERT(notifier->m_successCallback); >+ >+ notifier->m_timer.stop(); >+ notifier->m_successCallback->handleEvent(service->lastPosition(), shouldCallErrorCallback); >+ if (shouldCallErrorCallback) { >+ RefPtr<PositionError> error = new PositionError(5, "JavaScript Error"); >+ handleError(error.get()); >+ return; >+ } >+ } >+ >+ GeoNotifierMap::const_iterator watchersEnd = m_watchers.end(); >+ for (GeoNotifierMap::const_iterator it = m_watchers.begin(); it != watchersEnd; ++it) { >+ RefPtr<GeoNotifier> notifier = (*it).second; >+ ASSERT(notifier->m_successCallback); >+ >+ notifier->m_timer.stop(); >+ notifier->m_successCallback->handleEvent(service->lastPosition(), shouldCallErrorCallback); >+ if (shouldCallErrorCallback) { >+ RefPtr<PositionError> error = new PositionError(5, "JavaScript Error"); >+ handleError(error.get()); >+ return; >+ } >+ } >+ >+ m_oneShots.clear(); >+ stopUpdatingIfEmpty(); >+} >+ >+void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service) >+{ >+ ASSERT(service->lastError()); >+ handleError(service->lastError()); >+} >+ >+} // namespace WebCore >Index: WebCore/page/Geolocation.h >=================================================================== >--- WebCore/page/Geolocation.h (revision 0) >+++ WebCore/page/Geolocation.h (revision 0) >@@ -0,0 +1,90 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 Geolocation_h >+#define Geolocation_h >+ >+#include <wtf/Platform.h> >+#include <wtf/HashMap.h> >+#include <wtf/HashSet.h> >+#include <wtf/OwnPtr.h> >+#include <wtf/PassRefPtr.h> >+#include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+ >+#include "GeolocationService.h" >+#include "PositionCallback.h" >+#include "PositionErrorCallback.h" >+#include "PositionOptions.h" >+#include "Timer.h" >+ >+namespace WebCore { >+ >+class Frame; >+class Geoposition; >+ >+class Geolocation : public RefCounted<Geolocation>, public GeolocationServiceClient { >+public: >+ Geolocation(Frame*); >+ virtual ~Geolocation() {} >+ >+ void disconnectFrame(); >+ >+ Geoposition* lastPosition() const { return m_service->lastPosition(); } >+ >+ void getCurrentPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PositionOptions*); >+ int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PositionOptions*); >+ void clearWatch(int watchId); >+ >+private: >+ class GeoNotifier : public RefCounted<GeoNotifier> { >+ public: >+ GeoNotifier(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PositionOptions*); >+ >+ void timerFired(Timer<GeoNotifier>*); >+ >+ RefPtr<PositionCallback> m_successCallback; >+ RefPtr<PositionErrorCallback> m_errorCallback; >+ Timer<GeoNotifier> m_timer; >+ }; >+ >+ void stopUpdatingIfEmpty(); >+ void handleError(PositionError*); >+ >+ virtual void geolocationServicePositionChanged(GeolocationService*); >+ virtual void geolocationServiceErrorOccurred(GeolocationService*); >+ >+ typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet; >+ typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap; >+ >+ GeoNotifierSet m_oneShots; >+ GeoNotifierMap m_watchers; >+ Frame* m_frame; >+ OwnPtr<GeolocationService> m_service; >+}; >+ >+} // namespace WebCore >+ >+#endif // Geolocation_h >Index: WebCore/page/Geolocation.idl >=================================================================== >--- WebCore/page/Geolocation.idl (revision 0) >+++ WebCore/page/Geolocation.idl (revision 0) >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 core { >+ >+ interface [ >+ GenerateConstructor >+ ] Geolocation { >+ readonly attribute Geoposition lastPosition; >+ >+ [Custom] void getCurrentPosition(in PositionCallback successCallback, in PositionErrorCallback errorCallback, in PositionOptions options); >+ >+ [Custom] long watchPosition(in PositionCallback successCallback, in PositionErrorCallback errorCallback, in PositionOptions options); >+ >+ void clearWatch(in long watchId); >+ }; >+ >+} >Index: WebCore/page/Geoposition.cpp >=================================================================== >--- WebCore/page/Geoposition.cpp (revision 0) >+++ WebCore/page/Geoposition.cpp (revision 0) >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 "Geoposition.h" >+ >+namespace WebCore { >+ >+String Geoposition::toString() const >+{ >+ return String::format("position(%.6lg, %.6lg, %.6lg %.6lg %.6lg %.6lg %.6lg %.lld)", >+ m_latitude, m_longitude, m_altitude, m_accuracy, >+ m_altitudeAccuracy, m_heading, m_velocity, m_timestamp); >+} >+ >+} // namespace WebCore >Index: WebCore/page/Geoposition.h >=================================================================== >--- WebCore/page/Geoposition.h (revision 0) >+++ WebCore/page/Geoposition.h (revision 0) >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 Geoposition_h >+#define Geoposition_h >+ >+#include "Event.h" >+#include "PlatformString.h" >+#include <wtf/Platform.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+typedef int ExceptionCode; >+ >+class Geoposition : public RefCounted<Geoposition> { >+public: >+ Geoposition(double latitude, double longitude, double altitude, double accuracy, double altitudeAccuracy, double heading, double velocity, DOMTimeStamp timestamp) >+ : m_latitude(latitude) >+ , m_longitude(longitude) >+ , m_altitude(altitude) >+ , m_accuracy(accuracy) >+ , m_altitudeAccuracy(altitudeAccuracy) >+ , m_heading(heading) >+ , m_velocity(velocity) >+ , m_timestamp(timestamp) >+ { >+ } >+ >+ double latitude() const { return m_latitude; } >+ double longitude() const { return m_longitude; } >+ double altitude() const { return m_altitude; } >+ double accuracy() const { return m_accuracy; } >+ double altitudeAccuracy() const { return m_altitudeAccuracy; } >+ double heading() const { return m_heading; } >+ double velocity() const { return m_velocity; } >+ DOMTimeStamp timestamp() const { return m_timestamp; } >+ >+ String toString() const; >+ >+private: >+ double m_latitude; >+ double m_longitude; >+ double m_altitude; >+ double m_accuracy; >+ double m_altitudeAccuracy; >+ double m_heading; >+ double m_velocity; >+ DOMTimeStamp m_timestamp; >+}; >+ >+} // namespace WebCore >+ >+#endif // Geoposition_h >Index: WebCore/page/Geoposition.idl >=================================================================== >--- WebCore/page/Geoposition.idl (revision 0) >+++ WebCore/page/Geoposition.idl (revision 0) >@@ -0,0 +1,42 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 core { >+ >+ interface [ >+ GenerateConstructor >+ ] Geoposition { >+ readonly attribute double latitude; >+ readonly attribute double longitude; >+ readonly attribute double altitude; >+ readonly attribute double accuracy; >+ readonly attribute double altitudeAccuracy; >+ readonly attribute double heading >+ readonly attribute double velocity >+ readonly attribute DOMTimeStamp timestamp; >+ >+ [DontEnum] DOMString toString(); >+ }; >+} >Index: WebCore/page/Navigator.cpp >=================================================================== >--- WebCore/page/Navigator.cpp (revision 37609) >+++ WebCore/page/Navigator.cpp (working copy) >@@ -27,6 +27,7 @@ > #include "Frame.h" > #include "FrameLoader.h" > #include "FrameLoaderClient.h" >+#include "Geolocation.h" > #include "Language.h" > #include "MimeTypeArray.h" > #include "NetworkStateNotifier.h" >@@ -87,6 +88,10 @@ void Navigator::disconnectFrame() > m_mimeTypes->disconnectFrame(); > m_mimeTypes = 0; > } >+ if (m_geolocation) { >+ m_geolocation->disconnectFrame(); >+ m_geolocation = 0; >+ } > m_frame = 0; > } > >@@ -197,4 +202,18 @@ bool Navigator::onLine() const > return networkStateNotifier().onLine(); > } > >+Geolocation* Navigator::geolocation() const >+{ >+#if ENABLE(GEOLOCATION) >+ if (GeolocationService::isAvailable()) { >+ if (!m_geolocation) >+ m_geolocation = new Geolocation(m_frame); >+ return m_geolocation.get(); >+ } else >+ return 0; >+#else >+ return 0; >+#endif >+} >+ > } // namespace WebCore >Index: WebCore/page/Navigator.h >=================================================================== >--- WebCore/page/Navigator.h (revision 37609) >+++ WebCore/page/Navigator.h (working copy) >@@ -27,6 +27,7 @@ > namespace WebCore { > > class Frame; >+ class Geolocation; > class MimeTypeArray; > class PluginData; > class PluginArray; >@@ -56,11 +57,15 @@ namespace WebCore { > bool javaEnabled() const; > > bool onLine() const; >+ Geolocation* geolocation() const; >+ // This is used for GC marking. >+ Geolocation* optionalGeolocation() const { return m_geolocation.get(); } > private: > Navigator(Frame*); > Frame* m_frame; > mutable RefPtr<PluginArray> m_plugins; > mutable RefPtr<MimeTypeArray> m_mimeTypes; >+ mutable RefPtr<Geolocation> m_geolocation; > }; > > } >Index: WebCore/page/Navigator.idl >=================================================================== >--- WebCore/page/Navigator.idl (revision 37609) >+++ WebCore/page/Navigator.idl (working copy) >@@ -19,7 +19,9 @@ > > module window { > >- interface Navigator { >+ interface [ >+ CustomMarkFunction >+ ] Navigator { > readonly attribute DOMString appCodeName; > readonly attribute DOMString appName; > readonly attribute [CustomGetter] DOMString appVersion; >@@ -36,6 +38,9 @@ module window { > boolean javaEnabled(); > > readonly attribute boolean onLine; >+#if ENABLE_GEOLOCATION >+ readonly attribute Geolocation geolocation; >+#endif > }; > > } >Index: WebCore/page/PositionCallback.h >=================================================================== >--- WebCore/page/PositionCallback.h (revision 0) >+++ WebCore/page/PositionCallback.h (revision 0) >@@ -0,0 +1,44 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 PositionCallback_h >+#define PositionCallback_h >+ >+#include <wtf/Platform.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+ class Geoposition; >+ >+ class PositionCallback : public RefCounted<PositionCallback> { >+ public: >+ virtual ~PositionCallback() { } >+ virtual void handleEvent(Geoposition* position, bool& raisedException) = 0; >+ }; >+ >+} // namespace WebCore >+ >+#endif // PositionCallback_h >Index: WebCore/page/PositionCallback.idl >=================================================================== >--- WebCore/page/PositionCallback.idl (revision 0) >+++ WebCore/page/PositionCallback.idl (revision 0) >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 core { >+ >+ interface [ >+ GenerateConstructor >+ ] PositionCallback { >+ void handleEvent(in Geoposition position); >+ }; >+ >+} >Index: WebCore/page/PositionError.h >=================================================================== >--- WebCore/page/PositionError.h (revision 0) >+++ WebCore/page/PositionError.h (revision 0) >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 PositionError_h >+#define PositionError_h >+ >+#include "PlatformString.h" >+#include <wtf/Platform.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class PositionError : public RefCounted<PositionError> { >+public: >+ PositionError(int code, const String& message) >+ : m_code(code) >+ , m_message(message) >+ { >+ } >+ >+ int code() const { return m_code; } >+ void setCode(int code) { m_code = code; } >+ const String& message() const { return m_message; } >+ void setMessage(const String& message) { m_message = message; } >+ >+private: >+ int m_code; >+ String m_message; >+}; >+ >+} // namespace WebCore >+ >+#endif // PositionError_h >Index: WebCore/page/PositionError.idl >=================================================================== >--- WebCore/page/PositionError.idl (revision 0) >+++ WebCore/page/PositionError.idl (revision 0) >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 core { >+ >+ interface [ >+ GenerateConstructor >+ ] PositionError { >+ readonly attribute long code; >+ readonly attribute DOMString message; >+ }; >+ >+} >Index: WebCore/page/PositionErrorCallback.h >=================================================================== >--- WebCore/page/PositionErrorCallback.h (revision 0) >+++ WebCore/page/PositionErrorCallback.h (revision 0) >@@ -0,0 +1,44 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 PositionErrorCallback_h >+#define PositionErrorCallback_h >+ >+#include <wtf/Platform.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+ class PositionError; >+ >+ class PositionErrorCallback : public RefCounted<PositionErrorCallback> { >+ public: >+ virtual ~PositionErrorCallback() { } >+ virtual void handleEvent(PositionError* position) = 0; >+ }; >+ >+} // namespace WebCore >+ >+#endif // PositionErrorCallback_h >Index: WebCore/page/PositionErrorCallback.idl >=================================================================== >--- WebCore/page/PositionErrorCallback.idl (revision 0) >+++ WebCore/page/PositionErrorCallback.idl (revision 0) >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 core { >+ >+ interface [ >+ GenerateConstructor >+ ] PositionErrorCallback { >+ void handleEvent(in PositionError error); >+ }; >+ >+} >Index: WebCore/page/PositionOptions.h >=================================================================== >--- WebCore/page/PositionOptions.h (revision 0) >+++ WebCore/page/PositionOptions.h (revision 0) >@@ -0,0 +1,54 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 PositionOptions_h >+#define PositionOptions_h >+ >+#include <wtf/Platform.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+ class PositionOptions : public RefCounted<PositionOptions> { >+ public: >+ PositionOptions(bool highAccuracy = false, long timeout = -1) >+ : m_highAccuracy(highAccuracy) >+ , m_timeout(timeout) >+ { >+ } >+ >+ bool enableHighAccuracy() const { return m_highAccuracy; } >+ void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } >+ long timeout() const { return m_timeout; } >+ void setTimeout(long t) { m_timeout = t; } >+ >+ private: >+ bool m_highAccuracy; >+ long m_timeout; >+ }; >+ >+} // namespace WebCore >+ >+#endif // PositionOptions_h >Index: WebCore/page/PositionOptions.idl >=================================================================== >--- WebCore/page/PositionOptions.idl (revision 0) >+++ WebCore/page/PositionOptions.idl (revision 0) >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 core { >+ >+ interface [ >+ GenerateConstructor >+ ] PositionOptions { >+ attribute boolean enableHighAccuracy; >+ attribute long timeout; >+ }; >+ >+} >Index: WebCore/platform/GeolocationService.cpp >=================================================================== >--- WebCore/platform/GeolocationService.cpp (revision 0) >+++ WebCore/platform/GeolocationService.cpp (revision 0) >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 "GeolocationService.h" >+#include "Geoposition.h" >+#include "PositionError.h" >+#include "PositionOptions.h" >+ >+namespace WebCore { >+ >+GeolocationService::GeolocationService(GeolocationServiceClient* client) >+ : m_geolocationServiceClient(client) >+{ >+} >+ >+void GeolocationService::positionChanged() >+{ >+ if (m_geolocationServiceClient) >+ m_geolocationServiceClient->geolocationServicePositionChanged(this); >+} >+ >+void GeolocationService::errorOccurred() >+{ >+ if (m_geolocationServiceClient) >+ m_geolocationServiceClient->geolocationServiceErrorOccurred(this); >+} >+ >+} // namespace WebCore >Index: WebCore/platform/GeolocationService.h >=================================================================== >--- WebCore/platform/GeolocationService.h (revision 0) >+++ WebCore/platform/GeolocationService.h (revision 0) >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2008 Apple 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. ``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 >+ * 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 GeolocationService_h >+#define GeolocationService_h >+ >+#include <wtf/Noncopyable.h> >+ >+namespace WebCore { >+ >+class GeolocationService; >+class Geoposition; >+class PositionError; >+class PositionOptions; >+ >+class GeolocationServiceClient >+{ >+public: >+ virtual ~GeolocationServiceClient() { } >+ virtual void geolocationServicePositionChanged(GeolocationService*) { } >+ virtual void geolocationServiceErrorOccurred(GeolocationService*) { } >+}; >+ >+class GeolocationService : public Noncopyable { >+public: >+ static GeolocationService* create(GeolocationServiceClient*); >+ virtual ~GeolocationService() {} >+ >+ static bool isAvailable(); >+ >+ virtual bool startUpdating(PositionOptions*) = 0; >+ virtual void stopUpdating() = 0; >+ >+ virtual Geoposition* lastPosition() const = 0; >+ virtual PositionError* lastError() const = 0; >+ >+ void positionChanged(); >+ void errorOccurred(); >+ >+protected: >+ GeolocationService(GeolocationServiceClient*); >+ >+private: >+ GeolocationServiceClient* m_geolocationServiceClient; >+}; >+ >+} // namespace WebCore >+ >+#endif // GeolocationService_h >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 37609) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,21 @@ >+2008-10-15 Greg Bolsinga <bolsinga@apple.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=21475 >+ >+ Provide support for the Geolocation API >+ >+ http://dev.w3.org/geo/api/spec-source.html >+ >+ Test for when geolocation is NOT implemented, to verify it doesn't leak in when built. >+ >+ * geolocation: Added. >+ * geolocation/geolocation-not-implemented-expected.txt: Added. >+ * geolocation/geolocation-not-implemented.html: Added. >+ * geolocation/geolocation-test.js: Copied from LayoutTests/media/video-test.js. >+ (relativeURL): >+ > 2008-10-14 Pamela Greene <pam@chromium.org> > > Add test to verify popup properties while they're opening. >Index: LayoutTests/geolocation/geolocation-not-implemented-expected.txt >=================================================================== >--- LayoutTests/geolocation/geolocation-not-implemented-expected.txt (revision 0) >+++ LayoutTests/geolocation/geolocation-not-implemented-expected.txt (revision 0) >@@ -0,0 +1,5 @@ >+TEST(navigator.geolocation === undefined) OK >+TEST(navigator.geolocation == null) OK >+TEST(hasGeolocationProperty == false) OK >+END OF TEST >+ >Index: LayoutTests/geolocation/geolocation-not-implemented.html >=================================================================== >--- LayoutTests/geolocation/geolocation-not-implemented.html (revision 0) >+++ LayoutTests/geolocation/geolocation-not-implemented.html (revision 0) >@@ -0,0 +1,14 @@ >+<body></body> >+<script src=geolocation-test.js></script> >+<script> >+test("navigator.geolocation === undefined"); >+test("navigator.geolocation == null"); >+var hasGeolocationProperty = false; >+for (var property in navigator) { >+ hasGeolocationProperty = (property == "geolocation"); >+ if (hasGeolocationProperty) >+ break; >+} >+test("hasGeolocationProperty == false"); >+endTest(); >+</script> >Index: LayoutTests/geolocation/geolocation-test.js >=================================================================== >--- LayoutTests/geolocation/geolocation-test.js (revision 37606) (from LayoutTests/media/video-test.js:37606) >+++ LayoutTests/geolocation/geolocation-test.js (working copy) >@@ -0,0 +1,158 @@ >+if (window.layoutTestController) { >+ layoutTestController.dumpAsText(); >+ layoutTestController.waitUntilDone(); >+} >+var video; >+var media; >+var console = document.createElement('div'); >+document.body.appendChild(console); >+try { >+ video = document.getElementsByTagName('video')[0]; >+ if (video) >+ media = video; >+} catch (ex) { } >+ >+function hanged() >+{ >+ consoleWrite("FAIL: timed out"); >+ if (window.layoutTestController) >+ layoutTestController.notifyDone(); >+} >+setTimeout(hanged, 10000); >+ >+function testAndEnd(testFuncString) >+{ >+ test(testFuncString, true); >+} >+ >+function test(testFuncString, endit) >+{ >+ if (eval(testFuncString)) >+ consoleWrite("TEST(" + testFuncString + ") <span style='color:green'>OK</span>"); >+ else >+ consoleWrite("TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>"); >+ >+ if (endit) >+ endTest(); >+} >+ >+function testExpected(testFuncString, expected) >+{ >+ try { >+ var observed = eval(testFuncString); >+ } catch (ex) { >+ consoleWrite(ex); >+ return; >+ } >+ >+ var msg = "expected " + testFuncString + "=='" + expected + "', observed '" + observed + "'"; >+ >+ if (observed == expected) >+ consoleWrite(msg + " - <span style='color:green'>OK</span>"); >+ else >+ consoleWrite(msg + " - <span style='color:red'>FAIL</span>"); >+} >+ >+function run(testFuncString) >+{ >+ consoleWrite("RUN(" + testFuncString + ")"); >+ try { >+ eval(testFuncString); >+ } catch (ex) { >+ consoleWrite(ex); >+ } >+} >+ >+function waitForEventAndEnd(eventName, funcString) >+{ >+ waitForEvent(eventName, funcString, true) >+} >+ >+function waitForEvent(eventName, func, endit) >+{ >+ function _eventCallback(event) >+ { >+ consoleWrite("EVENT(" + eventName + ")"); >+ >+ if (func) >+ func(); >+ >+ if (endit) >+ endTest(); >+ } >+ >+ media.addEventListener(eventName, _eventCallback); >+} >+ >+function waitForEventTestAndEnd(eventName, testFuncString) >+{ >+ waitForEventAndTest(eventName, testFuncString, true); >+} >+ >+function waitForEventAndFail(eventName) >+{ >+ waitForEventAndTest(eventName, "false", true); >+} >+ >+function waitForEventAndTest(eventName, testFuncString, endit) >+{ >+ function _eventCallback(event) >+ { >+ if (eval(testFuncString)) >+ consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:green'>OK</span>"); >+ else >+ consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>"); >+ >+ if (endit) >+ endTest(); >+ } >+ >+ media.addEventListener(eventName, _eventCallback); >+} >+ >+function testException(testString, exceptionString) >+{ >+ try { >+ eval(testString); >+ } catch (ex) { >+ if (ex.code == eval(exceptionString)) >+ consoleWrite("TEST(" + testString + ") THROWS("+exceptionString+") <span style='color:green'>OK</span>"); >+ else >+ consoleWrite("TEST(" + testString + ") THROWS("+exceptionString+") <span style='color:red'>FAIL</span>"); >+ } >+} >+ >+var testEnded = false; >+ >+function endTest() >+{ >+ consoleWrite("END OF TEST"); >+ testEnded = true; >+ if (window.layoutTestController) >+ layoutTestController.notifyDone(); >+} >+ >+function endTestLater() >+{ >+ setTimeout(endTest, 250); >+} >+ >+function failTestIn(ms) >+{ >+ setTimeout(function () { >+ consoleWrite("FAIL: did not end fast enough"); >+ endTest(); >+ }, ms); >+} >+ >+function consoleWrite(text) >+{ >+ if (testEnded) >+ return; >+ console.innerHTML += text + "<br>"; >+} >+ >+function relativeURL(url) >+{ >+ return url.substr(url.indexOf('/media/')+7); >+} >\ No newline at end of file >Index: LayoutTests/geolocation/geolocation-test.js >=================================================================== >--- LayoutTests/geolocation/geolocation-test.js (revision 0) >+++ LayoutTests/geolocation/geolocation-test.js (working copy) >@@ -2,15 +2,8 @@ if (window.layoutTestController) { > layoutTestController.dumpAsText(); > layoutTestController.waitUntilDone(); > } >-var video; >-var media; > var console = document.createElement('div'); > document.body.appendChild(console); >-try { >- video = document.getElementsByTagName('video')[0]; >- if (video) >- media = video; >-} catch (ex) { } > > function hanged() > { >@@ -63,53 +56,6 @@ function run(testFuncString) > } > } > >-function waitForEventAndEnd(eventName, funcString) >-{ >- waitForEvent(eventName, funcString, true) >-} >- >-function waitForEvent(eventName, func, endit) >-{ >- function _eventCallback(event) >- { >- consoleWrite("EVENT(" + eventName + ")"); >- >- if (func) >- func(); >- >- if (endit) >- endTest(); >- } >- >- media.addEventListener(eventName, _eventCallback); >-} >- >-function waitForEventTestAndEnd(eventName, testFuncString) >-{ >- waitForEventAndTest(eventName, testFuncString, true); >-} >- >-function waitForEventAndFail(eventName) >-{ >- waitForEventAndTest(eventName, "false", true); >-} >- >-function waitForEventAndTest(eventName, testFuncString, endit) >-{ >- function _eventCallback(event) >- { >- if (eval(testFuncString)) >- consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:green'>OK</span>"); >- else >- consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>"); >- >- if (endit) >- endTest(); >- } >- >- media.addEventListener(eventName, _eventCallback); >-} >- > function testException(testString, exceptionString) > { > try { >@@ -154,5 +100,5 @@ function consoleWrite(text) > > function relativeURL(url) > { >- return url.substr(url.indexOf('/media/')+7); >+ return url.substr(url.indexOf('/geolocation/')+13); > } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 21475
:
24244
|
24253
|
24264
|
24267
|
24339
|
24350
|
24365
|
24400
|
24425
|
24463
|
24627