Test sessionStorage in PSON private browsing mode
authorsihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2019 16:30:34 +0000 (16:30 +0000)
committersihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2019 16:30:34 +0000 (16:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196561

Reviewed by Alex Christensen.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

index 4287762..05544dd 100644 (file)
@@ -1,3 +1,12 @@
+2019-04-05  Sihui Liu  <sihui_liu@apple.com>
+
+        Test sessionStorage in PSON private browsing mode
+        https://bugs.webkit.org/show_bug.cgi?id=196561
+
+        Reviewed by Alex Christensen.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
 2019-04-05  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r243833.
index 088e115..8573272 100644 (file)
@@ -4705,7 +4705,7 @@ TEST(ProcessSwap, SwapOnLoadHTMLString)
     done = false;
 }
 
-TEST(ProcessSwap, EphemeralLocalStorage)
+TEST(ProcessSwap, EphemeralWebStorage)
 {
     auto processPoolConfiguration = psonProcessPoolConfiguration();
     auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
@@ -4731,6 +4731,12 @@ TEST(ProcessSwap, EphemeralLocalStorage)
     TestWebKitAPI::Util::run(&done);
 
     done = false;
+    [webView evaluateJavaScript:@"window.sessionStorage.setItem('b,'a')" completionHandler:^(id, NSError *) {
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
+
+    done = false;
     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://example.com/"]]];
     TestWebKitAPI::Util::run(&done);
 
@@ -4755,6 +4761,13 @@ TEST(ProcessSwap, EphemeralLocalStorage)
         done = true;
     }];
     TestWebKitAPI::Util::run(&done);
+
+    done = false;
+    [webView evaluateJavaScript:@"window.sessionStorage.getItem('b')" completionHandler:^(id result, NSError *) {
+        EXPECT_FALSE([@"a" isEqualToString:result]);
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
 }
 
 TEST(ProcessSwap, UsePrewarmedProcessAfterTerminatingNetworkProcess)