Add alternate menu items for performing operations on the default data store
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2015 21:37:49 +0000 (21:37 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2015 21:37:49 +0000 (21:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145184

Reviewed by Sam Weinig.

This makes it possible to test WKWebsiteDataStore code paths when there are no live web views
associated with a data store.

* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate fetchDefaultStoreWebsiteData:]):
(-[BrowserAppDelegate fetchAndClearDefaultStoreWebsiteData:]):
(-[BrowserAppDelegate clearDefaultStoreWebsiteData:]):
* MiniBrowser/mac/MainMenu.xib:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184590 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/mac/AppDelegate.m
Tools/MiniBrowser/mac/MainMenu.xib

index 4d7aefd..b9d8dd4 100644 (file)
@@ -1,3 +1,19 @@
+2015-05-19  Anders Carlsson  <andersca@apple.com>
+
+        Add alternate menu items for performing operations on the default data store
+        https://bugs.webkit.org/show_bug.cgi?id=145184
+
+        Reviewed by Sam Weinig.
+
+        This makes it possible to test WKWebsiteDataStore code paths when there are no live web views
+        associated with a data store.
+
+        * MiniBrowser/mac/AppDelegate.m:
+        (-[BrowserAppDelegate fetchDefaultStoreWebsiteData:]):
+        (-[BrowserAppDelegate fetchAndClearDefaultStoreWebsiteData:]):
+        (-[BrowserAppDelegate clearDefaultStoreWebsiteData:]):
+        * MiniBrowser/mac/MainMenu.xib:
+
 2015-05-19  Csaba Osztrogonác  <ossy@webkit.org>
 
         Fix tautological-compare warning in AtomicString.cpp
index 139d5aa..7dde6e1 100644 (file)
@@ -228,6 +228,32 @@ static WKWebViewConfiguration *defaultConfiguration()
 {
     return defaultConfiguration().userContentController;
 }
+
+- (IBAction)fetchDefaultStoreWebsiteData:(id)sender
+{
+    [[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) {
+        NSLog(@"did fetch default store website data %@.", websiteDataRecords);
+    }];
+}
+
+- (IBAction)fetchAndClearDefaultStoreWebsiteData:(id)sender
+{
+    [[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) {
+        [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] forDataRecords:websiteDataRecords completionHandler:^{
+            [[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) {
+                NSLog(@"did clear default store website data, after clearing data is %@.", websiteDataRecords);
+            }];
+        }];
+    }];
+}
+
+- (IBAction)clearDefaultStoreWebsiteData:(id)sender
+{
+    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^{
+        NSLog(@"Did clear default store website data.");
+    }];
+}
+
 #endif
 
 @end
index c329c85..728e622 100644 (file)
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8040.1" systemVersion="14D106" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8096.6" systemVersion="15A178f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8040.1"/>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8096.6"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <menu title="AMainMenu" systemMenu="main" id="29">
+        <menu title="AMainMenu" systemMenu="main" userInterfaceLayoutDirection="leftToRight" id="29">
             <items>
                 <menuItem title="MiniBrowser" id="56">
-                    <menu key="submenu" title="MiniBrowser" systemMenu="apple" id="57">
+                    <menu key="submenu" title="MiniBrowser" systemMenu="apple" userInterfaceLayoutDirection="leftToRight" id="57">
                         <items>
                             <menuItem title="About MiniBrowser" id="58">
                                 <modifierMask key="keyEquivalentModifierMask"/>
@@ -30,7 +31,7 @@
                                 <modifierMask key="keyEquivalentModifierMask" command="YES"/>
                             </menuItem>
                             <menuItem title="Services" id="131">
-                                <menu key="submenu" title="Services" systemMenu="services" id="130"/>
+                                <menu key="submenu" title="Services" systemMenu="services" userInterfaceLayoutDirection="leftToRight" id="130"/>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" id="144">
                                 <modifierMask key="keyEquivalentModifierMask" command="YES"/>
@@ -63,7 +64,7 @@
                     </menu>
                 </menuItem>
                 <menuItem title="File" id="83">
-                    <menu key="submenu" title="File" id="81">
+                    <menu key="submenu" title="File" userInterfaceLayoutDirection="leftToRight" id="81">
                         <items>
                             <menuItem title="Open Location " tag="1" keyEquivalent="l" id="82">
                                 <connections>
@@ -93,7 +94,7 @@
                                 </connections>
                             </menuItem>
                             <menuItem title="Open Recent" id="124">
-                                <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="125">
+                                <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" userInterfaceLayoutDirection="leftToRight" id="125">
                                     <items>
                                         <menuItem title="Clear Menu" id="126">
                                             <connections>
                     </menu>
                 </menuItem>
                 <menuItem title="Edit" id="217">
-                    <menu key="submenu" title="Edit" id="205">
+                    <menu key="submenu" title="Edit" userInterfaceLayoutDirection="leftToRight" id="205">
                         <items>
                             <menuItem title="Undo" keyEquivalent="z" id="207">
                                 <connections>
                                 <modifierMask key="keyEquivalentModifierMask" command="YES"/>
                             </menuItem>
                             <menuItem title="Find" id="218">
-                                <menu key="submenu" title="Find" id="220">
+                                <menu key="submenu" title="Find" userInterfaceLayoutDirection="leftToRight" id="220">
                                     <items>
                                         <menuItem title="Find…" tag="1" keyEquivalent="f" id="209">
                                             <connections>
                                 </menu>
                             </menuItem>
                             <menuItem title="Spelling and Grammar" id="216">
