Changeset 128338 in webkit


Ignore:
Timestamp:
Sep 12, 2012 10:42:23 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Christophe Dumez <Christophe Dumez> 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:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128336 r128338  
     12012-09-12  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
     4        https://bugs.webkit.org/show_bug.cgi?id=96496
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Unskip http/tests/appcache/origins-with-appcache.html now that
     9        WebKitTestRunner implements originsWithApplicationCache.
     10
     11        * platform/wk2/Skipped:
     12
    1132012-09-12  Bear Travis  <betravis@adobe.com>
    214
  • trunk/LayoutTests/platform/wk2/Skipped

    r128326 r128338  
    203203fast/text/zero-font-size.html
    204204
    205 # WTR needs an implementation of originsWithApplicationCache
    206 http/tests/appcache/origins-with-appcache.html
    207 
    208205# WebKitTestRunner needs to support layoutTestController.dumpDOMAsWebArchive
    209206# <https://bugs.webkit.org/show_bug.cgi?id=42324>
  • trunk/Source/WebKit2/ChangeLog

    r128326 r128338  
     12012-09-12  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
     4        https://bugs.webkit.org/show_bug.cgi?id=96496
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Add Bundle C API to retrieve security origins with
     9        an application cache. This is needed by WebKitTestRunner
     10        to support originsWithApplicationCache.
     11
     12        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
     13        (WKBundleCopyOriginsWithApplicationCache):
     14        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
     15        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     16        (WebKit::InjectedBundle::originsWithApplicationCache):
     17        (WebKit):
     18        * WebProcess/InjectedBundle/InjectedBundle.h:
     19        (InjectedBundle):
     20
    1212012-09-12  Christophe Dumez  <christophe.dumez@intel.com>
    222
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp

    r128326 r128338  
    2626#include "config.h"
    2727#include "WKBundle.h"
    28 #include "WKBundlePrivate.h"
    29 
     28
     29#include "ImmutableArray.h"
    3030#include "InjectedBundle.h"
    3131#include "WKAPICast.h"
    3232#include "WKBundleAPICast.h"
     33#include "WKBundlePrivate.h"
    3334
    3435using namespace WebKit;
     
    257258}
    258259
     260WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundleRef)
     261{
     262    RefPtr<ImmutableArray> origins = toImpl(bundleRef)->originsWithApplicationCache();
     263    return toAPI(origins.release().leakRef());
     264}
     265
    259266void WKBundleSetMinimumTimerInterval(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, double seconds)
    260267{
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h

    r128326 r128338  
    101101WK_EXPORT void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin, uint64_t bytes);
    102102WK_EXPORT void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin);
     103WK_EXPORT WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundle);
    103104
    104105// Garbage collection API
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

    r128326 r128338  
    366366}
    367367
     368PassRefPtr<ImmutableArray> InjectedBundle::originsWithApplicationCache()
     369{
     370    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins;
     371    cacheStorage().getOriginsWithCache(origins);
     372    Vector< RefPtr<APIObject> > originsVector;
     373
     374    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator it = origins.begin();
     375    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end();
     376    for ( ; it != end; ++it)
     377        originsVector.append(WebString::create((*it)->databaseIdentifier()));
     378
     379    return ImmutableArray::adopt(originsVector);
     380}
     381
    368382int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, double pageHeightInPixels)
    369383{
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h

    r128326 r128338  
    152152    void setApplicationCacheOriginQuota(const String& origin, uint64_t);
    153153    void resetApplicationCacheOriginQuota(const String& origin);
     154    PassRefPtr<ImmutableArray> originsWithApplicationCache();
    154155
    155156    // Garbage collection API
  • trunk/Tools/ChangeLog

    r128333 r128338  
     12012-09-12  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [WK2][WKTR] TestRunner needs to implement originsWithApplicationCache
     4        https://bugs.webkit.org/show_bug.cgi?id=96496
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Add implementation for originsWithApplicationCache to
     9        WebKitTestRunner.
     10
     11        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     12        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     13        (WTR::stringArrayToJS):
     14        (WTR):
     15        (WTR::TestRunner::originsWithApplicationCache):
     16        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     17        (TestRunner):
     18
    1192012-09-12  Simon Hausmann  <simon.hausmann@nokia.com>
    220
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r128326 r128338  
    116116        void setApplicationCacheOriginQuota(in unsigned long long bytes);
    117117        void disallowIncreaseForApplicationCacheQuota();
     118        object originsWithApplicationCache();
    118119
    119120        // Compositing testing.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r128326 r128338  
    331331}
    332332
     333static inline JSValueRef stringArrayToJS(JSContextRef context, WKArrayRef strings)
     334{
     335    const size_t count = WKArrayGetSize(strings);
     336
     337    JSValueRef jsStringsArray[count];
     338    for (size_t i = 0; i < count; ++i) {
     339        WKStringRef stringRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(strings, i));
     340        JSRetainPtr<JSStringRef> stringJS = toJS(stringRef);
     341        jsStringsArray[i] = JSValueMakeString(context, stringJS.get());
     342    }
     343
     344    return JSObjectMakeArray(context, count, jsStringsArray, 0);
     345}
     346
     347JSValueRef TestRunner::originsWithApplicationCache()
     348{
     349    WKRetainPtr<WKArrayRef> origins(AdoptWK, WKBundleCopyOriginsWithApplicationCache(InjectedBundle::shared().bundle()));
     350
     351    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
     352    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
     353
     354    return stringArrayToJS(context, origins.get());
     355}
     356
    333357bool TestRunner::isCommandEnabled(JSStringRef name)
    334358{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r128326 r128338  
    153153    void disallowIncreaseForApplicationCacheQuota();
    154154    bool shouldDisallowIncreaseForApplicationCacheQuota() { return m_disallowIncreaseForApplicationCacheQuota; }
     155    JSValueRef originsWithApplicationCache();
    155156
    156157    // Printing
Note: See TracChangeset for help on using the changeset viewer.