Changeset 98399 in webkit
- Timestamp:
- Oct 25, 2011, 3:35:52 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (modified) (6 diffs)
-
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextLoadDelegate.h (modified) (2 diffs)
-
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (5 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2ObjC (added)
-
Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r98394 r98399 1 2011-10-25 Sam Weinig <sam@webkit.org> 2 3 Flesh out WKBrowsingContextLoadDelegate a bit 4 https://bugs.webkit.org/show_bug.cgi?id=70846 5 6 Add didReceiveServerRedirectForProvisionalLoad, didFailProvisionalLoad 7 and didFailLoad. 8 9 Reviewed by Anders Carlsson. 10 11 Test: WKBrowsingContextLoadDelegateTest 12 13 * UIProcess/API/mac/WKBrowsingContextController.mm: 14 (didReceiveServerRedirectForProvisionalLoadForFrame): 15 (didFailProvisionalLoadWithErrorForFrame): 16 (didFailLoadWithErrorForFrame): 17 (setUpPageLoaderClient): 18 * UIProcess/API/mac/WKBrowsingContextLoadDelegate.h: 19 1 20 2011-10-25 Anders Carlsson <andersca@apple.com> 2 21 -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
r98386 r98399 28 28 #import "WKBrowsingContextControllerInternal.h" 29 29 30 #import "WKErrorCF.h" 30 31 #import "WKFrame.h" 31 32 #import "WKPage.h" … … 35 36 #import "WKURLRequest.h" 36 37 #import "WKURLRequestNS.h" 38 #import <wtf/RetainPtr.h> 37 39 38 40 #import "WKBrowsingContextLoadDelegate.h" … … 204 206 205 207 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 206 [browsingContext.loadDelegate browsingContextControllerDidStartProvisionalLoad:browsingContext]; 208 if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidStartProvisionalLoad:)]) 209 [browsingContext.loadDelegate browsingContextControllerDidStartProvisionalLoad:browsingContext]; 210 } 211 212 static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) 213 { 214 if (!WKFrameIsMainFrame(frame)) 215 return; 216 217 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 218 if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidReceiveServerRedirectForProvisionalLoad:)]) 219 [browsingContext.loadDelegate browsingContextControllerDidReceiveServerRedirectForProvisionalLoad:browsingContext]; 220 } 221 222 static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo) 223 { 224 if (!WKFrameIsMainFrame(frame)) 225 return; 226 227 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 228 if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidFailProvisionalLoad:withError:)]) { 229 RetainPtr<CFErrorRef> cfError(AdoptCF, WKErrorCopyCFError(kCFAllocatorDefault, error)); 230 [browsingContext.loadDelegate browsingContextControllerDidFailProvisionalLoad:browsingContext withError:(NSError *)cfError.get()]; 231 } 207 232 } 208 233 … … 213 238 214 239 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 215 [browsingContext.loadDelegate browsingContextControllerDidCommitLoad:browsingContext]; 240 if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidCommitLoad:)]) 241 [browsingContext.loadDelegate browsingContextControllerDidCommitLoad:browsingContext]; 216 242 } 217 243 … … 222 248 223 249 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 224 [browsingContext.loadDelegate browsingContextControllerDidFinishLoad:browsingContext]; 250 if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidFinishLoad:)]) 251 [browsingContext.loadDelegate browsingContextControllerDidFinishLoad:browsingContext]; 252 } 253 254 static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo) 255 { 256 if (!WKFrameIsMainFrame(frame)) 257 return; 258 259 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 260 if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidFailLoad:withError:)]) { 261 RetainPtr<CFErrorRef> cfError(AdoptCF, WKErrorCopyCFError(kCFAllocatorDefault, error)); 262 [browsingContext.loadDelegate browsingContextControllerDidFailLoad:browsingContext withError:(NSError *)cfError.get()]; 263 } 225 264 } 226 265 … … 229 268 WKPageLoaderClient loaderClient; 230 269 memset(&loaderClient, 0, sizeof(loaderClient)); 231 270 232 271 loaderClient.version = kWKPageLoaderClientCurrentVersion; 233 272 loaderClient.clientInfo = browsingContext; 234 273 loaderClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame; 274 loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame; 275 loaderClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame; 235 276 loaderClient.didCommitLoadForFrame = didCommitLoadForFrame; 236 277 loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; 278 loaderClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame; 237 279 238 280 WKPageSetPageLoaderClient(pageRef, &loaderClient); -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextLoadDelegate.h
r98285 r98399 35 35 - (void)browsingContextControllerDidStartProvisionalLoad:(WKBrowsingContextController *)sender; 36 36 37 /* Sent if a server-side redirect was recieved. */ 38 - (void)browsingContextControllerDidReceiveServerRedirectForProvisionalLoad:(WKBrowsingContextController *)sender; 39 40 /* Sent if the provional load fails. */ 41 - (void)browsingContextControllerDidFailProvisionalLoad:(WKBrowsingContextController *)sender withError:(NSError *)error; 42 37 43 /* Sent when the load gets committed. */ 38 44 - (void)browsingContextControllerDidCommitLoad:(WKBrowsingContextController *)sender; … … 41 47 - (void)browsingContextControllerDidFinishLoad:(WKBrowsingContextController *)sender; 42 48 49 /* Sent if the commited load fails. */ 50 - (void)browsingContextControllerDidFailLoad:(WKBrowsingContextController *)sender withError:(NSError *)error; 51 43 52 @end -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r98285 r98399 696 696 BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBAACEF145232440053F82F /* WKBrowsingContextGroup.mm */; }; 697 697 BCBAACF61452324F0053F82F /* WKBrowsingContextGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAACF0145232480053F82F /* WKBrowsingContextGroupInternal.h */; }; 698 BCBAAD0B14560A430053F82F /* WKBrowsingContextLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */; };698 BCBAAD0B14560A430053F82F /* WKBrowsingContextLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 699 699 BCBCB0CB1215E32100DE59CA /* ImmutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */; }; 700 700 BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */; }; -
trunk/Tools/ChangeLog
r98395 r98399 1 2011-10-25 Sam Weinig <sam@webkit.org> 2 3 Flesh out WKBrowsingContextLoadDelegate a bit 4 https://bugs.webkit.org/show_bug.cgi?id=70846 5 6 Reviewed by Anders Carlsson. 7 8 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 9 * TestWebKitAPI/Tests/WebKit2ObjC: Added. 10 * TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm: Added. 11 (WKBrowsingContextLoadDelegateTest::WKBrowsingContextLoadDelegateTest): 12 (WKBrowsingContextLoadDelegateTest::SetUp): 13 (WKBrowsingContextLoadDelegateTest::TearDown): 14 (-[SimpleLoadDelegate browsingContextControllerDidFinishLoad:]): 15 (TEST_F): 16 Add basic testing for WKBrowsingContextLoadDelegate. 17 1 18 2011-10-25 Alexey Proskuryakov <ap@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r97633 r98399 44 44 BC2D004912A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2D004812A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp */; }; 45 45 BC2D006412AA04CE00E732A3 /* file-with-anchor.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */; }; 46 BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */; }; 46 47 BC575A90126E74D3006F0F12 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCB9E9F011235BDE00A137E0 /* Cocoa.framework */; }; 47 48 BC575A91126E74D3006F0F12 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCA61DB411700EFD00460D1E /* WebKit2.framework */; }; … … 179 180 BC2D004812A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageLoadDidChangeLocationWithinPageForFrame.cpp; sourceTree = "<group>"; }; 180 181 BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */ = {isa = PBXFileReference; explicitFileType = text.html; fileEncoding = 4; path = "file-with-anchor.html"; sourceTree = "<group>"; }; 182 BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBrowsingContextLoadDelegateTest.mm; path = WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm; sourceTree = "<group>"; }; 181 183 BC575946126E7351006F0F12 /* InjectedBundleMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMain.cpp; sourceTree = "<group>"; }; 182 184 BC575980126E74AF006F0F12 /* InjectedBundleTestWebKitAPI.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InjectedBundleTestWebKitAPI.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; … … 321 323 sourceTree = "<group>"; 322 324 }; 325 BC3C4C6F14575B1D0025FB62 /* WebKit2 Objective-C */ = { 326 isa = PBXGroup; 327 children = ( 328 BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */, 329 ); 330 name = "WebKit2 Objective-C"; 331 sourceTree = "<group>"; 332 }; 323 333 BC575944126E733C006F0F12 /* InjectedBundle */ = { 324 334 isa = PBXGroup; … … 445 455 C07E6CAD13FD67650038B22B /* mac */, 446 456 BC9096411255616000083756 /* WebKit2 */, 457 BC3C4C6F14575B1D0025FB62 /* WebKit2 Objective-C */, 447 458 BC9096461255618900083756 /* WTF */, 448 459 ); … … 626 637 C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */, 627 638 52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */, 639 BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */, 628 640 ); 629 641 runOnlyForDeploymentPostprocessing = 0;
Note:
See TracChangeset
for help on using the changeset viewer.