Title: [128338] trunk
Revision
128338
Author
commit-qu...@webkit.org
Date
2012-09-12 10:42:23 -0700 (Wed, 12 Sep 2012)

Log Message

[WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
https://bugs.webkit.org/show_bug.cgi?id=96496

Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-09-12
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add Bundle C API to retrieve security origins with
an application cache. This is needed by WebKitTestRunner
to support originsWithApplicationCache.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleCopyOriginsWithApplicationCache):
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::originsWithApplicationCache):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundle.h:
(InjectedBundle):

Tools:

Add implementation for originsWithApplicationCache to
WebKitTestRunner.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::stringArrayToJS):
(WTR):
(WTR::TestRunner::originsWithApplicationCache):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):

LayoutTests:

Unskip http/tests/appcache/origins-with-appcache.html now that
WebKitTestRunner implements originsWithApplicationCache.

* platform/wk2/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128337 => 128338)


--- trunk/LayoutTests/ChangeLog	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/LayoutTests/ChangeLog	2012-09-12 17:42:23 UTC (rev 128338)
@@ -1,3 +1,15 @@
+2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
+        https://bugs.webkit.org/show_bug.cgi?id=96496
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Unskip http/tests/appcache/origins-with-appcache.html now that
+        WebKitTestRunner implements originsWithApplicationCache.
+
+        * platform/wk2/Skipped:
+
 2012-09-12  Bear Travis  <betra...@adobe.com>
 
         [CSS Exclusions] Test incremental layout

Modified: trunk/LayoutTests/platform/wk2/Skipped (128337 => 128338)


--- trunk/LayoutTests/platform/wk2/Skipped	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/LayoutTests/platform/wk2/Skipped	2012-09-12 17:42:23 UTC (rev 128338)
@@ -202,9 +202,6 @@
 fast/images/animated-gif-restored-from-bfcache.html
 fast/text/zero-font-size.html
 
-# WTR needs an implementation of originsWithApplicationCache
-http/tests/appcache/origins-with-appcache.html
-
 # WebKitTestRunner needs to support layoutTestController.dumpDOMAsWebArchive
 # <https://bugs.webkit.org/show_bug.cgi?id=42324>
 http/tests/webarchive/cross-origin-stylesheet-crash.html

Modified: trunk/Source/WebKit2/ChangeLog (128337 => 128338)


--- trunk/Source/WebKit2/ChangeLog	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-12 17:42:23 UTC (rev 128338)
@@ -1,5 +1,25 @@
 2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
 
+        [WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
+        https://bugs.webkit.org/show_bug.cgi?id=96496
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add Bundle C API to retrieve security origins with
+        an application cache. This is needed by WebKitTestRunner
+        to support originsWithApplicationCache.
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleCopyOriginsWithApplicationCache):
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::originsWithApplicationCache):
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        (InjectedBundle):
+
+2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
+
         [WK2][WKTR] TestRunner needs to implement dumpApplicationCacheDelegateCallbacks
         https://bugs.webkit.org/show_bug.cgi?id=96374
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (128337 => 128338)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-09-12 17:42:23 UTC (rev 128338)
@@ -25,11 +25,12 @@
 
 #include "config.h"
 #include "WKBundle.h"
-#include "WKBundlePrivate.h"
 
+#include "ImmutableArray.h"
 #include "InjectedBundle.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
+#include "WKBundlePrivate.h"
 
 using namespace WebKit;
 
@@ -256,6 +257,12 @@
     toImpl(bundleRef)->resetApplicationCacheOriginQuota(toImpl(origin)->string());
 }
 
+WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundleRef)
+{
+    RefPtr<ImmutableArray> origins = toImpl(bundleRef)->originsWithApplicationCache();
+    return toAPI(origins.release().leakRef());
+}
+
 void WKBundleSetMinimumTimerInterval(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, double seconds)
 {
     toImpl(bundleRef)->setMinimumTimerInterval(toImpl(pageGroupRef), seconds);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (128337 => 128338)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-09-12 17:42:23 UTC (rev 128338)
@@ -100,6 +100,7 @@
 WK_EXPORT uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundle, WKStringRef origin);
 WK_EXPORT void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin, uint64_t bytes);
 WK_EXPORT void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin);
