WebKit Bugzilla
Attachment 373054 Details for
Bug 199290
: Add a regression test for change r246901
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199290-20190627150137.patch (text/plain), 6.60 KB, created by
Sihui Liu
on 2019-06-27 15:01:38 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2019-06-27 15:01:38 PDT
Size:
6.60 KB
patch
obsolete
>Subversion Revision: 246896 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index e14b12394b510c1278ff483b17d556a5fbff8a48..1c40f68e2b777493c9bb437c22fb36cfb7425a75 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2019-06-27 Sihui Liu <sihui_liu@apple.com> >+ >+ Add a regression test for change r246901 >+ https://bugs.webkit.org/show_bug.cgi?id=199290 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm: >+ (-[LocalStorageNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): >+ (TEST): >+ * TestWebKitAPI/Tests/WebKitCocoa/localstorage-open-window-private.html: Added. >+ > 2019-06-27 Beth Dakin <bdakin@apple.com> > > Upstream use of MACCATALYST >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 8d336e452a47e442d06c73c605b0d8954710b271..c2d03db554b56620ea6fac3ba730663eb5c9de0e 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -1959,6 +1959,7 @@ > 93AF4ECF1506F123007FD57E /* lots-of-images.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-images.html"; sourceTree = "<group>"; }; > 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "autofocused-text-input.html"; sourceTree = "<group>"; }; > 93CFA8681CEBCFED000565A8 /* CandidateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CandidateTests.mm; sourceTree = "<group>"; }; >+ 93D119FB22C57112009BE3C7 /* localstorage-open-window-private.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "localstorage-open-window-private.html"; sourceTree = "<group>"; }; > 93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "all-content-in-one-iframe.html"; sourceTree = "<group>"; }; > 93D3D19D17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutMilestonesWithAllContentInFrame.cpp; sourceTree = "<group>"; }; > 93E2C5541FD3204100E1DF6A /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; }; >@@ -3123,6 +3124,7 @@ > 9368A25D229EFB3A00A829CA /* local-storage-process-suspends-1.html */, > 9368A25C229EFB3A00A829CA /* local-storage-process-suspends-2.html */, > 8C10AF97206467830018FD90 /* localstorage-empty-string-value.html */, >+ 93D119FB22C57112009BE3C7 /* localstorage-open-window-private.html */, > 51E6A8951D2F1C7700C004B6 /* LocalStorageClear.html */, > 46C519E21D35629600DAA51A /* LocalStorageNullEntries.html */, > 46C519E31D35629600DAA51A /* LocalStorageNullEntries.localstorage */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm >index 3db173f882b2a9cd3294b316909176c31bb04cc5..11562bb56934f54d63f977a7bde09d943549ab27 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm >@@ -39,6 +39,7 @@ > static bool readyToContinue; > static bool receivedScriptMessage; > static RetainPtr<WKScriptMessage> lastScriptMessage; >+static RetainPtr<WKWebView> createdWebView; > > @interface LocalStorageMessageHandler : NSObject <WKScriptMessageHandler> > @end >@@ -53,6 +54,19 @@ - (void)userContentController:(WKUserContentController *)userContentController d > > @end > >+@interface LocalStorageNavigationDelegate : NSObject <WKNavigationDelegate, WKUIDelegate> >+@end >+ >+@implementation LocalStorageNavigationDelegate >+ >+- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures >+{ >+ createdWebView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration]); >+ return createdWebView.get(); >+} >+ >+@end >+ > TEST(WKWebView, LocalStorageProcessCrashes) > { > readyToContinue = false; >@@ -198,3 +212,24 @@ TEST(WKWebView, LocalStorageEmptyString) > RetainPtr<NSString> string2 = (NSString *)[lastScriptMessage body]; > EXPECT_WK_STREQ(@"", string2.get()); > } >+ >+TEST(WKWebView, LocalStorageOpenWindowPrivate) >+{ >+ auto handler = adoptNS([[LocalStorageMessageHandler alloc] init]); >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"]; >+ [configuration _setAllowUniversalAccessFromFileURLs:YES]; >+ [configuration setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]]; >+ auto delegate = adoptNS([[LocalStorageNavigationDelegate alloc] init]); >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); >+ [webView setNavigationDelegate:delegate.get()]; >+ [webView setUIDelegate:delegate.get()]; >+ [webView configuration].preferences.javaScriptCanOpenWindowsAutomatically = YES; >+ >+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"localstorage-open-window-private" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >+ [webView loadRequest:request]; >+ >+ receivedScriptMessage = false; >+ TestWebKitAPI::Util::run(&receivedScriptMessage); >+ EXPECT_WK_STREQ(@"local:storage", [lastScriptMessage body]); >+} >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/localstorage-open-window-private.html b/Tools/TestWebKitAPI/Tests/WebKitCocoa/localstorage-open-window-private.html >new file mode 100644 >index 0000000000000000000000000000000000000000..40ce7a8656edd770725ad9bdcc066ab73022546c >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/localstorage-open-window-private.html >@@ -0,0 +1,11 @@ >+<!DOCTYPE html> >+<script> >+window.localStorage.setItem("local", "storage"); >+ >+var newWindow = window.open("about:blank"); >+if (newWindow) >+ window.webkit.messageHandlers.testHandler.postMessage("local:" + newWindow.localStorage.getItem("local")); >+else >+ window.webkit.messageHandlers.testHandler.postMessage("open window fails"); >+ >+</script>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199290
:
373054
|
373126