Changeset 243848 in webkit
- Timestamp:
- Apr 3, 2019, 8:09:48 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit/ReloadPageAfterCrash.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243847 r243848 1 2019-04-03 Chris Dumez <cdumez@apple.com> 2 3 The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash 4 https://bugs.webkit.org/show_bug.cgi?id=196588 5 <rdar://problem/49365787> 6 7 Reviewed by Ryosuke Niwa. 8 9 The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash. 10 This can lead to returning stale frames to the client if it asks for those. 11 12 * UIProcess/WebPageProxy.cpp: 13 (WebKit::WebPageProxy::resetState): 14 1 15 2019-04-03 Simon Fraser <simon.fraser@apple.com> 2 16 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r243847 r243848 6776 6776 { 6777 6777 m_mainFrame = nullptr; 6778 m_focusedFrame = nullptr; 6779 m_frameSetLargestFrame = nullptr; 6778 6780 6779 6781 #if PLATFORM(COCOA) -
trunk/Tools/ChangeLog
r243842 r243848 1 2019-04-03 Chris Dumez <cdumez@apple.com> 2 3 The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash 4 https://bugs.webkit.org/show_bug.cgi?id=196588 5 <rdar://problem/49365787> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add API test coverage. 10 11 * TestWebKitAPI/Tests/WebKit/ReloadPageAfterCrash.cpp: 12 (TestWebKitAPI::nullJavaScriptCallback): 13 (TestWebKitAPI::didCrashCheckFrames): 14 (TestWebKitAPI::TEST): 15 1 16 2019-04-03 Jonathan Bedard <jbedard@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKit/ReloadPageAfterCrash.cpp
r239631 r243848 31 31 #include "PlatformWebView.h" 32 32 #include "Test.h" 33 #include <WebKit/WKPagePrivate.h> 33 34 #include <WebKit/WKRetainPtr.h> 35 #include <signal.h> 34 36 35 37 namespace TestWebKitAPI { … … 37 39 static bool loadBeforeCrash = false; 38 40 static bool loadAfterCrash = false; 41 static bool calledCrashHandler = false; 39 42 40 43 static void didFinishLoad(WKPageRef page, WKNavigationRef, WKTypeRef userData, const void* clientInfo) … … 89 92 } 90 93 94 static void nullJavaScriptCallback(WKSerializedScriptValueRef, WKErrorRef, void*) 95 { 96 } 97 98 static void didCrashCheckFrames(WKPageRef page, const void*) 99 { 100 // Test if first load actually worked. 101 EXPECT_TRUE(loadBeforeCrash); 102 103 EXPECT_TRUE(!WKPageGetMainFrame(page)); 104 EXPECT_TRUE(!WKPageGetFocusedFrame(page)); 105 EXPECT_TRUE(!WKPageGetFrameSetLargestFrame(page)); 106 107 calledCrashHandler = true; 108 } 109 110 TEST(WebKit, FocusedFrameAfterCrash) 111 { 112 WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreateWithConfiguration(nullptr)); 113 PlatformWebView webView(context.get()); 114 115 WKPageNavigationClientV0 loaderClient; 116 memset(&loaderClient, 0, sizeof(loaderClient)); 117 118 loaderClient.base.version = 0; 119 loaderClient.didFinishNavigation = didFinishLoad; 120 loaderClient.webProcessDidCrash = didCrashCheckFrames; 121 122 WKPageSetPageNavigationClient(webView.page(), &loaderClient.base); 123 124 WKRetainPtr<WKURLRef> url = adoptWK(Util::createURLForResource("many-iframes", "html")); 125 WKPageLoadURL(webView.page(), url.get()); 126 Util::run(&loadBeforeCrash); 127 128 EXPECT_FALSE(!WKPageGetMainFrame(webView.page())); 129 130 WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("frames[2].focus()")); 131 WKPageRunJavaScriptInMainFrame(webView.page(), javaScriptString.get(), 0, nullJavaScriptCallback); 132 133 while (!WKPageGetFocusedFrame(webView.page())) 134 Util::spinRunLoop(10); 135 136 kill(WKPageGetProcessIdentifier(webView.page()), 9); 137 138 Util::run(&calledCrashHandler); 139 } 140 141 TEST(WebKit, FrameSetLargestFramAfterCrash) 142 { 143 WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreateWithConfiguration(nullptr)); 144 PlatformWebView webView(context.get()); 145 146 WKPageNavigationClientV0 loaderClient; 147 memset(&loaderClient, 0, sizeof(loaderClient)); 148 149 loaderClient.base.version = 0; 150 loaderClient.didFinishNavigation = didFinishLoad; 151 loaderClient.webProcessDidCrash = didCrashCheckFrames; 152 153 WKPageSetPageNavigationClient(webView.page(), &loaderClient.base); 154 155 WKRetainPtr<WKURLRef> baseURL = adoptWK(WKURLCreateWithUTF8CString("about:blank")); 156 WKRetainPtr<WKStringRef> htmlString = Util::toWK("<frameset cols='25%,*,25%'><frame src='about:blank'><frame src='about:blank'><frame src='about:blank'></frameset>"); 157 158 WKPageLoadHTMLString(webView.page(), htmlString.get(), baseURL.get()); 159 Util::run(&loadBeforeCrash); 160 161 EXPECT_FALSE(!WKPageGetMainFrame(webView.page())); 162 163 while (!WKPageGetFrameSetLargestFrame(webView.page())) 164 Util::spinRunLoop(10); 165 166 kill(WKPageGetProcessIdentifier(webView.page()), 9); 167 168 Util::run(&calledCrashHandler); 169 } 170 91 171 } // namespace TestWebKitAPI 92 172
Note:
See TracChangeset
for help on using the changeset viewer.