summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/InjectedBundle
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle')
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp10
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h4
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm9
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm11
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm8
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h4
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm8
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp20
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h8
15 files changed, 85 insertions, 7 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 7210a9d9e..95273a704 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -329,6 +329,11 @@ void WKBundleSetSerialLoadingEnabled(WKBundleRef bundleRef, bool enabled)
toImpl(bundleRef)->setSerialLoadingEnabled(enabled);
}
+void WKBundleSetShadowDOMEnabled(WKBundleRef bundleRef, bool enabled)
+{
+ toImpl(bundleRef)->setShadowDOMEnabled(enabled);
+}
+
void WKBundleDispatchPendingLoadRequests(WKBundleRef bundleRef)
{
toImpl(bundleRef)->dispatchPendingLoadRequests();
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index 24188fff2..f00e03539 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -32,6 +32,7 @@
#include "WKBundleAPICast.h"
#include "WKData.h"
#include "WebFrame.h"
+#include "WebSecurityOrigin.h"
#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
@@ -286,3 +287,12 @@ WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFrameRef frame
{
return toAPI(toImpl(frameRef)->hitTest(toIntPoint(point)).leakRef());
}
+
+WKSecurityOriginRef WKBundleFrameCopySecurityOrigin(WKBundleFrameRef frameRef)
+{
+ Frame* coreFrame = toImpl(frameRef)->coreFrame();
+ if (!coreFrame)
+ return 0;
+
+ return toCopiedAPI(coreFrame->document()->securityOrigin());
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index 021aec0ed..8c2b875f5 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -44,6 +44,7 @@ WK_EXPORT WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frame);
WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame);
WK_EXPORT WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frame);
WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame);
+WK_EXPORT WKSecurityOriginRef WKBundleFrameCopySecurityOrigin(WKBundleFrameRef frame);
WK_EXPORT WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frame);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index 369c4302f..15b2e7c85 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -102,6 +102,7 @@ WK_EXPORT size_t WKBundleGetWorkerThreadCount(WKBundleRef bundle);
WK_EXPORT void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundle, WKBundlePageRef page, bool enabled);
WK_EXPORT void WKBundleSetSerialLoadingEnabled(WKBundleRef bundle, bool enabled);
+WK_EXPORT void WKBundleSetShadowDOMEnabled(WKBundleRef bundle, bool enabled);
WK_EXPORT void WKBundleDispatchPendingLoadRequests(WKBundleRef bundle);
#ifdef __cplusplus
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h
index f33e454cd..7407a9137 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h
@@ -111,6 +111,10 @@ WKDOMText *toWKDOMText(WebCore::Text*);
WebCore::Range* toWebCoreRange(WKDOMRange *);
WKDOMRange *toWKDOMRange(WebCore::Range*);
+// -- Helpers --
+
+NSArray *toNSArray(const Vector<WebCore::IntRect>&);
+
} // namespace WebKit
#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm
index ab9046613..70369afb6 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm
@@ -165,6 +165,15 @@ static WKDOMType toWKDOMType(WebCoreType impl, DOMCache<WebCoreType, WKDOMType>&
return [wrapper autorelease];
}
+NSArray *toNSArray(const Vector<WebCore::IntRect>& rects)
+{
+ size_t size = rects.size();
+ NSMutableArray *array = [NSMutableArray arrayWithCapacity:size];
+ for (size_t i = 0; i < size; ++i)
+ [array addObject:[NSValue valueWithRect:rects[i]]];
+ return array;
+}
+
} // namespace WebKit
#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h
index 40a8f9c90..d804d9641 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h
@@ -43,6 +43,7 @@ WK_EXPORT
@property(readonly) WKDOMNode *lastChild;
@property(readonly) WKDOMNode *previousSibling;
@property(readonly) WKDOMNode *nextSibling;
+@property(readonly) NSArray *textRects;
@end
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm
index a3296bfc0..5b86f746d 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm
@@ -30,6 +30,7 @@
#import "WKDOMNode.h"
#import "WKDOMInternals.h"
+#import <WebCore/Document.h>
@implementation WKDOMNode
@@ -102,6 +103,16 @@
return WebKit::toWKDOMNode(_impl->nextSibling());
}
+- (NSArray *)textRects
+{
+ _impl->document()->updateLayoutIgnorePendingStylesheets();
+ if (!_impl->renderer())
+ return nil;
+ Vector<WebCore::IntRect> rects;
+ _impl->textRects(rects);
+ return WebKit::toNSArray(rects);
+}
+
@end
#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h
index 64ed00ce2..43b9a1c43 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h
@@ -47,6 +47,7 @@ WK_EXPORT
@property(readonly) NSInteger endOffset;
@property(readonly, copy) NSString *text;
@property(readonly) BOOL isCollapsed;
+@property(readonly) NSArray *textRects;
@end
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm
index 1cc408408..81f066ca1 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm
@@ -137,6 +137,14 @@
return _impl->collapsed(ec);
}
+- (NSArray *)textRects
+{
+ _impl->ownerDocument()->updateLayoutIgnorePendingStylesheets();
+ Vector<WebCore::IntRect> rects;
+ _impl->textRects(rects);
+ return WebKit::toNSArray(rects);
+}
+
@end
#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h
index 4a7cc50a6..f65e73b35 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h
@@ -28,6 +28,7 @@
#import <Foundation/Foundation.h>
#import <WebKit2/WKBase.h>
+@class WKConnection;
@class WKWebProcessPlugInController;
@class WKWebProcessPlugInBrowserContextController;
@@ -40,6 +41,9 @@
WK_EXPORT
@interface WKWebProcessPlugInController : NSObject
+
+@property(readonly) WKConnection *connection;
+
@end
#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm
index d967ec29b..cbcc8492e 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm
@@ -31,6 +31,7 @@
#import "WKWebProcessPlugInInternal.h"
#import "InjectedBundle.h"
+#import "WKConnectionInternal.h"
#import "WKBundle.h"
#import "WKBundleAPICast.h"
#import "WKRetainPtr.h"
@@ -43,6 +44,7 @@ typedef HashMap<WKBundlePageRef, RetainPtr<WKWebProcessPlugInBrowserContextContr
RetainPtr<id<WKWebProcessPlugIn> > _principalClassInstance;
WKRetainPtr<WKBundleRef> _bundleRef;
BundlePageWrapperCache _bundlePageWrapperCache;
+ RetainPtr<WKConnection *> _connectionWrapper;
}
@end
@@ -111,6 +113,7 @@ static WKWebProcessPlugInController *sharedInstance;
_principalClassInstance = principalClassInstance;
_bundleRef = bundleRef;
+ _connectionWrapper = adoptNS([[WKConnection alloc] _initWithConnectionRef:WKBundleGetApplicationConnection(_bundleRef.get())]);
ASSERT_WITH_MESSAGE(!sharedInstance, "WKWebProcessPlugInController initialized multiple times.");
sharedInstance = self;
@@ -124,6 +127,11 @@ static WKWebProcessPlugInController *sharedInstance;
@implementation WKWebProcessPlugInController
+- (WKConnection *)connection
+{
+ return _connectionWrapper.get();
+}
+
@end
#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index 4d0aa56a3..82c122036 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -70,6 +70,10 @@
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnArrayPtr.h>
+#if ENABLE(SHADOW_DOM)
+#include <WebCore/RuntimeEnabledFeatures.h>
+#endif
+
using namespace WebCore;
using namespace JSC;
@@ -93,7 +97,7 @@ void InjectedBundle::initializeClient(WKBundleClient* client)
void InjectedBundle::postMessage(const String& messageName, APIObject* messageBody)
{
- OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), "", 0);
+ OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), CoreIPC::StringReference("PostMessage"), 0);
encoder->encode(messageName);
encoder->encode(InjectedBundleUserMessageEncoder(messageBody));
@@ -105,7 +109,7 @@ void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject
InjectedBundleUserMessageDecoder messageDecoder(returnData);
uint64_t syncRequestID;
- OwnPtr<CoreIPC::MessageEncoder> encoder = WebProcess::shared().connection()->createSyncMessageEncoder(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), "", 0, syncRequestID);
+ OwnPtr<CoreIPC::MessageEncoder> encoder = WebProcess::shared().connection()->createSyncMessageEncoder(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), CoreIPC::StringReference("PostSynchronousMessage"), 0, syncRequestID);
encoder->encode(messageName);
encoder->encode(InjectedBundleUserMessageEncoder(messageBody));
@@ -279,8 +283,9 @@ void InjectedBundle::setPopupBlockingEnabled(WebPageGroupProxy* pageGroup, bool
void InjectedBundle::switchNetworkLoaderToNewTestingSession()
{
-#if USE(CFURLSTORAGESESSIONS)
+#if PLATFORM(MAC) || USE(CFNETWORK)
// Set a private session for testing to avoid interfering with global cookies. This should be different from private browsing session.
+ // FIXME (NetworkProcess): Do this in network process, too.
RetainPtr<CFURLStorageSessionRef> session = ResourceHandle::createPrivateBrowsingStorageSession(CFSTR("Private WebKit Session"));
ResourceHandle::setDefaultStorageSession(session.get());
#endif
@@ -622,6 +627,15 @@ void InjectedBundle::setSerialLoadingEnabled(bool enabled)
resourceLoadScheduler()->setSerialLoadingEnabled(enabled);
}
+void InjectedBundle::setShadowDOMEnabled(bool enabled)
+{
+#if ENABLE(SHADOW_DOM)
+ RuntimeEnabledFeatures::setShadowDOMEnabled(enabled);
+#else
+ UNUSED_PARAM(enabled);
+#endif
+}
+
void InjectedBundle::dispatchPendingLoadRequests()
{
resourceLoadScheduler()->servePendingRequests();
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
index 754b13320..c621f2483 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
@@ -178,6 +178,7 @@ public:
void setTabKeyCyclesThroughElements(WebPage*, bool enabled);
void setSerialLoadingEnabled(bool);
+ void setShadowDOMEnabled(bool);
void dispatchPendingLoadRequests();
private:
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
index 49d66966a..c3fb18d30 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
@@ -49,7 +49,7 @@ public:
{
}
- void encode(CoreIPC::ArgumentEncoder* encoder) const
+ void encode(CoreIPC::ArgumentEncoder& encoder) const
{
APIObject::Type type = APIObject::TypeNull;
if (baseEncode(encoder, type))
@@ -58,17 +58,17 @@ public:
switch (type) {
case APIObject::TypeBundlePage: {
WebPage* page = static_cast<WebPage*>(m_root);
- encoder->encode(page->pageID());
+ encoder << page->pageID();
break;
}
case APIObject::TypeBundleFrame: {
WebFrame* frame = static_cast<WebFrame*>(m_root);
- encoder->encode(frame->frameID());
+ encoder << frame->frameID();
break;
}
case APIObject::TypeBundlePageGroup: {
WebPageGroupProxy* pageGroup = static_cast<WebPageGroupProxy*>(m_root);
- encoder->encode(pageGroup->pageGroupID());
+ encoder << pageGroup->pageGroupID();
break;
}
default: