<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>184012</bug_id>
          
          <creation_ts>2018-03-26 10:31:30 -0700</creation_ts>
          <short_desc>Unable to use HashMap&lt;WebCore::SecurityOriginData, Ref&lt;WebSWServerToContextConnection&gt;&gt; type in StorageProcess.h</short_desc>
          <delta_ts>2018-04-16 11:37:17 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=183969</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>ap</cc>
    
    <cc>beidson</cc>
    
    <cc>darin</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1409317</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-26 10:31:30 -0700</bug_when>
    <thetext>Unable to use HashMap&lt;WebCore::SecurityOriginData, RefPtr&lt;WebSWServerToContextConnection&gt;&gt; type in StorageProcess.h. It causes an assertion to be hit in debug:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.JavaScriptCore      	0x00000001243b97b4 WTFCrash + 36 (Assertions.cpp:271)
1   com.apple.WebKit              	0x000000010f510de6 WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;::leakRef() + 70 (Ref.h:133)
2   com.apple.WebKit              	0x000000010f510d51 WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;::Ref(WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 33 (Ref.h:75)
3   com.apple.WebKit              	0x000000010f510d1d WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;::Ref(WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 29 (Ref.h:78)
4   com.apple.WebKit              	0x000000010f510cec WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;(WebCore::SecurityOriginData&amp;&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 76 (KeyValuePair.h:46)
5   com.apple.WebKit              	0x000000010f510c25 WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;(WebCore::SecurityOriginData&amp;&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 37 (KeyValuePair.h:46)
6   com.apple.WebKit              	0x000000010f510bb9 WTF::KeyValuePairHashTraits&lt;WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::emptyValue() + 57 (HashTraits.h:292)
7   com.apple.WebKit              	0x000000010f510b79 void WTF::HashTableBucketInitializer&lt;false&gt;::initialize&lt;WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;(WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;&amp;) + 57 (HashTable.h:841)
8   com.apple.WebKit              	0x000000010f510b35 WTF::HashTable&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt;::initializeBucket(WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;&amp;) + 21 (HashTable.h:858)
9   com.apple.WebKit              	0x000000010f51095b WTF::HashTable&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt;::allocateTable(unsigned int) + 75 (HashTable.h:1148)
10  com.apple.WebKit              	0x000000010f5106e8 WTF::HashTable&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt;::rehash(unsigned int, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;*) + 72 (HashTable.h:1197)
11  com.apple.WebKit              	0x000000010f518385 WTF::HashTable&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt;::expand(WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;*) + 117 (HashTable.h:1174)
12  com.apple.WebKit              	0x000000010f51809c WTF::HashTableAddResult&lt;WTF::HashTableIterator&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt; &gt; WTF::HashTable&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt;::add&lt;WTF::HashMapTranslator&lt;WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WebCore::SecurityOriginDataHash&gt;, WebCore::SecurityOriginData const&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;(WebCore::SecurityOriginData const&amp;&amp;&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 108 (HashTable.h:869)
13  com.apple.WebKit              	0x000000010f51801c WTF::HashTableAddResult&lt;WTF::HashTableIterator&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt; &gt; WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::inlineAdd&lt;WebCore::SecurityOriginData const&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;(WebCore::SecurityOriginData const&amp;&amp;&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 60 (HashMap.h:346)
14  com.apple.WebKit              	0x000000010f505f34 WTF::HashTableAddResult&lt;WTF::HashTableIterator&lt;WebCore::SecurityOriginData, WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;, WTF::KeyValuePairKeyExtractor&lt;WTF::KeyValuePair&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::KeyValuePairTraits, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt; &gt; &gt; WTF::HashMap&lt;WebCore::SecurityOriginData, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;, WebCore::SecurityOriginDataHash, WTF::HashTraits&lt;WebCore::SecurityOriginData&gt;, WTF::HashTraits&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt; &gt;::add&lt;WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt; &gt;(WebCore::SecurityOriginData const&amp;, WTF::Ref&lt;WebKit::WebSWServerToContextConnection, WTF::DumbPtrTraits&lt;WebKit::WebSWServerToContextConnection&gt; &gt;&amp;&amp;) + 52 (HashMap.h:381)
15  com.apple.WebKit              	0x000000010f505616 WebKit::StorageProcess::createStorageToWebProcessConnection(bool, WebCore::SecurityOriginData&amp;&amp;) + 726 (StorageProcess.cpp:281)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409318</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-26 10:32:01 -0700</bug_when>
    <thetext>HashMap&lt;RefPtr&lt;WebCore::SecurityOrigin&gt;, RefPtr&lt;WebSWServerToContextConnection&gt;&gt; type</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409319</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-26 10:34:16 -0700</bug_when>
    <thetext>Using HashMap&lt;RefPtr&lt;WebCore::SecurityOrigin&gt;, Ref&lt;WebSWServerToContextConnection&gt;&gt; works. I believe the different is that emptyValueIsZero for both the Key and the Value.

emptyValueIsZero is false when the key is a SecurityOriginData. So KeyValuePairHashTraits::emptyValueIsZero goes from true to false and it causes failures.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409320</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-26 10:35:40 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #2)
&gt; Using HashMap&lt;RefPtr&lt;WebCore::SecurityOrigin&gt;,
&gt; Ref&lt;WebSWServerToContextConnection&gt;&gt; works. I believe the different is that
&gt; emptyValueIsZero for both the Key and the Value.
&gt; 
&gt; emptyValueIsZero is false when the key is a SecurityOriginData. So
&gt; KeyValuePairHashTraits::emptyValueIsZero goes from true to false and it
&gt; causes failures.

As a result, it ends up using a different template specialization for HashTableBucketInitializer:
    template&lt;bool emptyValueIsZero&gt; struct HashTableBucketInitializer;

    template&lt;&gt; struct HashTableBucketInitializer&lt;false&gt; {
        template&lt;typename Traits, typename Value&gt; static void initialize(Value&amp; bucket)
        {
            new (NotNull, std::addressof(bucket)) Value(Traits::emptyValue());
        }
    };

    template&lt;&gt; struct HashTableBucketInitializer&lt;true&gt; {
        template&lt;typename Traits, typename Value&gt; static void initialize(Value&amp; bucket)
        {
            // This initializes the bucket without copying the empty value.
            // That makes it possible to use this with types that don&apos;t support copying.
            // The memset to 0 looks like a slow operation but is optimized by the compilers.
            memset(std::addressof(bucket), 0, sizeof(bucket));
        }
    };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409323</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-26 10:41:33 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #3)
&gt; (In reply to Chris Dumez from comment #2)
&gt; &gt; Using HashMap&lt;RefPtr&lt;WebCore::SecurityOrigin&gt;,
&gt; &gt; Ref&lt;WebSWServerToContextConnection&gt;&gt; works. I believe the different is that
&gt; &gt; emptyValueIsZero for both the Key and the Value.
&gt; &gt; 
&gt; &gt; emptyValueIsZero is false when the key is a SecurityOriginData. So
&gt; &gt; KeyValuePairHashTraits::emptyValueIsZero goes from true to false and it
&gt; &gt; causes failures.
&gt; 
&gt; As a result, it ends up using a different template specialization for
&gt; HashTableBucketInitializer:
&gt;     template&lt;bool emptyValueIsZero&gt; struct HashTableBucketInitializer;
&gt; 
&gt;     template&lt;&gt; struct HashTableBucketInitializer&lt;false&gt; {
&gt;         template&lt;typename Traits, typename Value&gt; static void
&gt; initialize(Value&amp; bucket)
&gt;         {
&gt;             new (NotNull, std::addressof(bucket))
&gt; Value(Traits::emptyValue());
&gt;         }
&gt;     };
&gt; 
&gt;     template&lt;&gt; struct HashTableBucketInitializer&lt;true&gt; {
&gt;         template&lt;typename Traits, typename Value&gt; static void
&gt; initialize(Value&amp; bucket)
&gt;         {
&gt;             // This initializes the bucket without copying the empty value.
&gt;             // That makes it possible to use this with types that don&apos;t
&gt; support copying.
&gt;             // The memset to 0 looks like a slow operation but is optimized
&gt; by the compilers.
&gt;             memset(std::addressof(bucket), 0, sizeof(bucket));
&gt;         }
&gt;     };

So instead of doing a memset zero, we now rely on Traits::emptyValue(), which for Ref&lt;T&gt; is static Ref&lt;P&gt; emptyValue() { return HashTableEmptyValue; }

This is implemented as:
Ref(HashTableEmptyValueType) : m_ptr(hashTableEmptyValue()) { }

hashTableDeletedValue() returns nullptr.

So when we construct a KeyValuePair:
    template&lt;typename K, typename V&gt;
    KeyValuePair(K&amp;&amp; key, V&amp;&amp; value)
        : key(std::forward&lt;K&gt;(key))
        , value(std::forward&lt;V&gt;(value))
    {
    }

And V is HashTraits&lt;Ref&lt;T&gt;&gt;::emptyValue(), then it calls the Ref&lt;T&gt;(Ref&lt;t&gt;&amp;&amp;) move constructor, which ends up calling leakRef() on the Ref. This is implemented as:
    T&amp; leakRef() WARN_UNUSED_RETURN
    {
        ASSERT(m_ptr);
        / ...
    }

We hit this assertion since m_ptr is nullptr when the Ref&lt;&gt; is an empty HashTable value :/

Advice on how to best address this would be appreciated:
1. Dropping this assertion would be unfortunate since it is useful to catch bugs
2. Using another value than nullptr as empty HashTable value maybe?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409570</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2018-03-27 09:55:43 -0700</bug_when>
    <thetext>So we consider it a programming error to move from a Ref that is null. But we want to use null values in the hash table. I think the best way to work around this is in the hash table machinery rather than in Ref; I don’t think we should use a value other than nullptr for empty since I think it would hurt efficiency.

For this specific case, I think we could figure out how to make emptyValueIsZero be true for SecurityOriginData. I am pretty sure that works even for std::optional.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409577</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-27 10:07:59 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #5)
&gt; So we consider it a programming error to move from a Ref that is null. But
&gt; we want to use null values in the hash table. I think the best way to work
&gt; around this is in the hash table machinery rather than in Ref; I don’t think
&gt; we should use a value other than nullptr for empty since I think it would
&gt; hurt efficiency.
&gt; 
&gt; For this specific case, I think we could figure out how to make
&gt; emptyValueIsZero be true for SecurityOriginData. I am pretty sure that works
&gt; even for std::optional.

Fixing it only for SecurityOriginData would not be optimal IMO. Someone else is going to get caught by this in the future for another key type&apos;s whose emptyValueIsZero is false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409714</commentid>
    <comment_count>7</comment_count>
      <attachid>336628</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-03-27 16:16:58 -0700</bug_when>
    <thetext>Created attachment 336628
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1414842</commentid>
    <comment_count>8</comment_count>
      <attachid>336628</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2018-04-16 11:37:17 -0700</bug_when>
    <thetext>Comment on attachment 336628
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=336628&amp;action=review

&gt; Source/WebCore/ChangeLog:9
&gt; +        Set SecurityOriginDataHashTraits::emptyValueIsZero to true. This is OK because
&gt; +        the data members of SecurityOriginData are of type String or std::optional&lt;uint16_t&gt;.

This seems a bit fragile. Can we add an assertion somewhere to make sure this assumption holds?
e.g. memset SecurityOriginData and make sure isEmpty returns true there.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>336628</attachid>
            <date>2018-03-27 16:16:58 -0700</date>
            <delta_ts>2018-04-16 11:37:17 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-184012-20180327161658.patch</filename>
            <type>text/plain</type>
            <size>4196</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjMwMDA5CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOGU4NTdmNzk1ZjJiN2Rl
MDI3OTk1OGViYzA5ODRlYTNhZTM3N2QxOS4uZGY2MTRlOWM2MzEwNmJiNjdmNWUwYjM4NTU2NjNh
MTM3OTBjOWJmOSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE4IEBACisyMDE4LTAzLTI3ICBDaHJp
cyBEdW1leiAgPGNkdW1lekBhcHBsZS5jb20+CisKKyAgICAgICAgVW5hYmxlIHRvIHVzZSBIYXNo
TWFwPFdlYkNvcmU6OlNlY3VyaXR5T3JpZ2luRGF0YSwgUmVmPFdlYlNXU2VydmVyVG9Db250ZXh0
Q29ubmVjdGlvbj4+IHR5cGUgaW4gU3RvcmFnZVByb2Nlc3MuaAorICAgICAgICBodHRwczovL2J1
Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTg0MDEyCisKKyAgICAgICAgUmV2aWV3ZWQg
YnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgU2V0IFNlY3VyaXR5T3JpZ2luRGF0YUhhc2hU
cmFpdHM6OmVtcHR5VmFsdWVJc1plcm8gdG8gdHJ1ZS4gVGhpcyBpcyBPSyBiZWNhdXNlCisgICAg
ICAgIH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h0UHJvY2Vzc0Nvbm5lY3Rpb24oY29uc3QgSVBD
OjpBdHRhY2htZW50Jik7CiAKLSAgICBIYXNoTWFwPFdlYkNvcmU6OlNlY3VyaXR5T3JpZ2luRGF0
YSwgUmVmUHRyPFdlYlNXU2VydmVyVG9Db250ZXh0Q29ubmVjdGlvbj4+IG1fc2VydmVyVG9Db250
ZXh0Q29ubmVjdGlvbnM7CisgICAgSGFzaE1hcDxXZWJDb3JlOjpTZWN1cml0eU9yaWdpbkRhdGEs
IFJlZjxXZWJTV1NlcnZlclRvQ29udGV4dENvbm5lY3Rpb24+PiBtX3NlcnZlclRvQ29udGV4dENv
bm5lY3Rpb25zOwogICAgIGJvb2wgbV93YWl0aW5nRm9yU2VydmVyVG9Db250ZXh0UHJvY2Vzc0Nv
bm5lY3Rpb24geyBmYWxzZSB9OwogICAgIGJvb2wgbV9zaG91bGREaXNhYmxlU2VydmljZVdvcmtl
clByb2Nlc3NUZXJtaW5hdGlvbkRlbGF5IHsgZmFsc2UgfTsKICAgICBIYXNoTWFwPFBBTDo6U2Vz
c2lvbklELCBTdHJpbmc+IG1fc3dEYXRhYmFzZVBhdGhzOwo=
</data>
<flag name="review"
          id="355152"
          type_id="1"
          status="+"
          setter="rniwa"
    />
          </attachment>
      

    </bug>

</bugzilla>