Crash when calling WKPageClose on the originated page from within createNewPage callback
https://bugs.webkit.org/show_bug.cgi?id=139099
<rdar://problem/19052564>

Reviewed by Sam Weinig.

Source/WebKit2:

Null check the namespace ID.

* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::cloneSessionStorageNamespaceInternal):

Tools:

Add a test.

* TestWebKitAPI/PlatformWebView.h:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp: Added.
(TestWebKitAPI::runJavaScriptAlert):
(TestWebKitAPI::createNewPage):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/close-from-within-create-page.html: Added.
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::PlatformWebView):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
More work on the legacy WebKit visited link store
https://bugs.webkit.org/show_bug.cgi?id=139100

Reviewed by Sam Weinig.

* History/WebHistory.mm:
(+[WebHistory setOptionalSharedHistory:]):
Call WebVisitedLinkStore::setShouldTrackVisitedLinks and WebVisitedLinkStore::removeAllVisitedLinks.

* WebCoreSupport/WebVisitedLinkStore.h:
* WebCoreSupport/WebVisitedLinkStore.mm:
(visitedLinkStores):
(WebVisitedLinkStore::WebVisitedLinkStore):
(WebVisitedLinkStore::~WebVisitedLinkStore):
Keep track of live visited link stores.

(WebVisitedLinkStore::setShouldTrackVisitedLinks):
Update s_shouldTrackVisitedLinks and call removeAllVisitedLinks if necessary.

(WebVisitedLinkStore::removeAllVisitedLinks):
Iterate over all live link stores and remove their links.

(WebVisitedLinkStore::isLinkVisited):
Populate visited links and check if our hash table contains the link.

(WebVisitedLinkStore::addVisitedLink):
Add the link hash to the table.

(WebVisitedLinkStore::populateVisitedLinksIfNeeded):
Add stub.

(WebVisitedLinkStore::removeVisitedLinkHashes):
Clear out the hash table.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176575 268f45cc-cd09-0410-ab3c-d52691b4dbfc