Title: [190670] trunk/Source/WebKit2
Revision
190670
Author
[email protected]
Date
2015-10-07 09:39:49 -0700 (Wed, 07 Oct 2015)

Log Message

Expose the bundle parameter object on WKBundleRef
https://bugs.webkit.org/show_bug.cgi?id=149860

Reviewed by Tim Horton.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm:
(-[WKWebProcessBundleParameters description]):
Add a description that includes the parameters.

* WebProcess/InjectedBundle/API/c/mac/WKBundleMac.h:
* WebProcess/InjectedBundle/API/c/mac/WKBundleMac.mm:
(WKBundleGetParameters):
Add getter.

* WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
(WebKit::InjectedBundle::initialize):
Make sure to decode the bundle parameters before calling out to the bundle.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (190669 => 190670)


--- trunk/Source/WebKit2/ChangeLog	2015-10-07 16:29:18 UTC (rev 190669)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-07 16:39:49 UTC (rev 190670)
@@ -1,3 +1,24 @@
+2015-10-06  Anders Carlsson  <[email protected]>
+
+        Expose the bundle parameter object on WKBundleRef
+        https://bugs.webkit.org/show_bug.cgi?id=149860
+
+        Reviewed by Tim Horton.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm:
+        (-[WKWebProcessBundleParameters description]):
+        Add a description that includes the parameters.
+
+        * WebProcess/InjectedBundle/API/c/mac/WKBundleMac.h:
+        * WebProcess/InjectedBundle/API/c/mac/WKBundleMac.mm:
+        (WKBundleGetParameters):
+        Add getter.
+
+        * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
+        (WebKit::InjectedBundle::initialize):
+        Make sure to decode the bundle parameters before calling out to the bundle.
+
 2015-10-06  Michael Catanzaro  <[email protected]>
 
         [GTK] Add autocleanups

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (190669 => 190670)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2015-10-07 16:29:18 UTC (rev 190669)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2015-10-07 16:39:49 UTC (rev 190670)
@@ -44,6 +44,7 @@
 
 - (id)_objectForBundleParameter:(NSString *)parameter;
 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter;
+- (void)_setObjectsForBundleParametersWithDictionary:(NSDictionary *) WK_AVAILABLE(
 
 @property (nonatomic, weak, setter=_setDownloadDelegate:) id <_WKDownloadDelegate> _downloadDelegate;
 

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (190669 => 190670)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-10-07 16:29:18 UTC (rev 190669)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-10-07 16:39:49 UTC (rev 190670)
@@ -315,6 +315,8 @@
 		1A81B38118BD66AD0007FDAC /* _WKVisitedLinkStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A81B37F18BD66AD0007FDAC /* _WKVisitedLinkStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1A81B38518BD673A0007FDAC /* _WKVisitedLinkStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A81B38418BD673A0007FDAC /* _WKVisitedLinkStoreInternal.h */; };
 		1A8B66B01BC43C860082DF77 /* PageLoadStateObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8B66AE1BC43C860082DF77 /* PageLoadStateObserver.h */; settings = {ASSET_TAGS = (); }; };
+		1A8B66B31BC45B010082DF77 /* WKBundleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A8B66B11BC45B010082DF77 /* WKBundleMac.mm */; settings = {ASSET_TAGS = (); }; };
+		1A8B66B41BC45B010082DF77 /* WKBundleMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8B66B21BC45B010082DF77 /* WKBundleMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1A8C728C1738477C000A6554 /* LocalStorageDatabaseTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8C728A1738477C000A6554 /* LocalStorageDatabaseTracker.cpp */; };
 		1A8C728D1738477C000A6554 /* LocalStorageDatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8C728B1738477C000A6554 /* LocalStorageDatabaseTracker.h */; };
 		1A8E7D3C18C15149005A702A /* VisitedLinkTableControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8E7D3A18C15149005A702A /* VisitedLinkTableControllerMessageReceiver.cpp */; };
