Changeset 177362 in webkit


Ignore:
Timestamp:
Dec 16, 2014 9:45:13 AM (9 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] WKWebProcessPlugInLoadDelegate can’t tell what type of same-document navigation has happened
https://bugs.webkit.org/show_bug.cgi?id=139669

Reviewed by Anders Carlsson.

  • Shared/API/Cocoa/_WKSameDocumentNavigationType.h: Added. Moved the

_WKSameDocumentNavigationType type definition here from WKNavigationDelegatePrivate.h.

  • Shared/API/Cocoa/_WKSameDocumentNavigationTypeInternal.h: Added.

(WebKit::toWKSameDocumentNavigationType): Moved from NavigationState.mm.

  • Shared/API/c/WKSharedAPICast.h:

(WebKit::toSameDocumentNavigationType): Added this conversion helper.

  • UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Added #import.
  • UIProcess/Cocoa/NavigationState.mm:

(WebKit::toWKSameDocumentNavigationType): Deleted.

  • WebKit2.xcodeproj/project.pbxproj: Updated for added headers.
  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: Declared new

delegate method that take a navigation type parameter.

  • WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

(didSameDocumentNavigationForFrame): Changed to call the new delegate method, passing the
navigation type.

Location:
trunk/Source/WebKit2
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r177358 r177362  
     12014-12-16  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] WKWebProcessPlugInLoadDelegate can’t tell what type of same-document navigation has happened
     4        https://bugs.webkit.org/show_bug.cgi?id=139669
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * Shared/API/Cocoa/_WKSameDocumentNavigationType.h: Added. Moved the
     9        _WKSameDocumentNavigationType type definition here from WKNavigationDelegatePrivate.h.
     10        * Shared/API/Cocoa/_WKSameDocumentNavigationTypeInternal.h: Added.
     11        (WebKit::toWKSameDocumentNavigationType): Moved from NavigationState.mm.
     12
     13        * Shared/API/c/WKSharedAPICast.h:
     14        (WebKit::toSameDocumentNavigationType): Added this conversion helper.
     15
     16        * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Added #import.
     17
     18        * UIProcess/Cocoa/NavigationState.mm:
     19        (WebKit::toWKSameDocumentNavigationType): Deleted.
     20
     21        * WebKit2.xcodeproj/project.pbxproj: Updated for added headers.
     22
     23        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: Declared new
     24        delegate method that take a navigation type parameter.
     25
     26        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
     27        (didSameDocumentNavigationForFrame): Changed to call the new delegate method, passing the
     28        navigation type.
     29
    1302014-12-16  Carlos Garcia Campos  <cgarcia@igalia.com>
    231
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r172755 r177362  
    805805}
    806806
     807inline SameDocumentNavigationType toSameDocumentNavigationType(WKSameDocumentNavigationType wkType)
     808{
     809    SameDocumentNavigationType type = SameDocumentNavigationAnchorNavigation;
     810
     811    switch (wkType) {
     812    case kWKSameDocumentNavigationAnchorNavigation:
     813        type = SameDocumentNavigationAnchorNavigation;
     814        break;
     815    case kWKSameDocumentNavigationSessionStatePush:
     816        type = SameDocumentNavigationSessionStatePush;
     817        break;
     818    case kWKSameDocumentNavigationSessionStateReplace:
     819        type = SameDocumentNavigationSessionStateReplace;
     820        break;
     821    case kWKSameDocumentNavigationSessionStatePop:
     822        type = SameDocumentNavigationSessionStatePop;
     823        break;
     824    }
     825   
     826    return type;
     827}
     828
    807829inline WKLayoutMilestones toWKLayoutMilestones(WebCore::LayoutMilestones milestones)
    808830{
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h

    r171045 r177362  
    2828#import <WebKit/WKFrameInfo.h>
    2929#import <WebKit/WKWebViewPrivate.h>
     30#import <WebKit/_WKSameDocumentNavigationType.h>
    3031
    3132#if WK_API_ENABLED
     
    3435
    3536static const WKNavigationResponsePolicy _WKNavigationResponsePolicyBecomeDownload = (WKNavigationResponsePolicy)(WKNavigationResponsePolicyAllow + 1);
    36 
    37 typedef NS_ENUM(NSInteger, _WKSameDocumentNavigationType) {
    38     _WKSameDocumentNavigationTypeAnchorNavigation,
    39     _WKSameDocumentNavigationTypeSessionStatePush,
    40     _WKSameDocumentNavigationTypeSessionStateReplace,
    41     _WKSameDocumentNavigationTypeSessionStatePop,
    42 } WK_AVAILABLE(10_10, 8_0);
    4337
    4438@protocol WKNavigationDelegatePrivate <WKNavigationDelegate>
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r177163 r177362  
    5757#import "_WKErrorRecoveryAttempting.h"
    5858#import "_WKFrameHandleInternal.h"
     59#import "_WKSameDocumentNavigationTypeInternal.h"
    5960#import <WebCore/Credential.h>
    6061#import <wtf/NeverDestroyed.h>
     
    622623}
    623624
    624 static _WKSameDocumentNavigationType toWKSameDocumentNavigationType(SameDocumentNavigationType navigationType)
    625 {
    626     switch (navigationType) {
    627     case SameDocumentNavigationAnchorNavigation:
    628         return _WKSameDocumentNavigationTypeAnchorNavigation;
    629     case SameDocumentNavigationSessionStatePush:
    630         return _WKSameDocumentNavigationTypeSessionStatePush;
    631     case SameDocumentNavigationSessionStateReplace:
    632         return _WKSameDocumentNavigationTypeSessionStateReplace;
    633     case SameDocumentNavigationSessionStatePop:
    634         return _WKSameDocumentNavigationTypeSessionStatePop;
    635     }
    636 
    637     ASSERT_NOT_REACHED();
    638     return _WKSameDocumentNavigationTypeAnchorNavigation;
    639 }
    640 
    641625void NavigationState::LoaderClient::didSameDocumentNavigationForFrame(WebPageProxy*, WebFrameProxy* webFrameProxy, uint64_t navigationID, SameDocumentNavigationType navigationType, API::Object*)
    642626{
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r177296 r177362  
    736736                37608822150414F700FC82C7 /* WKRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37608820150414F700FC82C7 /* WKRenderObject.cpp */; };
    737737                37608823150414F700FC82C7 /* WKRenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 37608821150414F700FC82C7 /* WKRenderObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
     738                376311FD1A3FB5F7005A2E51 /* _WKSameDocumentNavigationType.h in Headers */ = {isa = PBXBuildFile; fileRef = 376311F81A3FB30B005A2E51 /* _WKSameDocumentNavigationType.h */; settings = {ATTRIBUTES = (Private, ); }; };
     739                376311FE1A3FB600005A2E51 /* _WKSameDocumentNavigationTypeInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 376311FA1A3FB38B005A2E51 /* _WKSameDocumentNavigationTypeInternal.h */; };
    738740                3766F9EE189A1241003CF19B /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; };
    739741                3766F9EF189A1244003CF19B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; };
     
    27922794                37608820150414F700FC82C7 /* WKRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKRenderObject.cpp; sourceTree = "<group>"; };
    27932795                37608821150414F700FC82C7 /* WKRenderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRenderObject.h; sourceTree = "<group>"; };
     2796                376311F81A3FB30B005A2E51 /* _WKSameDocumentNavigationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSameDocumentNavigationType.h; sourceTree = "<group>"; };
     2797                376311FA1A3FB38B005A2E51 /* _WKSameDocumentNavigationTypeInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSameDocumentNavigationTypeInternal.h; sourceTree = "<group>"; };
    27942798                3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APIInjectedBundlePageUIClient.h; path = API/APIInjectedBundlePageUIClient.h; sourceTree = "<group>"; };
    27952799                3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleFormClient.h; sourceTree = "<group>"; };
     
    52575261                                1F604BA61889FA7400EE0395 /* WKRenderingProgressEvents.h */,
    52585262                                1F604BA71889FA7400EE0395 /* WKRenderingProgressEventsInternal.h */,
     5263                                376311F81A3FB30B005A2E51 /* _WKSameDocumentNavigationType.h */,
     5264                                376311FA1A3FB38B005A2E51 /* _WKSameDocumentNavigationTypeInternal.h */,
    52595265                        );
    52605266                        path = Cocoa;
     
    78407846                                BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */,
    78417847                                1AF4CEF018BC481800BC2D34 /* VisitedLinkTableController.h in Headers */,
     7848                                376311FD1A3FB5F7005A2E51 /* _WKSameDocumentNavigationType.h in Headers */,
    78427849                                E4436ECC1A0D040B00EAD204 /* NetworkCache.h in Headers */,
    78437850                                BC4075F6124FF0270068F20A /* WKCertificateInfo.h in Headers */,
     
    79477954                                51D0D437183B353D0097041D /* DatabaseProcessIDBConnectionMessages.h in Headers */,
    79487955                                BCBAACED145225E30053F82F /* WKProcessGroupPrivate.h in Headers */,
     7956                                376311FE1A3FB600005A2E51 /* _WKSameDocumentNavigationTypeInternal.h in Headers */,
    79497957                                512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */,
    79507958                                518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */,
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h

    r176901 r177362  
    2525#import <Foundation/Foundation.h>
    2626#import <WebKit/WKRenderingProgressEvents.h>
     27#import <WebKit/_WKSameDocumentNavigationType.h>
    2728
    2829@class WKWebProcessPlugInBrowsingContextController;
     
    4142- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didFailLoadWithErrorForFrame:(WKWebProcessPlugInFrame *)frame error:(NSError *)error;
    4243- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didFinishLoadForFrame:(WKWebProcessPlugInFrame *)frame;
    43 - (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didSameDocumentNavigationForFrame:(WKWebProcessPlugInFrame *)frame;
     44- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didSameDocumentNavigation:(_WKSameDocumentNavigationType)navigationType forFrame:(WKWebProcessPlugInFrame *)frame;
    4445- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller globalObjectIsAvailableForFrame:(WKWebProcessPlugInFrame *)frame inScriptWorld:(WKWebProcessPlugInScriptWorld *)scriptWorld;
    4546- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller didRemoveFrameFromHierarchy:(WKWebProcessPlugInFrame *)frame;
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm

    r176901 r177362  
    5757#import "WebProcess.h"
    5858#import "_WKRemoteObjectRegistryInternal.h"
     59#import "_WKSameDocumentNavigationTypeInternal.h"
    5960#import <WebCore/Document.h>
    6061#import <WebCore/Frame.h>
     
    6566using namespace WebCore;
    6667using namespace WebKit;
     68
     69@interface NSObject (WKDeprecatedDelegateMethods)
     70- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller didSameDocumentNavigationForFrame:(WKWebProcessPlugInFrame *)frame;
     71@end
    6772
    6873@implementation WKWebProcessPlugInBrowserContextController {
     
    151156    auto loadDelegate = pluginContextController->_loadDelegate.get();
    152157
    153     if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didSameDocumentNavigationForFrame:)])
    154         [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didSameDocumentNavigationForFrame:wrapper(*toImpl(frame))];
     158    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didSameDocumentNavigation:forFrame:)])
     159        [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didSameDocumentNavigation:toWKSameDocumentNavigationType(toSameDocumentNavigationType(type)) forFrame:wrapper(*toImpl(frame))];
     160    else {
     161        // FIXME: Remove this once clients switch to implementing the above delegate method.
     162        if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didSameDocumentNavigationForFrame:)])
     163            [(NSObject *)loadDelegate webProcessPlugInBrowserContextController:pluginContextController didSameDocumentNavigationForFrame:wrapper(*toImpl(frame))];
     164    }
    155165}
    156166
Note: See TracChangeset for help on using the changeset viewer.