-                                <menu key="submenu" title="Spelling and Grammar" id="200">
+                                <menu key="submenu" title="Spelling and Grammar" userInterfaceLayoutDirection="leftToRight" id="200">
                                     <items>
                                         <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="204">
                                             <connections>
                                 </menu>
                             </menuItem>
                             <menuItem title="Substitutions" id="348">
-                                <menu key="submenu" title="Substitutions" id="349">
+                                <menu key="submenu" title="Substitutions" userInterfaceLayoutDirection="leftToRight" id="349">
                                     <items>
                                         <menuItem title="Show Substitutions" id="457">
                                             <modifierMask key="keyEquivalentModifierMask"/>
                             </menuItem>
                             <menuItem title="Transformations" id="450">
                                 <modifierMask key="keyEquivalentModifierMask"/>
-                                <menu key="submenu" title="Transformations" id="451">
+                                <menu key="submenu" title="Transformations" userInterfaceLayoutDirection="leftToRight" id="451">
                                     <items>
                                         <menuItem title="Make Upper Case" id="452">
                                             <modifierMask key="keyEquivalentModifierMask"/>
                                 </menu>
                             </menuItem>
                             <menuItem title="Speech" id="211">
-                                <menu key="submenu" title="Speech" id="212">
+                                <menu key="submenu" title="Speech" userInterfaceLayoutDirection="leftToRight" id="212">
                                     <items>
                                         <menuItem title="Start Speaking" id="196">
                                             <connections>
                     </menu>
                 </menuItem>
                 <menuItem title="View" id="295">
-                    <menu key="submenu" title="View" id="296">
+                    <menu key="submenu" title="View" userInterfaceLayoutDirection="leftToRight" id="296">
                         <items>
                             <menuItem title="Show Toolbar" keyEquivalent="t" id="297">
                                 <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                             </menuItem>
                             <menuItem title="View Scale" id="8UY-Pj-H13">
                                 <modifierMask key="keyEquivalentModifierMask"/>
-                                <menu key="submenu" title="View Scale" id="Ml8-mk-ffu">
+                                <menu key="submenu" title="View Scale" userInterfaceLayoutDirection="leftToRight" id="Ml8-mk-ffu">
                                     <items>
                                         <menuItem title="100%" state="on" tag="1" keyEquivalent="1" id="EAm-Xn-VrC">
                                             <connections>
                     </menu>
                 </menuItem>
                 <menuItem title="Window" id="19">
-                    <menu key="submenu" title="Window" systemMenu="window" id="24">
+                    <menu key="submenu" title="Window" systemMenu="window" userInterfaceLayoutDirection="leftToRight" id="24">
                         <items>
                             <menuItem title="Minimize" keyEquivalent="m" id="23">
                                 <connections>
                 </menuItem>
                 <menuItem title="Help" id="490">
                     <modifierMask key="keyEquivalentModifierMask"/>
-                    <menu key="submenu" title="Help" systemMenu="help" id="491">
+                    <menu key="submenu" title="Help" systemMenu="help" userInterfaceLayoutDirection="leftToRight" id="491">
                         <items>
                             <menuItem title="MiniBrowser Help" keyEquivalent="?" id="492">
                                 <connections>
                 </menuItem>
                 <menuItem title="Debug" id="534">
                     <modifierMask key="keyEquivalentModifierMask"/>
-                    <menu key="submenu" title="Debug" id="535">
+                    <menu key="submenu" title="Debug" userInterfaceLayoutDirection="leftToRight" id="535">
                         <items>
                             <menuItem title="Force Repaint" keyEquivalent="r" id="545">
                                 <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                     <action selector="fetchWebsiteData:" target="-1" id="pVk-bR-Z4t"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Fetch Default Store Website Data" alternate="YES" id="hGe-aG-Hya">
+                                <modifierMask key="keyEquivalentModifierMask" option="YES"/>
+                                <connections>
+                                    <action selector="fetchDefaultStoreWebsiteData:" target="-1" id="4Dx-M1-kNg"/>
+                                </connections>
+                            </menuItem>
                             <menuItem title="Clear Website Data" id="bfj-13-wQ4">
                                 <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
                                     <action selector="clearWebsiteData:" target="-1" id="pEC-gb-vGm"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Clear Default Store Website Data" alternate="YES" id="YZt-aI-HG8">
+                                <modifierMask key="keyEquivalentModifierMask" option="YES"/>
+                                <connections>
+                                    <action selector="clearDefaultStoreWebsiteData:" target="-1" id="HDz-DK-I9T"/>
+                                </connections>
+                            </menuItem>
                             <menuItem title="Fetch And Clear Website Data" id="VDP-iU-836">
                                 <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
                                     <action selector="fetchAndClearWebsiteData:" target="-1" id="R06-l2-tP0"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Fetch And Clear Default Store Website Data" alternate="YES" id="VDT-W7-H7E">
+                                <modifierMask key="keyEquivalentModifierMask" option="YES"/>
+                                <connections>
+                                    <action selector="fetchAndClearDefaultStoreWebsiteData:" target="-1" id="B75-Hd-TIT"/>
+                                </connections>
+                            </menuItem>
                             <menuItem isSeparatorItem="YES" id="uef-kb-r9n"/>
                             <menuItem title="Show Extensions Manager" keyEquivalent="m" id="2f0-pH-KRx">
                                 <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>