@@ -2421,6 +2423,8 @@
 		1A81B37F18BD66AD0007FDAC /* _WKVisitedLinkStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKVisitedLinkStore.h; sourceTree = "<group>"; };
 		1A81B38418BD673A0007FDAC /* _WKVisitedLinkStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKVisitedLinkStoreInternal.h; sourceTree = "<group>"; };
 		1A8B66AE1BC43C860082DF77 /* PageLoadStateObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageLoadStateObserver.h; sourceTree = "<group>"; };
+		1A8B66B11BC45B010082DF77 /* WKBundleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBundleMac.mm; sourceTree = "<group>"; };
+		1A8B66B21BC45B010082DF77 /* WKBundleMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleMac.h; sourceTree = "<group>"; };
 		1A8C728A1738477C000A6554 /* LocalStorageDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalStorageDatabaseTracker.cpp; sourceTree = "<group>"; };
 		1A8C728B1738477C000A6554 /* LocalStorageDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageDatabaseTracker.h; sourceTree = "<group>"; };
 		1A8E7D3818C150BF005A702A /* VisitedLinkTableController.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VisitedLinkTableController.messages.in; sourceTree = "<group>"; };
@@ -5870,6 +5874,8 @@
 			children = (
 				7CF47FFD17276AE3008ACB91 /* WKBundlePageBannerMac.h */,
 				7CF47FFC17276AE3008ACB91 /* WKBundlePageBannerMac.mm */,
+				1A8B66B11BC45B010082DF77 /* WKBundleMac.mm */,
+				1A8B66B21BC45B010082DF77 /* WKBundleMac.h */,
 			);
 			path = mac;
 			sourceTree = "<group>";
@@ -7641,6 +7647,7 @@
 				1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */,
 				C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */,
 				BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */,
+				1A8B66B41BC45B010082DF77 /* WKBundleMac.h in Headers */,
 				0FB659231208B4DB0044816C /* DrawingAreaInfo.h in Headers */,
 				1A64229A12DD029200CAAE2C /* DrawingAreaMessages.h in Headers */,
 				BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */,
@@ -9735,6 +9742,7 @@
 				BC09B8F8147460F7005F5625 /* WebContextConnectionClient.cpp in Sources */,
 				BCDE059C11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp in Sources */,
 				51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */,
+				1A8B66B31BC45B010082DF77 /* WKBundleMac.mm in Sources */,
 				BC111A5B112F4FBB00337BAB /* WebContextMenuClient.cpp in Sources */,
 				51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */,
 				512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm (190669 => 190670)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm	2015-10-07 16:29:18 UTC (rev 190669)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm	2015-10-07 16:39:49 UTC (rev 190670)
@@ -44,6 +44,11 @@
     return self;
 }
 
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"<%@: %p; parameters = %@>", NSStringFromClass(self.class), self, _parameters.get()];
+}
+
 - (NSString *)valueForKey:(NSString *)key
 {
     return [_parameters valueForKey:key];

Copied: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/mac/WKBundleMac.h (from rev 190669, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm) (0 => 190670)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/mac/WKBundleMac.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/mac/WKBundleMac.h	2015-10-07 16:39:49 UTC (rev 190670)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef WKBundleMac_h
+#define WKBundleMac_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __OBJC__
+
+WK_EXPORT id WKBundleGetParameters(WKBundleRef bundle);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKBundleMac_h

Copied: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/mac/WKBundleMac.mm (from rev 190669, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm) (0 => 190670)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/mac/WKBundleMac.mm	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/mac/WKBundleMac.mm	2015-10-07 16:39:49 UTC (rev 190670)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 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 "WKBundleMac.h"
+
+#import "InjectedBundle.h"
+#import "WKBundleAPICast.h"
+
+id WKBundleGetParameters(WKBundleRef bundle)
+{
+#if WK_API_ENABLED
+    return WebKit::toImpl(bundle)->bundleParameters();
+#else
+    return nil;
+#endif
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm (190669 => 190670)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2015-10-07 16:29:18 UTC (rev 190669)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2015-10-07 16:39:49 UTC (rev 190670)
@@ -81,13 +81,6 @@
         return false;
     }
 
-    // First check to see if the bundle has a WKBundleInitialize function.
-    WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(CFBundleGetFunctionPointerForName([m_platformBundle _cfBundle], CFSTR("WKBundleInitialize")));
-    if (initializeFunction) {
-        initializeFunction(toAPI(this), toAPI(initializationUserData));
-        return true;
-    }
-    
 #if WK_API_ENABLED
     if (parameters.bundleParameterData) {
         auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]);
@@ -103,9 +96,19 @@
             LOG_ERROR("Failed to decode bundle parameters: %@", exception);
         }
 
+        ASSERT(!m_bundleParameters);
         m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
     }
+#endif
 
+    // First check to see if the bundle has a WKBundleInitialize function.
+    WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(CFBundleGetFunctionPointerForName([m_platformBundle _cfBundle], CFSTR("WKBundleInitialize")));
+    if (initializeFunction) {
+        initializeFunction(toAPI(this), toAPI(initializationUserData));
+        return true;
+    }
+
+#if WK_API_ENABLED
     // Otherwise, look to see if the bundle has a principal class
     Class principalClass = [m_platformBundle principalClass];
     if (!principalClass) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to