Bug 139429

Summary: [WK2] Crash when answering notification permission request after navigating
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, benjamin, commit-queue, kling, sam
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 139494    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Chris Dumez 2014-12-08 23:26:53 PST
Crash when answering notification permission request after navigating:
100 com.apple.WebKit:  WebCore::SecurityOriginHash::hash + 34 <==
        100 com.apple.WebKit:  WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long>* WTF::HashTable<WTF::RefPtr<WebCore::SecurityOrigin>, WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long> >, WebCore::SecurityOriginHash, WTF::KeyValuePairHashTraits<WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> >, WTF::HashTraits<unsigned long long> >, WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> > >::lookup<WTF::IdentityHashTranslator<WebCore::SecurityOriginHash>, WTF::RefPtr<WebCore::SecurityOrigin> > + 36
          100 com.apple.WebKit:  WTF::HashTableIterator<WTF::RefPtr<WebCore::SecurityOrigin>, WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long> >, WebCore::SecurityOriginHash, WTF::KeyValuePairHashTraits<WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> >, WTF::HashTraits<unsigned long long> >, WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> > > WTF::HashTable<WTF::RefPtr<WebCore::SecurityOrigin>, WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long> >, WebCore::SecurityOriginHash, WTF::KeyValuePairHashTraits<WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> >, WTF::HashTraits<unsigned long long> >, WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> > >::find<WTF::IdentityHashTranslator<WebCore::SecurityOriginHash>, WTF::RefPtr<WebCore::SecurityOrigin> > + 23
            100 com.apple.WebKit:  WTF::HashMap<WTF::RefPtr<WebCore::SecurityOrigin>, unsigned long long, WebCore::SecurityOriginHash, WTF::HashTraits<WTF::RefPtr<WebCore::SecurityOrigin> >, WTF::HashTraits<unsigned long long> >::remove + 14
              100 com.apple.WebKit:  WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision + 74
                100 com.apple.WebKit:  void IPC::handleMessage<Messages::WebPage::DidReceiveNotificationPermissionDecision, WebKit::WebPage, void  + 78
                  51 com.apple.WebKit:  WebKit::WebPage::didReceiveWebPageMessage + 10220
                  | 51 com.apple.WebKit:  IPC::MessageReceiverMap::dispatchMessage + 120
                  |   51 com.apple.WebKit:  WebKit::WebProcess::didReceiveMessage + 28

This is because the notification permission request is cancelled upon navigating. When the user responds to the permission request afterward, it looks for the request ID in the HashMap and the code wrongly assumes the ID exists in the HashMap.

Radar: <rdar://problem/18921122>
Comment 1 Chris Dumez 2014-12-08 23:38:44 PST
Created attachment 242886 [details]
Patch
Comment 2 Andreas Kling 2014-12-09 11:46:45 PST
Comment on attachment 242886 [details]
Patch

r=me
Comment 3 WebKit Commit Bot 2014-12-09 12:31:06 PST
Comment on attachment 242886 [details]
Patch

Clearing flags on attachment: 242886

Committed r177033: <http://trac.webkit.org/changeset/177033>
Comment 4 WebKit Commit Bot 2014-12-09 12:31:11 PST
All reviewed patches have been landed.  Closing bug.