Title: [289298] branches/safari-613-branch
Revision
289298
Author
[email protected]
Date
2022-02-07 18:54:54 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288478. rdar://problem/72567903

    Regression (r286936): SessionStorage data is not cleared when deleting website data by modification time
    https://bugs.webkit.org/show_bug.cgi?id=235542

    Reviewed by Chris Dumez.

    Source/WebKit:

    The old behavior before r286936 is to delete SessionStorage data regardless of the modifiedSince parameter.
    r286936 made it check modifiedSince and perform deleteion when modifiedSince time is -Walltime::infinity. This
    patch corrects it by deleting SessionStorage data when modifiedSince time is in the past.

    API test: SessionStorage.ClearByModificationTime

    * NetworkProcess/storage/OriginStorageManager.cpp:
    (WebKit::OriginStorageManager::StorageBucket::deleteData):

    Tools:

    * TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm:
    (TEST):

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (289297 => 289298)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 02:54:50 UTC (rev 289297)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 02:54:54 UTC (rev 289298)
@@ -1,5 +1,49 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288478. rdar://problem/72567903
+
+    Regression (r286936): SessionStorage data is not cleared when deleting website data by modification time
+    https://bugs.webkit.org/show_bug.cgi?id=235542
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebKit:
+    
+    The old behavior before r286936 is to delete SessionStorage data regardless of the modifiedSince parameter.
+    r286936 made it check modifiedSince and perform deleteion when modifiedSince time is -Walltime::infinity. This
+    patch corrects it by deleting SessionStorage data when modifiedSince time is in the past.
+    
+    API test: SessionStorage.ClearByModificationTime
+    
+    * NetworkProcess/storage/OriginStorageManager.cpp:
+    (WebKit::OriginStorageManager::StorageBucket::deleteData):
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm:
+    (TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288478 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-24  Sihui Liu  <[email protected]>
+
+            Regression (r286936): SessionStorage data is not cleared when deleting website data by modification time
+            https://bugs.webkit.org/show_bug.cgi?id=235542
+
+            Reviewed by Chris Dumez.
+
+            The old behavior before r286936 is to delete SessionStorage data regardless of the modifiedSince parameter.
+            r286936 made it check modifiedSince and perform deleteion when modifiedSince time is -Walltime::infinity. This
+            patch corrects it by deleting SessionStorage data when modifiedSince time is in the past.
+
+            API test: SessionStorage.ClearByModificationTime
+
+            * NetworkProcess/storage/OriginStorageManager.cpp:
+            (WebKit::OriginStorageManager::StorageBucket::deleteData):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288466. rdar://problem/82554226
 
     REGRESSION (iOS 15): HTMLAudioElement fails to load new audio when device is locked or safari is in background

Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp (289297 => 289298)


--- branches/safari-613-branch/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp	2022-02-08 02:54:50 UTC (rev 289297)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp	2022-02-08 02:54:54 UTC (rev 289298)
@@ -174,7 +174,7 @@
         if (types.contains(WebsiteDataType::LocalStorage))
             deleteLocalStorageData(modifiedSinceTime);
 
-        if (types.contains(WebsiteDataType::SessionStorage) && modifiedSinceTime == -WallTime::infinity())
+        if (types.contains(WebsiteDataType::SessionStorage) && modifiedSinceTime < WallTime::now())
             deleteSessionStorageData();
     }
 

Modified: branches/safari-613-branch/Tools/ChangeLog (289297 => 289298)


--- branches/safari-613-branch/Tools/ChangeLog	2022-02-08 02:54:50 UTC (rev 289297)
+++ branches/safari-613-branch/Tools/ChangeLog	2022-02-08 02:54:54 UTC (rev 289298)
@@ -1,5 +1,43 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288478. rdar://problem/72567903
+
+    Regression (r286936): SessionStorage data is not cleared when deleting website data by modification time
+    https://bugs.webkit.org/show_bug.cgi?id=235542
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebKit:
+    
+    The old behavior before r286936 is to delete SessionStorage data regardless of the modifiedSince parameter.
+    r286936 made it check modifiedSince and perform deleteion when modifiedSince time is -Walltime::infinity. This
+    patch corrects it by deleting SessionStorage data when modifiedSince time is in the past.
+    
+    API test: SessionStorage.ClearByModificationTime
+    
+    * NetworkProcess/storage/OriginStorageManager.cpp:
+    (WebKit::OriginStorageManager::StorageBucket::deleteData):
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm:
+    (TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288478 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-24  Sihui Liu  <[email protected]>
+
+            Regression (r286936): SessionStorage data is not cleared when deleting website data by modification time
+            https://bugs.webkit.org/show_bug.cgi?id=235542
+
+            Reviewed by Chris Dumez.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm:
+            (TEST):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288178. rdar://problem/79296770
 
     REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus

Modified: branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm (289297 => 289298)


--- branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm	2022-02-08 02:54:50 UTC (rev 289297)
+++ branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SessionStorage.mm	2022-02-08 02:54:54 UTC (rev 289298)
@@ -117,3 +117,32 @@
 {
     runSessionStorageInNewWindowTest(@"a = document.createElement('a'); a.href = "" a.target = 'newWindow'; a.rel='noopener'; a.click()", ShouldSessionBeCloned::No);
 }
+
+TEST(SessionStorage, ClearByModificationTime)
+{
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    [webView synchronouslyLoadHTMLString:@"<script>sessionStorage.setItem('key', 'value')</script>" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
+
+    auto websiteDataTypes = adoptNS([[NSSet alloc] initWithArray:@[WKWebsiteDataTypeSessionStorage]]);
+    readyToContinue = false;
+    [[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:websiteDataTypes.get() completionHandler:^(NSArray<WKWebsiteDataRecord *> *dataRecords) {
+        EXPECT_EQ(1u, dataRecords.count);
+        EXPECT_WK_STREQ("webkit.org", [[dataRecords firstObject] displayName]);
+        readyToContinue = true;
+    }];
+    TestWebKitAPI::Util::run(&readyToContinue);
+
+    readyToContinue = false;
+    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes.get() modifiedSince:[NSDate distantPast] completionHandler:^() {
+        readyToContinue = true;
+    }];
+    TestWebKitAPI::Util::run(&readyToContinue);
+
+    readyToContinue = false;
+    [[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:websiteDataTypes.get() completionHandler:^(NSArray<WKWebsiteDataRecord *> *dataRecords) {
+        EXPECT_EQ(0u, dataRecords.count);
+        readyToContinue = true;
+    }];
+    TestWebKitAPI::Util::run(&readyToContinue);
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to