Diff
Modified: trunk/Source/WebKit2/ChangeLog (165754 => 165755)
--- trunk/Source/WebKit2/ChangeLog 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/ChangeLog 2014-03-17 20:38:28 UTC (rev 165755)
@@ -1,3 +1,30 @@
+2014-03-17 Anders Carlsson <[email protected]>
+
+ Add SPI for getting bundle parameters from the injected bundle
+ https://bugs.webkit.org/show_bug.cgi?id=130355
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/mac/WebContextMac.mm:
+ (WebKit::WebContext::platformInitializeWebProcess):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.h: Copied from Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h.
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm: Copied from Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h.
+ (-[WKWebProcessBundleParameters initWithDictionary:]):
+ (-[WKWebProcessBundleParameters valueForKey:]):
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
+ (-[WKWebProcessPlugInController parameters]):
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::InjectedBundle):
+ * WebProcess/InjectedBundle/InjectedBundle.h:
+ (WebKit::InjectedBundle::create):
+ * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
+ (WebKit::InjectedBundle::bundleParameters):
+ (WebKit::InjectedBundle::platformInitialize):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeWebProcess):
+
2014-03-17 Brent Fulgham <[email protected]>
Provide preference to enable additional AVFoundation options
Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (165754 => 165755)
--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2014-03-17 20:38:28 UTC (rev 165755)
@@ -60,7 +60,7 @@
#endif
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1080
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1080
@interface NSKeyedArchiver (WKDetails)
- (void)setRequiresSecureCoding:(BOOL)b;
@end
@@ -198,7 +198,7 @@
if (m_bundleParameters) {
auto data = "" alloc] init]);
- auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] init]);
+ auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
[keyedArchiver setRequiresSecureCoding:YES];
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (165754 => 165755)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-03-17 20:38:28 UTC (rev 165755)
@@ -288,6 +288,8 @@
1AA20D5118AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA20D5018AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */; };
1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */; };
+ 1AA2E56618D77508003814BD /* WKWebProcessBundleParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */; };
+ 1AA2E56718D77508003814BD /* WKWebProcessBundleParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */; };
1AA3D75B1651B44F008713D0 /* RemoteLayerTreeHost.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */; };
1AA3D75C1651B44F008713D0 /* RemoteLayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA3D75A1651B44F008713D0 /* RemoteLayerTreeHost.h */; };
1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; };
@@ -2031,6 +2033,8 @@
1AA20D5018AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationDelegatePrivate.h; sourceTree = "<group>"; };
1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGUtilities.h; sourceTree = "<group>"; };
1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CGUtilities.cpp; sourceTree = "<group>"; };
+ 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessBundleParameters.mm; sourceTree = "<group>"; };
+ 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessBundleParameters.h; sourceTree = "<group>"; };
1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeHost.mm; sourceTree = "<group>"; };
1AA3D75A1651B44F008713D0 /* RemoteLayerTreeHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeHost.h; sourceTree = "<group>"; };
1AA417C912C00CCA002BE67B /* TextChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextChecker.h; sourceTree = "<group>"; };
@@ -4259,6 +4263,8 @@
1F0181681858DC1500F92884 /* Cocoa */ = {
isa = PBXGroup;
children = (
+ 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */,
+ 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */,
3795789B18AD4F1100B9ED2E /* WKWebProcessPlugInFormDelegatePrivate.h */,
1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */,
1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */,
@@ -6689,6 +6695,7 @@
1A8EF96F1252AF6B00F7067F /* PluginControllerProxyMessages.h in Headers */,
1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */,
1A9E329B1822E1CC00F5D04C /* WKRemoteObject.h in Headers */,
+ 1AA2E56718D77508003814BD /* WKWebProcessBundleParameters.h in Headers */,
7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */,
1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */,
1A3D610213A7CC2A00F95D4E /* PluginModuleInfo.h in Headers */,
@@ -7923,6 +7930,7 @@
1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */,
BC82837B16B36A4F00A278FE /* ChildProcessEntryPoint.mm in Sources */,
9F54F88F16488E87007DF81A /* ChildProcessMac.mm in Sources */,
+ 1AA2E56618D77508003814BD /* WKWebProcessBundleParameters.mm in Sources */,
1A9EA31E18BBDF4B004F7C95 /* WKWebViewConfigurationToBeRemoved.mm in Sources */,
E1513C66166EABB200149FCB /* ChildProcessProxy.cpp in Sources */,
1A2A4B0E1586A2240090C9E9 /* ColorSpaceData.mm in Sources */,
Copied: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.h (from rev 165754, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h) (0 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.h 2014-03-17 20:38:28 UTC (rev 165755)
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+@interface WKWebProcessBundleParameters : NSObject
+
+- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
+
+@end
Copied: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm (from rev 165754, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h) (0 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm 2014-03-17 20:38:28 UTC (rev 165755)
@@ -0,0 +1,50 @@
+/*
+ * 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 "WKWebProcessBundleParameters.h"
+
+#import <wtf/RetainPtr.h>
+
+@implementation WKWebProcessBundleParameters {
+ RetainPtr<NSMutableDictionary> _parameters;
+}
+
+- (instancetype)initWithDictionary:(NSDictionary *)dictionary
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _parameters = adoptNS([[NSMutableDictionary alloc] initWithDictionary:dictionary]);
+
+ return self;
+}
+
+- (NSString *)valueForKey:(NSString *)key
+{
+ return [_parameters valueForKey:key];
+}
+
+@end
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h (165754 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h 2014-03-17 20:38:28 UTC (rev 165755)
@@ -44,8 +44,10 @@
WK_API_CLASS
@interface WKWebProcessPlugInController : NSObject
-@property(readonly) WKConnection *connection;
+@property (readonly) WKConnection *connection;
+@property (readonly) id parameters;
+
@end
#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm (165754 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm 2014-03-17 20:38:28 UTC (rev 165755)
@@ -96,6 +96,11 @@
return wrapper(*_bundle->webConnectionToUIProcess());
}
+- (id)parameters
+{
+ return _bundle->bundleParameters();
+}
+
#pragma mark WKObject protocol implementation
- (API::Object&)_apiObject
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (165754 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2014-03-17 20:38:28 UTC (rev 165755)
@@ -46,6 +46,7 @@
#include "WebPage.h"
#include "WebPreferencesStore.h"
#include "WebProcess.h"
+#include "WebProcessCreationParameters.h"
#include <_javascript_Core/APICast.h>
#include <_javascript_Core/JSLock.h>
#include <WebCore/ApplicationCache.h>
@@ -84,11 +85,11 @@
namespace WebKit {
-InjectedBundle::InjectedBundle(const String& path)
- : m_path(path)
+InjectedBundle::InjectedBundle(const WebProcessCreationParameters& parameters)
+ : m_path(parameters.injectedBundlePath)
, m_platformBundle(0)
{
- initializeClient(0);
+ platformInitialize(parameters);
}
InjectedBundle::~InjectedBundle()
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (165754 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h 2014-03-17 20:38:28 UTC (rev 165755)
@@ -33,6 +33,7 @@
#include <WebCore/UserContentTypes.h>
#include <WebCore/UserScriptTypes.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(GTK)
@@ -45,6 +46,8 @@
#if USE(FOUNDATION)
OBJC_CLASS NSBundle;
+OBJC_CLASS NSMutableDictionary;
+OBJC_CLASS WKWebProcessBundleParameters;
#endif
namespace API {
@@ -73,12 +76,13 @@
class WebFrame;
class WebPage;
class WebPageGroupProxy;
+struct WebProcessCreationParameters;
class InjectedBundle : public API::ObjectImpl<API::Object::Type::Bundle> {
public:
- static PassRefPtr<InjectedBundle> create(const String& path)
+ static PassRefPtr<InjectedBundle> create(const WebProcessCreationParameters& parameters)
{
- return adoptRef(new InjectedBundle(path));
+ return adoptRef(new InjectedBundle(parameters));
}
~InjectedBundle();
@@ -168,15 +172,25 @@
void setCSSCompositingEnabled(bool);
void dispatchPendingLoadRequests();
+#if PLATFORM(COCOA)
+ WKWebProcessBundleParameters *bundleParameters();
+#endif
+
private:
- explicit InjectedBundle(const String&);
+ explicit InjectedBundle(const WebProcessCreationParameters&);
+ void platformInitialize(const WebProcessCreationParameters&);
+
String m_path;
PlatformBundle m_platformBundle; // This is leaked right now, since we never unload the bundle/module.
RefPtr<SandboxExtension> m_sandboxExtension;
InjectedBundleClient m_client;
+
+#if PLATFORM(COCOA)
+ RetainPtr<WKWebProcessBundleParameters> m_bundleParameters;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm (165754 => 165755)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm 2014-03-17 20:38:28 UTC (rev 165755)
@@ -26,10 +26,13 @@
#import "config.h"
#import "InjectedBundle.h"
+#import "APIData.h"
#import "ObjCObjectGraph.h"
#import "WKBundleAPICast.h"
#import "WKBundleInitialize.h"
+#import "WKWebProcessBundleParameters.h"
#import "WKWebProcessPlugInInternal.h"
+#import "WebProcessCreationParameters.h"
#import <Foundation/NSBundle.h>
#import <stdio.h>
#import <wtf/RetainPtr.h>
@@ -42,6 +45,12 @@
- (CFBundleRef)_cfBundle;
@end
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1080
+@interface NSKeyedUnarchiver (WKDetails)
+- (void)setRequiresSecureCoding:(BOOL)b;
+@end
+#endif
+
namespace WebKit {
bool InjectedBundle::load(API::Object* initializationUserData)
@@ -124,4 +133,32 @@
{
}
+
+WKWebProcessBundleParameters *InjectedBundle::bundleParameters()
+{
+ ASSERT(m_bundleParameters);
+
+ return m_bundleParameters.get();
+}
+
+void InjectedBundle::platformInitialize(const WebProcessCreationParameters& parameters)
+{
+ if (!parameters.bundleParameterData)
+ return;
+
+ auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]);
+
+ auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParameterData.get()]);
+ [unarchiver setRequiresSecureCoding:YES];
+
+ NSDictionary *dictionary = nil;
+ @try {
+ dictionary = [unarchiver.get() decodeObjectOfClass:[NSDictionary class] forKey:@"parameters"];
+ } @catch (NSException *exception) {
+ LOG_ERROR("Failed to decode bundle parameters: %@", exception);
+ }
+
+ m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (165754 => 165755)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2014-03-17 20:34:52 UTC (rev 165754)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2014-03-17 20:38:28 UTC (rev 165755)
@@ -279,7 +279,7 @@
return;
if (!parameters.injectedBundlePath.isEmpty()) {
- m_injectedBundle = InjectedBundle::create(parameters.injectedBundlePath);
+ m_injectedBundle = InjectedBundle::create(parameters);
m_injectedBundle->setSandboxExtension(SandboxExtension::create(parameters.injectedBundlePathExtensionHandle));
if (!m_injectedBundle->load(injectedBundleInitializationUserData.get())) {