Changeset 170222 in webkit


Ignore:
Timestamp:
Jun 20, 2014 4:37:38 PM (10 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] No way to get the main frame’s main resource’s data
https://bugs.webkit.org/show_bug.cgi?id=134113

Reviewed by Sam Weinig.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _getMainResourceDataWithCompletionHandler:]): Added. Calls
WebPageProxy::getMainResourceDataOfFrame and invokes the completion handler form the
callback.

  • UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new method.
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::getMainResourceDataOfFrame): Made it safe to pass a NULL frame into
this function.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r170219 r170222  
     12014-06-20  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] No way to get the main frame’s main resource’s data
     4        https://bugs.webkit.org/show_bug.cgi?id=134113
     5
     6        Reviewed by Sam Weinig.
     7
     8        * UIProcess/API/Cocoa/WKWebView.mm:
     9        (-[WKWebView _getMainResourceDataWithCompletionHandler:]): Added. Calls
     10        WebPageProxy::getMainResourceDataOfFrame and invokes the completion handler form the
     11        callback.
     12        * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new method.
     13
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::getMainResourceDataOfFrame): Made it safe to pass a NULL frame into
     16        this function.
     17
    1182014-06-20  Anders Carlsson  <andersca@apple.com>
    219
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r170195 r170222  
    15201520}
    15211521
     1522- (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler
     1523{
     1524    auto handler = adoptNS([completionHandler copy]);
     1525
     1526    _page->getMainResourceDataOfFrame(_page->mainFrame(), [handler](API::Data* data, WebKit::CallbackBase::Error error) {
     1527        void (^completionHandlerBlock)(NSData *, NSError *) = (void (^)(NSData *, NSError *))handler.get();
     1528        if (error != WebKit::CallbackBase::Error::None) {
     1529            // FIXME: Pipe a proper error in from the WebPageProxy.
     1530            RetainPtr<NSError> error = adoptNS([[NSError alloc] init]);
     1531            completionHandlerBlock(nil, error.get());
     1532        } else
     1533            completionHandlerBlock(wrapper(*data), nil);
     1534    });
     1535}
     1536
    15221537- (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler
    15231538{
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r170195 r170222  
    152152#endif
    153153
     154- (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
    154155- (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
    155156
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r170188 r170222  
    22982298{
    22992299    RefPtr<DataCallback> callback = DataCallback::create(std::move(callbackFunction));
    2300     if (!isValid()) {
     2300    if (!isValid() || !frame) {
    23012301        callback->invalidate();
    23022302        return;
Note: See TracChangeset for help on using the changeset viewer.