Diff
Modified: trunk/Source/WebKit2/ChangeLog (180518 => 180519)
--- trunk/Source/WebKit2/ChangeLog 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/ChangeLog 2015-02-23 22:29:37 UTC (rev 180519)
@@ -1,3 +1,34 @@
+2015-02-23 Anders Carlsson <[email protected]>
+
+ Add API for fetching website data records to _WKWebsiteDataStore
+ https://bugs.webkit.org/show_bug.cgi?id=141926
+
+ Reviewed by Beth Dakin.
+
+ * UIProcess/API/APIWebsiteDataRecord.cpp:
+ (API::WebsiteDataRecord::create):
+ (API::WebsiteDataRecord::WebsiteDataRecord):
+ * UIProcess/API/APIWebsiteDataRecord.h:
+ Update to take a WebsiteDataRecord parameter.
+
+ * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
+ * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
+ (-[_WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
+ Call down to the WebsiteDataStore.
+
+ * UIProcess/WebsiteData/WebsiteDataRecord.h: Added.
+ This will be the data-container part of WebsiteDataRecord, but it's currently empty.
+
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::fetchData):
+ Just dispatch the completion handler for now.
+
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+ Add new member.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add new files.
+
2015-02-23 Chris Dumez <[email protected]>
Add support for diagnostic logging messages sampling
Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.cpp (180518 => 180519)
--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.cpp 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.cpp 2015-02-23 22:29:37 UTC (rev 180519)
@@ -28,12 +28,13 @@
namespace API {
-Ref<WebsiteDataRecord> WebsiteDataRecord::create()
+Ref<WebsiteDataRecord> WebsiteDataRecord::create(WebKit::WebsiteDataRecord&& websiteDataRecord)
{
- return adoptRef(*new WebsiteDataRecord);
+ return adoptRef(*new WebsiteDataRecord(WTF::move(websiteDataRecord)));
}
-WebsiteDataRecord::WebsiteDataRecord()
+WebsiteDataRecord::WebsiteDataRecord(WebKit::WebsiteDataRecord&& websiteDataRecord)
+ : m_websiteDataRecord(WTF::move(websiteDataRecord))
{
}
Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h (180518 => 180519)
--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h 2015-02-23 22:29:37 UTC (rev 180519)
@@ -27,17 +27,19 @@
#define APIWebsiteDataRecord_h
#include "APIObject.h"
+#include "WebsiteDataRecord.h"
namespace API {
class WebsiteDataRecord final : public ObjectImpl<Object::Type::WebsiteDataRecord> {
public:
- static Ref<WebsiteDataRecord> create();
+ static Ref<WebsiteDataRecord> create(WebKit::WebsiteDataRecord&&);
virtual ~WebsiteDataRecord();
private:
- WebsiteDataRecord();
+ explicit WebsiteDataRecord(WebKit::WebsiteDataRecord&&);
+ const WebKit::WebsiteDataRecord m_websiteDataRecord;
};
}
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h (180518 => 180519)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h 2015-02-23 22:29:37 UTC (rev 180519)
@@ -40,6 +40,7 @@
@property (readonly, getter=isNonPersistent) BOOL nonPersistent;
+- (void)fetchDataRecordsOfTypes:(WKWebsiteDataTypes)websiteDataTypes completionHandler:(void (^)(NSArray *))completionHandler;
- (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes modifiedSince:(NSDate *)date completionHandler:(void (^)())completionHandler WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
@end
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm (180518 => 180519)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm 2015-02-23 22:29:37 UTC (rev 180519)
@@ -28,6 +28,10 @@
#if WK_API_ENABLED
+#import "APIArray.h"
+#import "APIWebsiteDataRecord.h"
+#import "WKNSArray.h"
+
@implementation _WKWebsiteDataStore
+ (instancetype)defaultDataStore
@@ -78,6 +82,23 @@
return system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date.timeIntervalSince1970)));
}
+- (void)fetchDataRecordsOfTypes:(WKWebsiteDataTypes)websiteDataTypes completionHandler:(void (^)(NSArray *))completionHandler
+{
+ auto completionHandlerCopy = Block_copy(completionHandler);
+
+ _websiteDataStore->websiteDataStore().fetchData(toWebsiteDataTypes(websiteDataTypes), [completionHandlerCopy](Vector<WebKit::WebsiteDataRecord> websiteDataRecords) {
+ Vector<RefPtr<API::Object>> elements;
+ elements.reserveInitialCapacity(websiteDataRecords.size());
+
+ for (auto& websiteDataRecord : websiteDataRecords)
+ elements.uncheckedAppend(API::WebsiteDataRecord::create(WTF::move(websiteDataRecord)));
+
+ completionHandlerCopy(wrapper(*API::Array::create(WTF::move(elements))));
+
+ Block_release(completionHandlerCopy);
+ });
+}
+
- (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes modifiedSince:(NSDate *)date completionHandler:(void (^)())completionHandler
{
auto completionHandlerCopy = Block_copy(completionHandler);
Copied: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h (from rev 180518, trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.cpp) (0 => 180519)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h 2015-02-23 22:29:37 UTC (rev 180519)
@@ -0,0 +1,37 @@
+/*
+ * 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 WebsiteDataRecord_h
+#define WebsiteDataRecord_h
+
+namespace WebKit {
+
+struct WebsiteDataRecord {
+ // FIXME: Fill this in.
+};
+
+}
+
+#endif // WebsiteDataRecord_h
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (180518 => 180519)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2015-02-23 22:29:37 UTC (rev 180519)
@@ -26,6 +26,7 @@
#include "config.h"
#include "WebsiteDataStore.h"
+#include "APIWebsiteDataRecord.h"
#include "StorageManager.h"
#include "WebProcessPool.h"
#include <wtf/RunLoop.h>
@@ -127,6 +128,14 @@
return processAccessType;
}
+void WebsiteDataStore::fetchData(WebsiteDataTypes, std::function<void (Vector<WebsiteDataRecord>)> completionHandler)
+{
+ // FIXME: Actually fetch data.
+ RunLoop::main().dispatch([completionHandler] {
+ completionHandler({ });
+ });
+}
+
void WebsiteDataStore::removeData(WebsiteDataTypes dataTypes, std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler)
{
struct CallbackAggregator : public RefCounted<CallbackAggregator> {
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (180518 => 180519)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2015-02-23 22:29:37 UTC (rev 180519)
@@ -39,6 +39,7 @@
class StorageManager;
class WebPageProxy;
+struct WebsiteDataRecord;
class WebsiteDataStore : public RefCounted<WebsiteDataStore>, public WebProcessLifetimeObserver {
public:
@@ -56,6 +57,7 @@
static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
+ void fetchData(WebsiteDataTypes, std::function<void (Vector<WebsiteDataRecord>)> completionHandler);
void removeData(WebsiteDataTypes, std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler);
StorageManager* storageManager() { return m_storageManager.get(); }
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (180518 => 180519)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-02-23 22:29:37 UTC (rev 180519)
@@ -253,6 +253,7 @@
1A4832CB1A9BC465008B4DFE /* _WKWebsiteDataRecord.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4832C91A9BC465008B4DFE /* _WKWebsiteDataRecord.mm */; };
1A4832CC1A9BC465008B4DFE /* _WKWebsiteDataRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4832CA1A9BC465008B4DFE /* _WKWebsiteDataRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
1A4832CE1A9BC484008B4DFE /* _WKWebsiteDataRecordInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4832CD1A9BC484008B4DFE /* _WKWebsiteDataRecordInternal.h */; };
+ 1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */; };
1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; };
1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */; };
1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */; };
@@ -2330,6 +2331,7 @@
1A4832C91A9BC465008B4DFE /* _WKWebsiteDataRecord.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebsiteDataRecord.mm; sourceTree = "<group>"; };
1A4832CA1A9BC465008B4DFE /* _WKWebsiteDataRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataRecord.h; sourceTree = "<group>"; };
1A4832CD1A9BC484008B4DFE /* _WKWebsiteDataRecordInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataRecordInternal.h; sourceTree = "<group>"; };
+ 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataRecord.h; sourceTree = "<group>"; };
1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModule.cpp; sourceTree = "<group>"; };
1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginModule.h; sourceTree = "<group>"; };
1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginModuleMac.mm; sourceTree = "<group>"; };
@@ -4475,6 +4477,7 @@
isa = PBXGroup;
children = (
1A4832C01A965A33008B4DFE /* Cocoa */,
+ 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */,
1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */,
1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */,
);
@@ -7926,6 +7929,7 @@
1C8E2A361277852400BC7BD0 /* WebInspectorMessages.h in Headers */,
1C8E28341275D73800BC7BD0 /* WebInspectorProxy.h in Headers */,
1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
+ 1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
1C891D6619B124FF00BA79DD /* WebInspectorUI.h in Headers */,
1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */,
2DA944A01884E4F000ED86DB /* WebIOSEventFactory.h in Headers */,
Modified: trunk/Tools/ChangeLog (180518 => 180519)
--- trunk/Tools/ChangeLog 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Tools/ChangeLog 2015-02-23 22:29:37 UTC (rev 180519)
@@ -1,3 +1,15 @@
+2015-02-23 Anders Carlsson <[email protected]>
+
+ Add API for fetching website data records to _WKWebsiteDataStore
+ https://bugs.webkit.org/show_bug.cgi?id=141926
+
+ Reviewed by Beth Dakin.
+
+ * MiniBrowser/mac/MainMenu.xib:
+ * MiniBrowser/mac/WK2BrowserWindowController.m:
+ (-[WK2BrowserWindowController fetchWebsiteData:]):
+ Add menu item to fetch and dump website data.
+
2015-02-23 David Kilzer <[email protected]>
[iOS] run-webkit-tests --leaks is broken because IOSSimulatorPort has no is_snowleopard attribute
Modified: trunk/Tools/MiniBrowser/mac/MainMenu.xib (180518 => 180519)
--- trunk/Tools/MiniBrowser/mac/MainMenu.xib 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Tools/MiniBrowser/mac/MainMenu.xib 2015-02-23 22:29:37 UTC (rev 180519)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7096" systemVersion="14D42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7504.2" systemVersion="14D89" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7096"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7504.2"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -457,6 +457,12 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="77P-rp-OVT"/>
+ <menuItem title="Fetch Website Data" id="bFf-Dl-CTv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="fetchWebsiteData:" target="-1" id="pVk-bR-Z4t"/>
+ </connections>
+ </menuItem>
<menuItem title="Clear Website Data" id="bfj-13-wQ4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (180518 => 180519)
--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m 2015-02-23 22:10:51 UTC (rev 180518)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m 2015-02-23 22:29:37 UTC (rev 180519)
@@ -407,6 +407,13 @@
{
}
+- (IBAction)fetchWebsiteData:(id)sender
+{
+ [_configuration._websiteDataStore fetchDataRecordsOfTypes:WKWebsiteDataTypeAll completionHandler:^(NSArray *websiteDataRecords) {
+ NSLog(@"did fetch website data %@.", websiteDataRecords);
+ }];
+}
+
- (IBAction)clearWebsiteData:(id)sender
{
[_configuration._websiteDataStore removeDataOfTypes:WKWebsiteDataTypeAll modifiedSince:[NSDate distantPast] completionHandler:^{