Changeset 245997 in webkit
- Timestamp:
- May 31, 2019, 4:25:04 PM (7 years ago)
- Location:
- branches/safari-608.1.27-branch
- Files:
-
- 9 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/WebStorage/StorageManager.cpp (modified) (27 diffs)
-
Source/WebKit/NetworkProcess/WebStorage/StorageManager.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/WebStorage/StorageAreaMap.cpp (modified) (4 diffs)
-
Source/WebKit/WebProcess/WebStorage/StorageNamespaceImpl.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/WebStorage/StorageNamespaceImpl.h (modified) (1 diff)
-
Source/WebKit/WebProcess/WebStorage/WebStorageNamespaceProvider.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608.1.27-branch/Source/WebKit/ChangeLog
r245996 r245997 1 2019-05-31 Alan Coon <alancoon@apple.com> 2 3 Revert r245943. rdar://problem/51244662 4 1 5 2019-05-31 Alan Coon <alancoon@apple.com> 2 6 -
branches/safari-608.1.27-branch/Source/WebKit/NetworkProcess/WebStorage/StorageManager.cpp
r245943 r245997 64 64 void clear(); 65 65 66 bool is Ephemeral() const { return !m_localStorageNamespace; }66 bool isSessionStorage() const { return !m_localStorageNamespace; } 67 67 68 68 private: … … 73 73 void dispatchEvents(IPC::Connection::UniqueID sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) const; 74 74 75 // Will be null if the storage area belongs to a session storage namespace or the storage area is in an ephemeral session.75 // Will be null if the storage area belongs to a session storage namespace. 76 76 LocalStorageNamespace* m_localStorageNamespace; 77 77 mutable RefPtr<LocalStorageDatabase> m_localStorageDatabase; … … 92 92 StorageManager* storageManager() const { return &m_storageManager; } 93 93 94 enum class IsEphemeral : bool { No, Yes }; 95 Ref<StorageArea> getOrCreateStorageArea(SecurityOriginData&&, IsEphemeral); 94 Ref<StorageArea> getOrCreateStorageArea(SecurityOriginData&&); 96 95 void didDestroyStorageArea(StorageArea*); 97 96 98 97 void clearStorageAreasMatchingOrigin(const SecurityOriginData&); 99 98 void clearAllStorageAreas(); 100 101 Vector<SecurityOriginData> ephemeralOrigins() const;102 void cloneTo(LocalStorageNamespace& newLocalStorageNamespace);103 99 104 100 private: … … 109 105 unsigned m_quotaInBytes; 110 106 111 HashMap<SecurityOriginData, RefPtr<StorageArea>> m_storageAreaMap; 107 // We don't hold an explicit reference to the StorageAreas; they are kept alive by the m_storageAreasByConnection map in StorageManager. 108 HashMap<SecurityOriginData, StorageArea*> m_storageAreaMap; 112 109 }; 113 110 … … 200 197 void StorageManager::StorageArea::removeListener(IPC::Connection::UniqueID connectionID, uint64_t storageMapID) 201 198 { 202 ASSERT(is Ephemeral() || m_eventListeners.contains(std::make_pair(connectionID, storageMapID)));199 ASSERT(isSessionStorage() || m_eventListeners.contains(std::make_pair(connectionID, storageMapID))); 203 200 m_eventListeners.remove(std::make_pair(connectionID, storageMapID)); 204 201 } … … 240 237 void StorageManager::StorageArea::setItems(const HashMap<String, String>& items) 241 238 { 242 // Import items from web process if items are not stored on disk. 243 if (!isEphemeral()) 244 return; 245 239 ASSERT(!m_localStorageDatabase); 246 240 for (auto& item : items) { 247 241 String oldValue; … … 318 312 return; 319 313 320 ASSERT(m_localStorageNamespace->storageManager()->m_localStorageDatabaseTracker);321 314 // We open the database here even if we've already imported our items to ensure that the database is open if we need to write to it. 322 315 if (!m_localStorageDatabase) 323 m_localStorageDatabase = LocalStorageDatabase::create(m_localStorageNamespace->storageManager()->m_queue.copyRef(), *m_localStorageNamespace->storageManager()->m_localStorageDatabaseTracker, m_securityOrigin);316 m_localStorageDatabase = LocalStorageDatabase::create(m_localStorageNamespace->storageManager()->m_queue.copyRef(), m_localStorageNamespace->storageManager()->m_localStorageDatabaseTracker.copyRef(), m_securityOrigin); 324 317 325 318 if (m_didImportItemsFromDatabase) … … 358 351 StorageManager::LocalStorageNamespace::~LocalStorageNamespace() 359 352 { 360 } 361 362 auto StorageManager::LocalStorageNamespace::getOrCreateStorageArea(SecurityOriginData&& securityOrigin, IsEphemeral isEphemeral) -> Ref<StorageArea> 353 ASSERT(m_storageAreaMap.isEmpty()); 354 } 355 356 auto StorageManager::LocalStorageNamespace::getOrCreateStorageArea(SecurityOriginData&& securityOrigin) -> Ref<StorageArea> 363 357 { 364 358 RefPtr<StorageArea> protectedStorageArea; 365 359 return *m_storageAreaMap.ensure(securityOrigin, [&]() mutable { 366 protectedStorageArea = StorageArea::create( isEphemeral == IsEphemeral::Yes ? nullptr :this, WTFMove(securityOrigin), m_quotaInBytes);360 protectedStorageArea = StorageArea::create(this, WTFMove(securityOrigin), m_quotaInBytes); 367 361 return protectedStorageArea.get(); 368 362 }).iterator->value; … … 390 384 void StorageManager::LocalStorageNamespace::clearAllStorageAreas() 391 385 { 392 for (auto storageArea : m_storageAreaMap.values())386 for (auto* storageArea : m_storageAreaMap.values()) 393 387 storageArea->clear(); 394 }395 396 Vector<SecurityOriginData> StorageManager::LocalStorageNamespace::ephemeralOrigins() const397 {398 Vector<SecurityOriginData> origins;399 for (const auto& storageArea : m_storageAreaMap.values()) {400 if (!storageArea->items().isEmpty())401 origins.append(storageArea->securityOrigin());402 }403 return origins;404 }405 406 void StorageManager::LocalStorageNamespace::cloneTo(LocalStorageNamespace& newLocalStorageNamespace)407 {408 for (auto& pair : m_storageAreaMap)409 newLocalStorageNamespace.m_storageAreaMap.add(pair.key, pair.value->clone());410 388 } 411 389 … … 506 484 StorageManager::StorageManager(const String& localStorageDirectory) 507 485 : m_queue(WorkQueue::create("com.apple.WebKit.StorageManager")) 486 , m_localStorageDatabaseTracker(LocalStorageDatabaseTracker::create(m_queue.copyRef(), localStorageDirectory)) 487 , m_isEphemeral(localStorageDirectory.isNull()) 508 488 { 509 489 // Make sure the encoding is initialized before we start dispatching things to the queue. 510 490 UTF8Encoding(); 511 if (!localStorageDirectory.isNull())512 m_localStorageDatabaseTracker = LocalStorageDatabaseTracker::create(m_queue.copyRef(), localStorageDirectory);513 491 } 514 492 … … 571 549 572 550 sessionStorageNamespace->cloneTo(*newSessionStorageNamespace); 573 574 if (!m_localStorageDatabaseTracker) {575 if (auto* localStorageNamespace = m_localStorageNamespaces.get(storageNamespaceID)) {576 LocalStorageNamespace* newlocalStorageNamespace = getOrCreateLocalStorageNamespace(newStorageNamespaceID);577 localStorageNamespace->cloneTo(*newlocalStorageNamespace);578 }579 }580 551 }); 581 552 } … … 659 630 HashSet<SecurityOriginData> origins; 660 631 661 if (m_localStorageDatabaseTracker) { 662 for (auto& origin : m_localStorageDatabaseTracker->origins()) 663 origins.add(origin); 664 } else { 665 for (const auto& localStorageNameSpace : m_localStorageNamespaces.values()) { 666 for (auto& origin : localStorageNameSpace->ephemeralOrigins()) 667 origins.add(origin); 668 } 669 } 632 for (auto& origin : m_localStorageDatabaseTracker->origins()) 633 origins.add(origin); 670 634 671 635 for (auto& transientLocalStorageNamespace : m_transientLocalStorageNamespaces.values()) { … … 683 647 { 684 648 m_queue->dispatch([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable { 685 Vector<LocalStorageDatabaseTracker::OriginDetails> originDetails; 686 if (m_localStorageDatabaseTracker) 687 originDetails = m_localStorageDatabaseTracker->originDetails(); 649 auto originDetails = m_localStorageDatabaseTracker->originDetails(); 688 650 689 651 RunLoop::main().dispatch([originDetails = WTFMove(originDetails), completionHandler = WTFMove(completionHandler)]() mutable { … … 702 664 transientLocalStorageNamespace->clearStorageAreasMatchingOrigin(copiedOrigin); 703 665 704 if (m_localStorageDatabaseTracker) 705 m_localStorageDatabaseTracker->deleteDatabaseWithOrigin(copiedOrigin); 666 m_localStorageDatabaseTracker->deleteDatabaseWithOrigin(copiedOrigin); 706 667 }); 707 668 } … … 710 671 { 711 672 m_queue->dispatch([this, protectedThis = makeRef(*this), time, completionHandler = WTFMove(completionHandler)]() mutable { 712 if (m_localStorageDatabaseTracker) { 713 auto originsToDelete = m_localStorageDatabaseTracker->databasesModifiedSince(time); 673 auto originsToDelete = m_localStorageDatabaseTracker->databasesModifiedSince(time); 674 675 for (auto& transientLocalStorageNamespace : m_transientLocalStorageNamespaces.values()) 676 transientLocalStorageNamespace->clearAllStorageAreas(); 677 678 for (const auto& origin : originsToDelete) { 679 for (auto& localStorageNamespace : m_localStorageNamespaces.values()) 680 localStorageNamespace->clearStorageAreasMatchingOrigin(origin); 714 681 715 for (auto& transientLocalStorageNamespace : m_transientLocalStorageNamespaces.values()) 716 transientLocalStorageNamespace->clearAllStorageAreas(); 717 718 for (const auto& origin : originsToDelete) { 719 for (auto& localStorageNamespace : m_localStorageNamespaces.values()) 720 localStorageNamespace->clearStorageAreasMatchingOrigin(origin); 721 722 m_localStorageDatabaseTracker->deleteDatabaseWithOrigin(origin); 723 } 724 } else { 725 for (auto& localStorageNamespace : m_localStorageNamespaces.values()) 726 localStorageNamespace->clearAllStorageAreas(); 682 m_localStorageDatabaseTracker->deleteDatabaseWithOrigin(origin); 727 683 } 728 684 … … 747 703 transientLocalStorageNamespace->clearStorageAreasMatchingOrigin(origin); 748 704 749 if (m_localStorageDatabaseTracker) 750 m_localStorageDatabaseTracker->deleteDatabaseWithOrigin(origin); 705 m_localStorageDatabaseTracker->deleteDatabaseWithOrigin(origin); 751 706 } 752 707 … … 758 713 { 759 714 m_queue->dispatch([this, protectedThis = makeRef(*this), connectionID = connection.uniqueID(), storageMapID, storageNamespaceID, securityOriginData = securityOriginData.isolatedCopy()]() mutable { 715 ASSERT(!m_isEphemeral); 760 716 std::pair<IPC::Connection::UniqueID, uint64_t> connectionAndStorageMapIDPair(connectionID, storageMapID); 761 717 … … 774 730 ASSERT(localStorageNamespace); 775 731 776 auto storageArea = localStorageNamespace->getOrCreateStorageArea(WTFMove(securityOriginData) , m_localStorageDatabaseTracker ? StorageManager::LocalStorageNamespace::IsEphemeral::No : StorageManager::LocalStorageNamespace::IsEphemeral::Yes);732 auto storageArea = localStorageNamespace->getOrCreateStorageArea(WTFMove(securityOriginData)); 777 733 storageArea->addListener(connectionID, storageMapID); 778 734 … … 793 749 continue; 794 750 Ref<StorageArea> area = *it->value; 795 if (!area->is Ephemeral())751 if (!area->isSessionStorage()) 796 752 continue; 797 753 if (!origin.securityOrigin()->isSameSchemeHostPort(area->securityOrigin().securityOrigin().get())) … … 825 781 { 826 782 m_queue->dispatch([this, protectedThis = makeRef(*this), connectionID = connection.uniqueID(), storageMapID, storageNamespaceID, securityOriginData = securityOriginData.isolatedCopy()]() mutable { 783 if (m_isEphemeral) { 784 m_ephemeralStorage.add(securityOriginData, WebCore::StorageMap::create(localStorageDatabaseQuotaInBytes)); 785 return; 786 } 827 787 // FIXME: This should be a message check. 828 788 ASSERT(m_sessionStorageNamespaces.isValidKey(storageNamespaceID)); … … 870 830 871 831 // Don't remove session storage maps. The web process may reconnect and expect the data to still be around. 872 if (it->value->is Ephemeral())832 if (it->value->isSessionStorage()) 873 833 return; 874 834 … … 888 848 m_queue->dispatch([this, protectedThis = makeRef(*this), connection = makeRef(connection), securityOriginData = securityOriginData.isolatedCopy(), storageMapID, storageMapSeed, completionHandler = WTFMove(completionHandler)]() mutable { 889 849 auto* storageArea = findStorageArea(connection.get(), storageMapID); 890 891 // This is a session storage area for a page that has already been closed. Ignore it. 892 if (!storageArea) 850 if (!storageArea) { 851 if (m_isEphemeral) { 852 if (auto storageMap = m_ephemeralStorage.get(securityOriginData)) 853 return didGetValues(connection.get(), storageMapID, storageMap->items(), WTFMove(completionHandler)); 854 } 855 // This is a session storage area for a page that has already been closed. Ignore it. 893 856 return didGetValues(connection.get(), storageMapID, { }, WTFMove(completionHandler)); 894 857 } 895 858 didGetValues(connection.get(), storageMapID, storageArea->items(), WTFMove(completionHandler)); 896 859 connection->send(Messages::StorageAreaMap::DidGetValues(storageMapSeed), storageMapID); … … 902 865 m_queue->dispatch([this, protectedThis = makeRef(*this), connection = makeRef(connection), securityOriginData = securityOriginData.isolatedCopy(), storageMapID, sourceStorageAreaID, storageMapSeed, key = key.isolatedCopy(), value = value.isolatedCopy(), urlString = urlString.isolatedCopy()]() mutable { 903 866 auto* storageArea = findStorageArea(connection.get(), storageMapID); 904 905 // This is a session storage area for a page that has already been closed. Ignore it. 906 if (!storageArea) 907 return; 867 if (!storageArea) { 868 if (m_isEphemeral) { 869 if (auto storageMap = m_ephemeralStorage.get(securityOriginData)) { 870 String oldValue; 871 bool quotaException; 872 storageMap->setItem(key, value, oldValue, quotaException); 873 } 874 } 875 // This is a session storage area for a page that has already been closed. Ignore it. 876 return; 877 } 908 878 909 879 bool quotaError; … … 925 895 m_queue->dispatch([this, protectedThis = makeRef(*this), connection = makeRef(connection), securityOriginData = securityOriginData.isolatedCopy(), storageMapID, sourceStorageAreaID, storageMapSeed, key = key.isolatedCopy(), urlString = urlString.isolatedCopy()]() mutable { 926 896 auto* storageArea = findStorageArea(connection.get(), storageMapID); 927 928 // This is a session storage area for a page that has already been closed. Ignore it. 929 if (!storageArea) 930 return; 897 if (!storageArea) { 898 if (m_isEphemeral) { 899 if (auto storageMap = m_ephemeralStorage.get(securityOriginData)) { 900 String oldValue; 901 storageMap->removeItem(key, oldValue); 902 } 903 } 904 // This is a session storage area for a page that has already been closed. Ignore it. 905 return; 906 } 931 907 932 908 storageArea->removeItem(connection->uniqueID(), sourceStorageAreaID, key, urlString); … … 939 915 m_queue->dispatch([this, protectedThis = makeRef(*this), connection = makeRef(connection), securityOriginData = securityOriginData.isolatedCopy(), storageMapID, sourceStorageAreaID, storageMapSeed, urlString = urlString.isolatedCopy()]() mutable { 940 916 auto* storageArea = findStorageArea(connection.get(), storageMapID); 941 942 // This is a session storage area for a page that has already been closed. Ignore it. 943 if (!storageArea) 944 return; 917 if (!storageArea) { 918 if (m_isEphemeral) 919 m_ephemeralStorage.remove(securityOriginData); 920 // This is a session storage area for a page that has already been closed. Ignore it. 921 return; 922 } 945 923 946 924 storageArea->clear(connection->uniqueID(), sourceStorageAreaID, urlString); … … 969 947 void StorageManager::suspend(CompletionHandler<void()>&& completionHandler) 970 948 { 971 if ( !m_localStorageDatabaseTracker)949 if (m_isEphemeral) 972 950 return; 973 951 … … 994 972 void StorageManager::resume() 995 973 { 996 if ( !m_localStorageDatabaseTracker)974 if (m_isEphemeral) 997 975 return; 998 976 -
branches/safari-608.1.27-branch/Source/WebKit/NetworkProcess/WebStorage/StorageManager.h
r245943 r245997 104 104 Ref<WorkQueue> m_queue; 105 105 106 Ref Ptr<LocalStorageDatabaseTracker> m_localStorageDatabaseTracker;106 Ref<LocalStorageDatabaseTracker> m_localStorageDatabaseTracker; 107 107 HashMap<uint64_t, RefPtr<LocalStorageNamespace>> m_localStorageNamespaces; 108 108 … … 113 113 114 114 HashMap<std::pair<IPC::Connection::UniqueID, uint64_t>, RefPtr<StorageArea>> m_storageAreasByConnection; 115 116 HashMap<WebCore::SecurityOriginData, Ref<WebCore::StorageMap>> m_ephemeralStorage; 117 bool m_isEphemeral { false }; 115 118 116 119 enum class State { -
branches/safari-608.1.27-branch/Source/WebKit/WebProcess/WebStorage/StorageAreaMap.cpp
r245943 r245997 295 295 } 296 296 297 if (storageType() == StorageType::Session || storageType() == StorageType::EphemeralLocal)297 if (storageType() == StorageType::Session) 298 298 dispatchSessionStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString); 299 299 else … … 308 308 void StorageAreaMap::dispatchSessionStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) 309 309 { 310 // Namespace IDs for session storage namespaces and ephemeral local storage namespaces are equivalent to web page IDs 310 ASSERT(storageType() == StorageType::Session); 311 312 // Namespace IDs for session storage namespaces are equivalent to web page IDs 311 313 // so we can get the right page here. 312 314 WebPage* webPage = WebProcess::singleton().webPage(makeObjectIdentifier<PageIdentifierType>(m_storageNamespaceID)); … … 376 378 switch (m_storageType) { 377 379 case StorageType::Local: 378 case StorageType::EphemeralLocal:379 380 case StorageType::TransientLocal: 380 381 if (SecurityOrigin* topLevelOrigin = m_storageNamespace->topLevelOrigin()) … … 385 386 case StorageType::Session: 386 387 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManager::CreateSessionStorageMap(m_storageMapID, m_storageNamespace->storageNamespaceID(), m_securityOrigin->data()), 0); 387 } 388 389 if (m_storageMap) 390 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManager::SetItems(m_storageMapID, m_storageMap->items()), 0); 388 if (m_storageMap) 389 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManager::SetItems(m_storageMapID, m_storageMap->items()), 0); 390 break; 391 case StorageType::EphemeralLocal: 392 ASSERT_NOT_REACHED(); 393 return; 394 } 395 391 396 m_isDisconnected = false; 392 397 } -
branches/safari-608.1.27-branch/Source/WebKit/WebProcess/WebStorage/StorageNamespaceImpl.cpp
r245943 r245997 48 48 Ref<StorageNamespaceImpl> StorageNamespaceImpl::createEphemeralLocalStorageNamespace(uint64_t identifier, unsigned quotaInBytes) 49 49 { 50 return create LocalStorageNamespace(identifier, quotaInBytes, IsEphemeral::Yes);50 return createSessionStorageNamespace(identifier, quotaInBytes); 51 51 } 52 52 53 Ref<StorageNamespaceImpl> StorageNamespaceImpl::createLocalStorageNamespace(uint64_t identifier, unsigned quotaInBytes , IsEphemeral isEphemeral)53 Ref<StorageNamespaceImpl> StorageNamespaceImpl::createLocalStorageNamespace(uint64_t identifier, unsigned quotaInBytes) 54 54 { 55 return adoptRef(*new StorageNamespaceImpl( isEphemeral == IsEphemeral::Yes ? StorageType::EphemeralLocal :StorageType::Local, identifier, nullptr, quotaInBytes));55 return adoptRef(*new StorageNamespaceImpl(StorageType::Local, identifier, nullptr, quotaInBytes)); 56 56 } 57 57 -
branches/safari-608.1.27-branch/Source/WebKit/WebProcess/WebStorage/StorageNamespaceImpl.h
r245943 r245997 42 42 static Ref<StorageNamespaceImpl> createSessionStorageNamespace(uint64_t identifier, unsigned quotaInBytes); 43 43 static Ref<StorageNamespaceImpl> createEphemeralLocalStorageNamespace(uint64_t identifier, unsigned quotaInBytes); 44 45 enum class IsEphemeral : bool { No, Yes }; 46 static Ref<StorageNamespaceImpl> createLocalStorageNamespace(uint64_t identifier, unsigned quotaInBytes, IsEphemeral isEphemeral); 44 static Ref<StorageNamespaceImpl> createLocalStorageNamespace(uint64_t identifier, unsigned quotaInBytes); 47 45 static Ref<StorageNamespaceImpl> createTransientLocalStorageNamespace(uint64_t identifier, WebCore::SecurityOrigin& topLevelOrigin, uint64_t quotaInBytes); 48 46 -
branches/safari-608.1.27-branch/Source/WebKit/WebProcess/WebStorage/WebStorageNamespaceProvider.cpp
r245943 r245997 78 78 Ref<WebCore::StorageNamespace> WebStorageNamespaceProvider::createLocalStorageNamespace(unsigned quota) 79 79 { 80 return StorageNamespaceImpl::createLocalStorageNamespace(m_identifier, quota , StorageNamespaceImpl::IsEphemeral::No);80 return StorageNamespaceImpl::createLocalStorageNamespace(m_identifier, quota); 81 81 } 82 82 -
branches/safari-608.1.27-branch/Tools/ChangeLog
r245959 r245997 1 2019-05-31 Alan Coon <alancoon@apple.com> 2 3 Revert r245943. rdar://problem/51244662 4 1 5 2019-05-31 Carlos Garcia Campos <cgarcia@igalia.com> 2 6 -
branches/safari-608.1.27-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm
r245943 r245997 305 305 } 306 306 307 TEST(WKWebsiteDataStore, FetchNonPersistentWebStorage) 308 { 309 auto nonPersistentDataStore = [WKWebsiteDataStore nonPersistentDataStore]; 310 auto configuration = adoptNS([WKWebViewConfiguration new]); 311 [configuration setWebsiteDataStore:nonPersistentDataStore]; 312 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); 313 auto navigationDelegate = adoptNS([[NavigationTestDelegate alloc] init]); 314 [webView setNavigationDelegate:navigationDelegate.get()]; 315 [webView loadHTMLString:@"<script>sessionStorage.setItem('session', 'storage');localStorage.setItem('local', 'storage');</script>" baseURL:[NSURL URLWithString:@"http://localhost"]]; 316 [navigationDelegate waitForDidFinishNavigation]; 317 318 readyToContinue = false; 319 [webView evaluateJavaScript:@"window.sessionStorage.getItem('session')" completionHandler:^(id result, NSError *) { 320 EXPECT_TRUE([@"storage" isEqualToString:result]); 321 readyToContinue = true; 322 }]; 323 TestWebKitAPI::Util::run(&readyToContinue); 324 325 readyToContinue = false; 326 [webView evaluateJavaScript:@"window.localStorage.getItem('local')" completionHandler:^(id result, NSError *) { 327 EXPECT_TRUE([@"storage" isEqualToString:result]); 328 readyToContinue = true; 329 }]; 330 TestWebKitAPI::Util::run(&readyToContinue); 331 332 readyToContinue = false; 333 [nonPersistentDataStore fetchDataRecordsOfTypes:[NSSet setWithObject:WKWebsiteDataTypeSessionStorage] completionHandler:^(NSArray<WKWebsiteDataRecord *> *dataRecords) { 334 EXPECT_EQ((int)dataRecords.count, 1); 335 EXPECT_TRUE([[[dataRecords objectAtIndex:0] displayName] isEqualToString:@"localhost"]); 336 readyToContinue = true; 337 }]; 338 TestWebKitAPI::Util::run(&readyToContinue); 339 340 readyToContinue = false; 341 [nonPersistentDataStore fetchDataRecordsOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] completionHandler:^(NSArray<WKWebsiteDataRecord *> *dataRecords) { 342 EXPECT_EQ((int)dataRecords.count, 1); 343 EXPECT_TRUE([[[dataRecords objectAtIndex:0] displayName] isEqualToString:@"localhost"]); 344 readyToContinue = true; 345 }]; 346 TestWebKitAPI::Util::run(&readyToContinue); 347 } 348 349 } 307 }
Note:
See TracChangeset
for help on using the changeset viewer.