WebKit Bugzilla
Attachment 348330 Details for
Bug 189044
: Add specialized template declarations of HashTraits and DefaultHash to detect misuse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189044-20180828132841.patch (text/plain), 13.91 KB, created by
Ross Kirsling
on 2018-08-28 13:28:42 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ross Kirsling
Created:
2018-08-28 13:28:42 PDT
Size:
13.91 KB
patch
obsolete
>Subversion Revision: 235427 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 96cac60b419914fc89ec507f98148a39e6407742..814804c8658e446c75bb442ff5d35994e492eabb 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-08-28 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ Add specialize template declarations of HashTraits and DefaultHash to detect misuse >+ https://bugs.webkit.org/show_bug.cgi?id=189044 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/BitVector.h: Removed unnecessarily HashTraits declaration. >+ * wtf/MetaAllocatorPtr.h: Ditto. >+ * wtf/HashIterators.h: Added #include <wtf/KeyValuePair.h>. >+ * wtf/IndexSparseSet.h: Removed unused #include <wtf/HashTraits.h>. >+ * wtf/LoggingHashMap.h: Removed unused #include <wtf/LoggingHashTraits.h>. >+ * wtf/StackShot.h: Added #include <wtf/HashTraits.h> because this header uses SimpleClassHashTraits. >+ Removed Removed unnecessarily HashTraits declaration. >+ > 2018-08-27 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > [WebAssembly] Parse wasm modules in a streaming fashion >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a38329957887d7526be5f7d89c364106391caa4d..9cc9ca14ed17cf8d608919a02209197c73324697 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2018-08-28 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ Add specialize template declarations of HashTraits and DefaultHash to detect misuse >+ https://bugs.webkit.org/show_bug.cgi?id=189044 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Some classes have a separate header for specializations of >+ WTF::HashTraits and WTF::DefaultHash to reduce the number of >+ header files included. For example, ColorHash.h and Color.h. >+ >+ If someone is mistakenly using hash without including the >+ specialization header, the linker would silently produce an >+ broken executable. (Bug 188893) >+ >+ No new tests (Covered by existing tests). >+ >+ * Modules/webdatabase/SQLResultSetRowList.h: Removed unused #include <wtf/HashTraits.h>. >+ * bindings/js/SerializedScriptValue.cpp: Ditto. >+ * page/DebugPageOverlays.cpp: Added #include "ColorHash.h". >+ * platform/URLHash.h: Added DefaultHash<URL> specialization definition. >+ * platform/URL.h: Added specialize template declarations. >+ * platform/graphics/Color.h: Ditto. >+ * platform/graphics/FloatSize.h: Ditto. >+ * platform/graphics/IntPoint.h: Ditto. >+ * platform/graphics/IntSize.h: Ditto. >+ * platform/network/ProtectionSpace.h: Ditto. >+ * platform/network/ProtectionSpaceHash.h: Removed unnecessarily DefaultHash declaration. >+ * platform/mediastream/mac/AVVideoCaptureSource.h: Added #include "IntSizeHash.h". >+ > 2018-08-28 Aditya Keerthi <akeerthi@apple.com> > > [iOS] Support inputmode=none >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6694ed1bf6797ae0afc3814c83b20b2f7bf93b6c..3d79e766b8e7cc8d726180577350ce9e38a4f3ba 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,12 @@ >+2018-08-28 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ Add specialize template declarations of HashTraits and DefaultHash to detect misuse >+ https://bugs.webkit.org/show_bug.cgi?id=189044 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/WebPage/WebPage.h: Added #include <WebCore/IntPointHash.h>. >+ > 2018-08-28 Aditya Keerthi <akeerthi@apple.com> > > [Datalist] Pressing enter without a selected option shouldn't change the input >diff --git a/Source/WTF/wtf/BitVector.h b/Source/WTF/wtf/BitVector.h >index 8c8bdd7349b09556cd489d05c98b9bcb3f2ff8bf..c389e04c6c2c400d43d72d0fdb4c93fa30dfdcc4 100644 >--- a/Source/WTF/wtf/BitVector.h >+++ b/Source/WTF/wtf/BitVector.h >@@ -482,7 +482,6 @@ template<> struct DefaultHash<BitVector> { > typedef BitVectorHash Hash; > }; > >-template<typename T> struct HashTraits; > template<> struct HashTraits<BitVector> : public CustomHashTraits<BitVector> { }; > > } // namespace WTF >diff --git a/Source/WTF/wtf/HashIterators.h b/Source/WTF/wtf/HashIterators.h >index 318a8496c6605ed0d7d8ad9241ce8eb17f7dc6b9..9c1bbddf94f9a724df7fa6d4ac4c0ff6deb0626f 100644 >--- a/Source/WTF/wtf/HashIterators.h >+++ b/Source/WTF/wtf/HashIterators.h >@@ -26,6 +26,7 @@ > #pragma once > > #include <iterator> >+#include <wtf/KeyValuePair.h> > > namespace WTF { > >diff --git a/Source/WTF/wtf/IndexSparseSet.h b/Source/WTF/wtf/IndexSparseSet.h >index bce4588c15cf3dffe244058381579a99e1d03e81..f0e93944ccba5119a37b482a1608ca9bf6100ce5 100644 >--- a/Source/WTF/wtf/IndexSparseSet.h >+++ b/Source/WTF/wtf/IndexSparseSet.h >@@ -26,7 +26,6 @@ > #ifndef IndexSparseSet_h > #define IndexSparseSet_h > >-#include <wtf/HashTraits.h> > #include <wtf/Vector.h> > > namespace WTF { >diff --git a/Source/WTF/wtf/LoggingHashMap.h b/Source/WTF/wtf/LoggingHashMap.h >index ff8e790fa3efae84d8877f47efa45937d6636f37..5b6e6218f45fd12c33576f34ea3a98828cc0e98b 100644 >--- a/Source/WTF/wtf/LoggingHashMap.h >+++ b/Source/WTF/wtf/LoggingHashMap.h >@@ -28,7 +28,6 @@ > #include <wtf/DataLog.h> > #include <wtf/HashMap.h> > #include <wtf/LoggingHashID.h> >-#include <wtf/LoggingHashTraits.h> > > namespace WTF { > >diff --git a/Source/WTF/wtf/MetaAllocatorPtr.h b/Source/WTF/wtf/MetaAllocatorPtr.h >index 5be74a0cf9c711478bb022f90307121013c95dd9..d22e611e210fa12fe1836f3ef0beca08e1ee097a 100644 >--- a/Source/WTF/wtf/MetaAllocatorPtr.h >+++ b/Source/WTF/wtf/MetaAllocatorPtr.h >@@ -114,7 +114,6 @@ template<PtrTag tag> struct DefaultHash<MetaAllocatorPtr<tag>> { > typedef MetaAllocatorPtrHash<tag> Hash; > }; > >-template<typename T> struct HashTraits; > template<PtrTag tag> struct HashTraits<MetaAllocatorPtr<tag>> : public CustomHashTraits<MetaAllocatorPtr<tag>> { }; > > } // namespace WTF >diff --git a/Source/WTF/wtf/StackShot.h b/Source/WTF/wtf/StackShot.h >index 7e32a35bae3c7b56a8be85b7d18d1e5579a0b3fc..7b3ad9243b9ade2714ed6064255485025455b134 100644 >--- a/Source/WTF/wtf/StackShot.h >+++ b/Source/WTF/wtf/StackShot.h >@@ -26,6 +26,7 @@ > #pragma once > > #include <wtf/Assertions.h> >+#include <wtf/HashTraits.h> > #include <wtf/UniqueArray.h> > > namespace WTF { >@@ -123,7 +124,6 @@ template<> struct DefaultHash<StackShot> { > typedef StackShotHash Hash; > }; > >-template<typename T> struct HashTraits; > template<> struct HashTraits<StackShot> : SimpleClassHashTraits<StackShot> { }; > > } // namespace WTF >diff --git a/Source/WebCore/Modules/webdatabase/SQLResultSetRowList.h b/Source/WebCore/Modules/webdatabase/SQLResultSetRowList.h >index b6fd7980c9c4a4b8db97d4e66c91148b7cbe8b6e..14c44483afb879a2995519c6f6120a30d2a8a94b 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLResultSetRowList.h >+++ b/Source/WebCore/Modules/webdatabase/SQLResultSetRowList.h >@@ -30,7 +30,6 @@ > > #include "ExceptionOr.h" > #include "SQLValue.h" >-#include <wtf/HashTraits.h> > > namespace WebCore { > >diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >index fea9c381b11d4ad4a8c2459e73badd7dfe15a8aa..ba945cd771e4af9e85f67f85720486295744c609 100644 >--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp >+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >@@ -81,7 +81,6 @@ > #include <JavaScriptCore/TypedArrays.h> > #include <JavaScriptCore/WasmModule.h> > #include <limits> >-#include <wtf/HashTraits.h> > #include <wtf/MainThread.h> > #include <wtf/RunLoop.h> > #include <wtf/Vector.h> >diff --git a/Source/WebCore/page/DebugPageOverlays.cpp b/Source/WebCore/page/DebugPageOverlays.cpp >index 595aa41854b849c3da82ae23134d10b9165b9234..ed027fae83cc23edbf52b1e3b230f947f3fe8b04 100644 >--- a/Source/WebCore/page/DebugPageOverlays.cpp >+++ b/Source/WebCore/page/DebugPageOverlays.cpp >@@ -26,6 +26,7 @@ > #include "config.h" > #include "DebugPageOverlays.h" > >+#include "ColorHash.h" > #include "ElementIterator.h" > #include "FrameView.h" > #include "GraphicsContext.h" >diff --git a/Source/WebCore/platform/URL.h b/Source/WebCore/platform/URL.h >index e96a41e9698d22bb3ed0322d4d047ffb3ac1c80f..775044a3245da6c9732a6c725c62bebe0948f86e 100644 >--- a/Source/WebCore/platform/URL.h >+++ b/Source/WebCore/platform/URL.h >@@ -424,11 +424,6 @@ WTF::TextStream& operator<<(WTF::TextStream&, const URL&); > } // namespace WebCore > > namespace WTF { >- >-// URLHash is the default hash for String >-template<typename T> struct DefaultHash; >-template<> struct DefaultHash<WebCore::URL> { >- typedef WebCore::URLHash Hash; >-}; >- >+template<> struct DefaultHash<WebCore::URL>; >+template<> struct HashTraits<WebCore::URL>; > } // namespace WTF >diff --git a/Source/WebCore/platform/URLHash.h b/Source/WebCore/platform/URLHash.h >index cedc4f385305c3b2becd296f69ee52d08a82f966..f08bf580078df5076501354888492a603d738839 100644 >--- a/Source/WebCore/platform/URLHash.h >+++ b/Source/WebCore/platform/URLHash.h >@@ -50,7 +50,12 @@ namespace WebCore { > > namespace WTF { > >- template<> struct HashTraits<WebCore::URL> : SimpleClassHashTraits<WebCore::URL> { }; >+// URLHash is the default hash for String >+template<> struct DefaultHash<WebCore::URL> { >+ typedef WebCore::URLHash Hash; >+}; >+ >+template<> struct HashTraits<WebCore::URL> : SimpleClassHashTraits<WebCore::URL> { }; > > } // namespace WTF > >diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h >index 66609cc2d40cf2803ee54d72457b4be8f393469d..e584b43418f675a6141761cf70fb93299470008f 100644 >--- a/Source/WebCore/platform/graphics/Color.h >+++ b/Source/WebCore/platform/graphics/Color.h >@@ -470,3 +470,8 @@ WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const Color&); > WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ColorSpace); > > } // namespace WebCore >+ >+namespace WTF { >+template<> struct DefaultHash<WebCore::Color>; >+template<> struct HashTraits<WebCore::Color>; >+} >diff --git a/Source/WebCore/platform/graphics/FloatSize.h b/Source/WebCore/platform/graphics/FloatSize.h >index 1c3d7f1245969e816cd41d598ce6081583ebb00a..9ef767ea0fba4e8637508159b989b47aaa59dbf2 100644 >--- a/Source/WebCore/platform/graphics/FloatSize.h >+++ b/Source/WebCore/platform/graphics/FloatSize.h >@@ -28,6 +28,7 @@ > #pragma once > > #include "IntPoint.h" >+#include <wtf/Forward.h> > #include <wtf/MathExtras.h> > > #if PLATFORM(IOS) >@@ -256,3 +257,7 @@ WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const FloatSize&); > > } // namespace WebCore > >+namespace WTF { >+template<> struct DefaultHash<WebCore::FloatSize>; >+template<> struct HashTraits<WebCore::FloatSize>; >+} >diff --git a/Source/WebCore/platform/graphics/IntPoint.h b/Source/WebCore/platform/graphics/IntPoint.h >index 77f1589f1122a5b717f3310f11b6c9ca5ab1f0c4..8a86a97be97a97d35416195492f3ab5f7e0df824 100644 >--- a/Source/WebCore/platform/graphics/IntPoint.h >+++ b/Source/WebCore/platform/graphics/IntPoint.h >@@ -27,6 +27,7 @@ > > #include "IntSize.h" > #include <cmath> >+#include <wtf/Forward.h> > > #if PLATFORM(MAC) && defined __OBJC__ > #import <Foundation/NSGeometry.h> >@@ -215,3 +216,7 @@ WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const IntPoint&); > > } // namespace WebCore > >+namespace WTF { >+template<> struct DefaultHash<WebCore::IntPoint>; >+template<> struct HashTraits<WebCore::IntPoint>; >+} >diff --git a/Source/WebCore/platform/graphics/IntSize.h b/Source/WebCore/platform/graphics/IntSize.h >index 7ac64cab48c3d09a91a9ae78bd0c7aadfe0945a4..3fbcb6b057ebe1b740dd7a524299a5650acfe8c8 100644 >--- a/Source/WebCore/platform/graphics/IntSize.h >+++ b/Source/WebCore/platform/graphics/IntSize.h >@@ -26,6 +26,7 @@ > #pragma once > > #include <algorithm> >+#include <wtf/Forward.h> > > #if PLATFORM(MAC) && defined __OBJC__ > #import <Foundation/NSGeometry.h> >@@ -219,3 +220,7 @@ WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const IntSize&); > > } // namespace WebCore > >+namespace WTF { >+template<> struct DefaultHash<WebCore::IntSize>; >+template<> struct HashTraits<WebCore::IntSize>; >+} >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >index f8dcd00afe230a2f520fddf83a05db956d0cf31a..b880a948759fff7e819a316c8e9e6714798af7be 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >@@ -28,6 +28,7 @@ > #if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION) > > #include "AVMediaCaptureSource.h" >+#include "IntSizeHash.h" > #include "OrientationNotifier.h" > > OBJC_CLASS CALayer; >diff --git a/Source/WebCore/platform/network/ProtectionSpace.h b/Source/WebCore/platform/network/ProtectionSpace.h >index 769de805fe0bcdc70fe36b84efa1e271cbd8f0a3..bcd316270f0f61a2e781f860bb9f29823f482207 100644 >--- a/Source/WebCore/platform/network/ProtectionSpace.h >+++ b/Source/WebCore/platform/network/ProtectionSpace.h >@@ -48,4 +48,9 @@ public: > > } // namespace WebCore > >+namespace WTF { >+template<> struct DefaultHash<WebCore::ProtectionSpace>; >+template<> struct HashTraits<WebCore::ProtectionSpace>; >+} >+ > #endif >diff --git a/Source/WebCore/platform/network/ProtectionSpaceHash.h b/Source/WebCore/platform/network/ProtectionSpaceHash.h >index 4526cd4f811ce8a22955d3c2b639600abdb26e8b..c7939055b53d27add728a5ef0241ba87bd23ad74 100644 >--- a/Source/WebCore/platform/network/ProtectionSpaceHash.h >+++ b/Source/WebCore/platform/network/ProtectionSpaceHash.h >@@ -59,7 +59,6 @@ namespace WTF { > > template<> struct HashTraits<WebCore::ProtectionSpace> : SimpleClassHashTraits<WebCore::ProtectionSpace> { }; > >- template<typename T> struct DefaultHash; > template<> struct DefaultHash<WebCore::ProtectionSpace> { > typedef WebCore::ProtectionSpaceHash Hash; > }; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 2559a0d65565145c56eefb48bafb9f3d5e608a92..63deb6699a9bd2417e39541051e17eff93524b24 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -90,6 +90,7 @@ > #if PLATFORM(IOS) > #include "GestureTypes.h" > #include "WebPageMessages.h" >+#include <WebCore/IntPointHash.h> > #include <WebCore/ViewportConfiguration.h> > #endif >
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 189044
:
348281
|
348286
|
348330
|
348803
|
349294