Diff
Modified: trunk/Source/WebKit2/ChangeLog (169806 => 169807)
--- trunk/Source/WebKit2/ChangeLog 2014-06-11 14:42:30 UTC (rev 169806)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-11 15:36:58 UTC (rev 169807)
@@ -1,3 +1,31 @@
+2014-06-11 Antti Koivisto <an...@apple.com>
+
+ Wrap NSURLRequest in bundle API
+ https://bugs.webkit.org/show_bug.cgi?id=133732
+ <rdar://problem/17267217>
+
+ Reviewed by Andreas Kling.
+
+ Patch by Dan Bernstein.
+
+ We don't want to construct actual NSURLRequests in the web process side unless really needed as it is slow.
+
+ * Shared/Cocoa/APIObject.mm:
+ (API::Object::newObject):
+ * Shared/Cocoa/WKNSURLRequest.h: Added.
+ (WebKit::wrapper):
+ * Shared/Cocoa/WKNSURLRequest.mm: Added.
+
+ Add a wrapper object that initializes the underlying NSURLRequest on-demand.
+
+ (-[WKNSURLRequest _web_createTarget]):
+ (-[WKNSURLRequest URL]):
+ (-[WKNSURLRequest copyWithZone:]):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+ (willSendRequestForFrame):
+ (didInitiateLoadForResource):
+
2014-06-11 Dan Bernstein <m...@apple.com>
<rdar://problem/17218629> [Cocoa] WKWebView’s canGoBack and canGoForward properties are not KVO-compliant
Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (169806 => 169807)
--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm 2014-06-11 14:42:30 UTC (rev 169806)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm 2014-06-11 15:36:58 UTC (rev 169807)
@@ -41,6 +41,7 @@
#import "WKNSURL.h"
#import "WKNSURLAuthenticationChallenge.h"
#import "WKNSURLProtectionSpace.h"
+#import "WKNSURLRequest.h"
#import "WKNavigationDataInternal.h"
#import "WKProcessPoolInternal.h"
#import "WKWebProcessPlugInBrowserContextControllerInternal.h"
@@ -151,6 +152,10 @@
wrapper = NSAllocateObject([WKNSURL class], size, nullptr);
break;
+ case Type::URLRequest:
+ wrapper = NSAllocateObject([WKNSURLRequest class], size, nullptr);
+ break;
+
case Type::BundleFrame:
wrapper = [WKWebProcessPlugInFrame alloc];
break;
Added: trunk/Source/WebKit2/Shared/Cocoa/WKNSURLRequest.h (0 => 169807)
--- trunk/Source/WebKit2/Shared/Cocoa/WKNSURLRequest.h (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSURLRequest.h 2014-06-11 15:36:58 UTC (rev 169807)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKFoundation.h"
+
+#if WK_API_ENABLED
+
+#import "APIURLRequest.h"
+#import "WKObject.h"
+
+namespace WebKit {
+
+inline NSURLRequest *wrapper(API::URLRequest& request)
+{
+ return (NSURLRequest *)request.wrapper();
+}
+
+}
+
+@interface WKNSURLRequest : WKObject <NSCopying>
+@end
+
+#endif // WK_API_ENABLED
Added: trunk/Source/WebKit2/Shared/Cocoa/WKNSURLRequest.mm (0 => 169807)
--- trunk/Source/WebKit2/Shared/Cocoa/WKNSURLRequest.mm (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSURLRequest.mm 2014-06-11 15:36:58 UTC (rev 169807)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WKNSURLRequest.h"
+
+#if WK_API_ENABLED
+
+#import "WKNSURLExtras.h"
+
+@implementation WKNSURLRequest
+
+- (NSObject *)_web_createTarget
+{
+ return [static_cast<API::URLRequest*>(&self._apiObject)->resourceRequest().nsURLRequest(WebCore::DoNotUpdateHTTPBody) copy];
+}
+
+- (NSURL *)URL
+{
+ return [NSURL _web_URLWithWTFString:static_cast<API::URLRequest*>(&self._apiObject)->resourceRequest().url().string()];
+}
+
+#pragma mark NSCopying protocol implementation
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return [self retain];
+}
+
+@end
+
+#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (169806 => 169807)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-06-11 14:42:30 UTC (rev 169806)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-06-11 15:36:58 UTC (rev 169807)
@@ -726,6 +726,8 @@
37A5E01418BBF93F000A081E /* _WKActivatedElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
37A64E5518F38E3C00EB30F1 /* _WKFormDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A64E5418F38E3C00EB30F1 /* _WKFormDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
37A64E5718F38F4600EB30F1 /* _WKFormInputSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A64E5618F38F4600EB30F1 /* _WKFormInputSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 37BF2F061947DEB400723C48 /* WKNSURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 37BF2F041947DEB400723C48 /* WKNSURLRequest.h */; };
+ 37BF2F071947DEB400723C48 /* WKNSURLRequest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BF2F051947DEB400723C48 /* WKNSURLRequest.mm */; };
37C4C08618149C5B003688B9 /* WKBackForwardListItem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C4C08418149C5B003688B9 /* WKBackForwardListItem.mm */; };
37C4C08718149C5B003688B9 /* WKBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C4C08518149C5B003688B9 /* WKBackForwardListItem.h */; settings = {ATTRIBUTES = (Public, ); }; };
37C4C08918149F23003688B9 /* WKBackForwardListItemInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */; };
@@ -2707,6 +2709,8 @@
37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKActivatedElementInfo.h; sourceTree = "<group>"; };
37A64E5418F38E3C00EB30F1 /* _WKFormDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFormDelegate.h; sourceTree = "<group>"; };
37A64E5618F38F4600EB30F1 /* _WKFormInputSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFormInputSession.h; sourceTree = "<group>"; };
+ 37BF2F041947DEB400723C48 /* WKNSURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLRequest.h; sourceTree = "<group>"; };
+ 37BF2F051947DEB400723C48 /* WKNSURLRequest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLRequest.mm; sourceTree = "<group>"; };
37C4C08418149C5B003688B9 /* WKBackForwardListItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBackForwardListItem.mm; sourceTree = "<group>"; };
37C4C08518149C5B003688B9 /* WKBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItem.h; sourceTree = "<group>"; };
37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItemInternal.h; sourceTree = "<group>"; };
@@ -5036,6 +5040,8 @@
37183D54182F4E700080C811 /* WKNSURLExtras.mm */,
371B32DC184D67490013E2B2 /* WKNSURLProtectionSpace.h */,
371B32DB184D67480013E2B2 /* WKNSURLProtectionSpace.mm */,
+ 37BF2F041947DEB400723C48 /* WKNSURLRequest.h */,
+ 37BF2F051947DEB400723C48 /* WKNSURLRequest.mm */,
378E1A3F181EDA010031007A /* WKObject.h */,
374436871820E7240049579F /* WKObject.mm */,
);
@@ -7324,6 +7330,7 @@
CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */,
512E352F130B55AF00ABD19A /* WebApplicationCacheManager.h in Headers */,
1A256E3A18A1A7DF006FB922 /* WKNavigationActionInternal.h in Headers */,
+ 37BF2F061947DEB400723C48 /* WKNSURLRequest.h in Headers */,
512E356B130B57F000ABD19A /* WebApplicationCacheManagerMessages.h in Headers */,
512E3525130B550600ABD19A /* WebApplicationCacheManagerProxy.h in Headers */,
512E35F9130B642E00ABD19A /* WebApplicationCacheManagerProxyMessages.h in Headers */,
@@ -9211,6 +9218,7 @@
BC646C1A11DD399F006455B0 /* WKBackForwardListRef.cpp in Sources */,
BC646C1C11DD399F006455B0 /* WKBackForwardListItemRef.cpp in Sources */,
1A256E3718A1A788006FB922 /* WKNavigationAction.mm in Sources */,
+ 37BF2F071947DEB400723C48 /* WKNSURLRequest.mm in Sources */,
BCBAAC72144E61990053F82F /* WKBrowsingContextController.mm in Sources */,
BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */,
51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (169806 => 169807)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2014-06-11 14:42:30 UTC (rev 169806)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2014-06-11 15:36:58 UTC (rev 169807)
@@ -38,6 +38,7 @@
#import "WKDOMInternals.h"
#import "WKNSDictionary.h"
#import "WKNSError.h"
+#import "WKNSURLRequest.h"
#import "WKRenderingProgressEventsInternal.h"
#import "WKRetainPtr.h"
#import "WKURLRequestNS.h"
@@ -205,7 +206,7 @@
auto loadDelegate = pluginContextController->_loadDelegate.get();
if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:frame:willSendRequest:redirectResponse:)]) {
- NSURLRequest *originalRequest = toImpl(request)->resourceRequest().nsURLRequest(DoNotUpdateHTTPBody);
+ NSURLRequest *originalRequest = wrapper(*toImpl(request));
RetainPtr<NSURLRequest> substituteRequest = [loadDelegate webProcessPlugInBrowserContextController:pluginContextController frame:wrapper(*toImpl(frame)) willSendRequest:originalRequest
redirectResponse:toImpl(redirectResponse)->resourceResponse().nsURLResponse()];
@@ -226,7 +227,7 @@
[loadDelegate webProcessPlugInBrowserContextController:pluginContextController
frame:wrapper(*toImpl(frame))
didInitiateLoadForResource:resourceIdentifier
- request:toImpl(request)->resourceRequest().nsURLRequest(DoNotUpdateHTTPBody)];
+ request:wrapper(*toImpl(request))];
}
}