+WK_EXPORT WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundle);
 
 // Garbage collection API
 WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (128337 => 128338)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-09-12 17:42:23 UTC (rev 128338)
@@ -365,6 +365,20 @@
     cacheStorage().storeUpdatedQuotaForOrigin(origin.get(), cacheStorage().defaultOriginQuota());
 }
 
+PassRefPtr<ImmutableArray> InjectedBundle::originsWithApplicationCache()
+{
+    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins;
+    cacheStorage().getOriginsWithCache(origins);
+    Vector< RefPtr<APIObject> > originsVector;
+
+    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator it = origins.begin();
+    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end();
+    for ( ; it != end; ++it)
+        originsVector.append(WebString::create((*it)->databaseIdentifier()));
+
+    return ImmutableArray::adopt(originsVector);
+}
+
 int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, double pageHeightInPixels)
 {
     Frame* coreFrame = frame ? frame->coreFrame() : 0;

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (128337 => 128338)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-09-12 17:42:23 UTC (rev 128338)
@@ -151,6 +151,7 @@
     uint64_t appCacheUsageForOrigin(const String& origin);
     void setApplicationCacheOriginQuota(const String& origin, uint64_t);
     void resetApplicationCacheOriginQuota(const String& origin);
+    PassRefPtr<ImmutableArray> originsWithApplicationCache();
 
     // Garbage collection API
     void garbageCollectJavaScriptObjects();

Modified: trunk/Tools/ChangeLog (128337 => 128338)


--- trunk/Tools/ChangeLog	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Tools/ChangeLog	2012-09-12 17:42:23 UTC (rev 128338)
@@ -1,3 +1,21 @@
+2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
+        https://bugs.webkit.org/show_bug.cgi?id=96496
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add implementation for originsWithApplicationCache to
+        WebKitTestRunner.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::stringArrayToJS):
+        (WTR):
+        (WTR::TestRunner::originsWithApplicationCache):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (TestRunner):
+
 2012-09-12  Simon Hausmann  <simon.hausm...@nokia.com>
 
         Fix Qt/Windows build with Python3

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (128337 => 128338)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2012-09-12 17:42:23 UTC (rev 128338)
@@ -115,6 +115,7 @@
         void clearApplicationCacheForOrigin(in DOMString name);
         void setApplicationCacheOriginQuota(in unsigned long long bytes);
         void disallowIncreaseForApplicationCacheQuota();
+        object originsWithApplicationCache();
 
         // Compositing testing.
         DOMString layerTreeAsText();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (128337 => 128338)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-12 17:42:23 UTC (rev 128338)
@@ -330,6 +330,30 @@
     m_disallowIncreaseForApplicationCacheQuota = true;
 }
 
+static inline JSValueRef stringArrayToJS(JSContextRef context, WKArrayRef strings)
+{
+    const size_t count = WKArrayGetSize(strings);
+
+    JSValueRef jsStringsArray[count];
+    for (size_t i = 0; i < count; ++i) {
+        WKStringRef stringRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(strings, i));
+        JSRetainPtr<JSStringRef> stringJS = toJS(stringRef);
+        jsStringsArray[i] = JSValueMakeString(context, stringJS.get());
+    }
+
+    return JSObjectMakeArray(context, count, jsStringsArray, 0);
+}
+
+JSValueRef TestRunner::originsWithApplicationCache()
+{
+    WKRetainPtr<WKArrayRef> origins(AdoptWK, WKBundleCopyOriginsWithApplicationCache(InjectedBundle::shared().bundle()));
+
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+
+    return stringArrayToJS(context, origins.get());
+}
+
 bool TestRunner::isCommandEnabled(JSStringRef name)
 {
     return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get());

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (128337 => 128338)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-09-12 17:39:09 UTC (rev 128337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-09-12 17:42:23 UTC (rev 128338)
@@ -152,6 +152,7 @@
     void setApplicationCacheOriginQuota(unsigned long long);
     void disallowIncreaseForApplicationCacheQuota();
     bool shouldDisallowIncreaseForApplicationCacheQuota() { return m_disallowIncreaseForApplicationCacheQuota; }
+    JSValueRef originsWithApplicationCache();
 
     // Printing
     bool isPageBoxVisible(int pageIndex);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to