Diff
Modified: trunk/Source/WebKit/ChangeLog (256235 => 256236)
--- trunk/Source/WebKit/ChangeLog 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/ChangeLog 2020-02-11 02:18:05 UTC (rev 256236)
@@ -1,3 +1,41 @@
+2020-02-10 Alan Sien Wei Hshieh <[email protected]>
+
+ Add a variant of -[WKWebViewPrivate _getContentsAsStringWithCompletionHandler:] that includes contents from subframes
+ https://bugs.webkit.org/show_bug.cgi?id=207352
+ <rdar://problem/59115798>
+
+ Reviewed by Alex Christensen.
+
+ A number of intelligence features like Spotlight rely on -_getContentsAsStringWithCompletionHandler:. However, this
+ method does not return content strings for subframes. This means that Spotlight and others are not able to get
+ text for things like AMP pages, that live in subframes. -_getContentsAsStringWithCompletionHandler: has clients outside
+ of just intelligence features, and we don't want to wholesale change their behavior. As a result, introduce a new
+ -_getContentsAsStringInAllFrames:withCompletionHandler: which clients can adopt as necessary. Providing NO for the first
+ parameter allows clients to get the same contents as -_getContentsAsStringWithCompletionHandler:. Otherwise, we enumerate
+ all subframes and extract text from there. Finally, append a test for getting stuff out of frames.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _getContentsAsStringWithCompletionHandler:]):
+ (-[WKWebView _getContentsOfAllFramesAsStringWithCompletionHandler:]): Call the new function to extract contents from all
+ frames.
+
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h: Expose a new SPI for clients.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::getContentsAsStringInAllFrames): Piping. This emulates what getContentsAsString() does.
+
+ * UIProcess/WebPageProxy.h: Expose new method.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::getContentsAsString): Augment to take a flag saying whether or not we want to extract
+ from all frames. If we do, iterate over all the frames and get their content strings, appending two
+ new lines in the middle.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Piping.
+
+ * Shared/ContentAsStringIncludesChildFrames.h: Add a new header to expose an enum.
+
2020-02-10 Per Arne Vollan <[email protected]>
[iOS] Crash when granting access to asset services
Added: trunk/Source/WebKit/Shared/ContentAsStringIncludesChildFrames.h (0 => 256236)
--- trunk/Source/WebKit/Shared/ContentAsStringIncludesChildFrames.h (rev 0)
+++ trunk/Source/WebKit/Shared/ContentAsStringIncludesChildFrames.h 2020-02-11 02:18:05 UTC (rev 256236)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+namespace WebKit {
+
+enum class ContentAsStringIncludesChildFrames : bool { No, Yes };
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (256235 => 256236)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2020-02-11 02:18:05 UTC (rev 256236)
@@ -52,6 +52,7 @@
#include "AuthenticationChallengeDisposition.h"
#include "AuthenticationChallengeProxy.h"
#include "AuthenticationDecisionListener.h"
+#include "ContentAsStringIncludesChildFrames.h"
#include "LegacySessionStateCoding.h"
#include "Logging.h"
#include "NativeWebKeyboardEvent.h"
@@ -2510,7 +2511,7 @@
void WKPageGetContentsAsString(WKPageRef pageRef, void* context, WKPageGetContentsAsStringFunction callback)
{
- toImpl(pageRef)->getContentsAsString(toGenericCallbackFunction(context, callback));
+ toImpl(pageRef)->getContentsAsString(ContentAsStringIncludesChildFrames::No, toGenericCallbackFunction(context, callback));
}
void WKPageGetBytecodeProfile(WKPageRef pageRef, void* context, WKPageGetBytecodeProfileFunction callback)
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (256235 => 256236)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2020-02-11 02:18:05 UTC (rev 256236)
@@ -31,6 +31,7 @@
#import "APISerializedScriptValue.h"
#import "AttributedString.h"
#import "CompletionHandlerCallChecker.h"
+#import "ContentAsStringIncludesChildFrames.h"
#import "DiagnosticLoggingClient.h"
#import "FindClient.h"
#import "FullscreenClient.h"
@@ -2286,7 +2287,7 @@
{
auto handler = makeBlockPtr(completionHandler);
- _page->getContentsAsString([handler](String string, WebKit::CallbackBase::Error error) {
+ _page->getContentsAsString(WebKit::ContentAsStringIncludesChildFrames::No, [handler](String string, WebKit::CallbackBase::Error error) {
if (error != WebKit::CallbackBase::Error::None) {
// FIXME: Pipe a proper error in from the WebPageProxy.
handler(nil, [NSError errorWithDomain:WKErrorDomain code:static_cast<int>(error) userInfo:nil]);
@@ -2295,6 +2296,17 @@
});
}
+- (void)_getContentsOfAllFramesAsStringWithCompletionHandler:(void (^)(NSString *))completionHandler
+{
+ auto handler = makeBlockPtr(completionHandler);
+ _page->getContentsAsString(WebKit::ContentAsStringIncludesChildFrames::Yes, [handler](String string, WebKit::CallbackBase::Error error) {
+ if (error != WebKit::CallbackBase::Error::None)
+ handler(nil);
+ else
+ handler(string);
+ });
+}
+
- (void)_getContentsAsAttributedStringWithCompletionHandler:(void (^)(NSAttributedString *, NSDictionary<NSAttributedStringDocumentAttributeKey, id> *, NSError *))completionHandler
{
_page->getContentsAsAttributedString([handler = makeBlockPtr(completionHandler)](auto& attributedString) {
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (256235 => 256236)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2020-02-11 02:18:05 UTC (rev 256236)
@@ -266,6 +266,7 @@
- (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
- (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
- (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError *))completionHandler WK_API_AVAILABLE(macos(10.13), ios(11.0));
+- (void)_getContentsOfAllFramesAsStringWithCompletionHandler:(void (^)(NSString *))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_getContentsAsAttributedStringWithCompletionHandler:(void (^)(NSAttributedString *, NSDictionary<NSAttributedStringDocumentAttributeKey, id> *, NSError *))completionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
- (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (256235 => 256236)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-02-11 02:18:05 UTC (rev 256236)
@@ -3962,16 +3962,16 @@
send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID));
}
-void WebPageProxy::getContentsAsString(WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction)
+void WebPageProxy::getContentsAsString(ContentAsStringIncludesChildFrames includesChildFrames, WTF::Function<void(const String&, CallbackBase::Error)>&& callbackFunction)
{
if (!hasRunningProcess()) {
callbackFunction(String(), CallbackBase::Error::Unknown);
return;
}
-
+
auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::getContentsAsString"_s));
m_loadDependentStringCallbackIDs.add(callbackID);
- send(Messages::WebPage::GetContentsAsString(callbackID));
+ send(Messages::WebPage::GetContentsAsString(includesChildFrames, callbackID));
}
#if PLATFORM(COCOA)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (256235 => 256236)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-02-11 02:18:05 UTC (rev 256236)
@@ -27,6 +27,7 @@
#include "APIObject.h"
#include "Connection.h"
+#include "ContentAsStringIncludesChildFrames.h"
#include "ContextMenuContextData.h"
#include "DownloadID.h"
#include "DragControllerAction.h"
@@ -1078,7 +1079,7 @@
void didFailToFindString(const String&);
void didFindStringMatches(const String&, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection);
- void getContentsAsString(WTF::Function<void (const String&, CallbackBase::Error)>&&);
+ void getContentsAsString(ContentAsStringIncludesChildFrames, WTF::Function<void(const String&, CallbackBase::Error)>&&);
#if PLATFORM(COCOA)
void getContentsAsAttributedString(CompletionHandler<void(const AttributedString&)>&&);
#endif
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (256235 => 256236)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-02-11 02:18:05 UTC (rev 256236)
@@ -1684,6 +1684,8 @@
C9C1833C1B74026D007036A7 /* WebMediaSessionFocusManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C183381B73FD6A007036A7 /* WebMediaSessionFocusManagerClient.h */; };
C9CD43981B4B001D00239E33 /* WebMediaSessionMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = C9CD43941B4B000E00239E33 /* WebMediaSessionMetadata.h */; };
C9CD439D1B4B024F00239E33 /* WKMediaSessionMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = C9CD439A1B4B024200239E33 /* WKMediaSessionMetadata.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ CA05397723EE31E100A553DC /* ContentAsStringIncludesChildFrames.h in Headers */ = {isa = PBXBuildFile; fileRef = CA05397623EE31E100A553DC /* ContentAsStringIncludesChildFrames.h */; };
+ CA05397923EE324400A553DC /* ContentAsStringIncludesChildFrames.h in Headers */ = {isa = PBXBuildFile; fileRef = CA05397823EE324400A553DC /* ContentAsStringIncludesChildFrames.h */; };
CD003A5319D49B5D005ABCE0 /* WebMediaKeyStorageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CD003A5119D49B5D005ABCE0 /* WebMediaKeyStorageManager.h */; };
CD0C6831201FD10100A59409 /* WKFullScreenViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD0C682F201FD10100A59409 /* WKFullScreenViewController.h */; };
CD19A26E1A13E834008D650E /* WebDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CD19A26A1A13E821008D650E /* WebDiagnosticLoggingClient.h */; };
@@ -4910,6 +4912,8 @@
C9CD43941B4B000E00239E33 /* WebMediaSessionMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMediaSessionMetadata.h; sourceTree = "<group>"; };
C9CD43991B4B024200239E33 /* WKMediaSessionMetadata.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMediaSessionMetadata.cpp; sourceTree = "<group>"; };
C9CD439A1B4B024200239E33 /* WKMediaSessionMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMediaSessionMetadata.h; sourceTree = "<group>"; };
+ CA05397623EE31E100A553DC /* ContentAsStringIncludesChildFrames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentAsStringIncludesChildFrames.h; sourceTree = "<group>"; };
+ CA05397823EE324400A553DC /* ContentAsStringIncludesChildFrames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentAsStringIncludesChildFrames.h; sourceTree = "<group>"; };
CD003A5019D49B5D005ABCE0 /* WebMediaKeyStorageManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebMediaKeyStorageManager.cpp; path = MediaCache/WebMediaKeyStorageManager.cpp; sourceTree = "<group>"; };
CD003A5119D49B5D005ABCE0 /* WebMediaKeyStorageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebMediaKeyStorageManager.h; path = MediaCache/WebMediaKeyStorageManager.h; sourceTree = "<group>"; };
CD0C682F201FD10100A59409 /* WKFullScreenViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFullScreenViewController.h; path = ios/fullscreen/WKFullScreenViewController.h; sourceTree = "<group>"; };
@@ -5669,6 +5673,7 @@
BCF18637167D071E00A1A85A /* CacheModel.cpp */,
BC3065F91259344E00E71278 /* CacheModel.h */,
9BC59D6C1EFCCCB6001E8D09 /* CallbackID.h */,
+ CA05397823EE324400A553DC /* ContentAsStringIncludesChildFrames.h */,
5129EB1123D0DE7800AF1CD7 /* ContentWorldShared.h */,
5106D7BF18BDBE73000AB166 /* ContextMenuContextData.cpp */,
5106D7C018BDBE73000AB166 /* ContextMenuContextData.h */,
@@ -8450,6 +8455,7 @@
E1513C65166EABB200149FCB /* AuxiliaryProcessProxy.h */,
46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */,
46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */,
+ CA05397623EE31E100A553DC /* ContentAsStringIncludesChildFrames.h */,
07297F9C1C1711EA003F0735 /* DeviceIdHashSaltStorage.cpp */,
07297F9D1C17BBEA223F0735 /* DeviceIdHashSaltStorage.h */,
BC2652121182608100243E12 /* DrawingAreaProxy.cpp */,
@@ -10192,6 +10198,8 @@
37BEC4E119491486008B4286 /* CompletionHandlerCallChecker.h in Headers */,
37C4E9F6131C6E7E0029BD5A /* config.h in Headers */,
BC032DAB10F437D10058C15A /* Connection.h in Headers */,
+ CA05397923EE324400A553DC /* ContentAsStringIncludesChildFrames.h in Headers */,
+ CA05397723EE31E100A553DC /* ContentAsStringIncludesChildFrames.h in Headers */,
5129EB1223D0DE7B00AF1CD7 /* ContentWorldShared.h in Headers */,
5106D7C418BDBE73000AB166 /* ContextMenuContextData.h in Headers */,
37C21CAE1E994C0C0029D5F9 /* CorePredictionSPI.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (256235 => 256236)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-02-11 02:18:05 UTC (rev 256236)
@@ -3446,10 +3446,31 @@
runJavaScript(frame, { script, false, WTF::nullopt, forceUserGesture }, pageContentWorldIdentifier(), callbackID);
}
-void WebPage::getContentsAsString(CallbackID callbackID)
+void WebPage::getContentsAsString(ContentAsStringIncludesChildFrames includeChildFrames, CallbackID callbackID)
{
- String resultString = m_mainFrame->contentsAsString();
- send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
+ switch (includeChildFrames) {
+ case ContentAsStringIncludesChildFrames::No: {
+ String resultString = m_mainFrame->contentsAsString();
+ send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
+ break;
+ }
+ case ContentAsStringIncludesChildFrames::Yes: {
+ StringBuilder builder;
+ for (RefPtr<Frame> frame = &corePage()->mainFrame(); frame; frame = frame->tree().traverseNextRendered()) {
+ if (auto* webFrame = WebFrame::fromCoreFrame(*frame)) {
+ if (!builder.isEmpty()) {
+ builder.append('\n');
+ builder.append('\n');
+ }
+
+ builder.append(webFrame->contentsAsString());
+ }
+ }
+
+ send(Messages::WebPageProxy::StringCallback(builder.toString(), callbackID));
+ break;
+ }
+ }
}
#if ENABLE(MHTML)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (256235 => 256236)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-02-11 02:18:05 UTC (rev 256236)
@@ -33,6 +33,7 @@
#include "APIInjectedBundlePageUIClient.h"
#include "APIObject.h"
#include "CallbackID.h"
+#include "ContentAsStringIncludesChildFrames.h"
#include "DrawingAreaInfo.h"
#include "EditingRange.h"
#include "FocusedElementInformation.h"
@@ -1451,7 +1452,7 @@
void viewWillStartLiveResize();
void viewWillEndLiveResize();
- void getContentsAsString(CallbackID);
+ void getContentsAsString(ContentAsStringIncludesChildFrames, CallbackID);
#if PLATFORM(COCOA)
void getContentsAsAttributedString(CompletionHandler<void(const AttributedString&)>&&);
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (256235 => 256236)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-02-11 02:18:05 UTC (rev 256236)
@@ -192,7 +192,7 @@
RestoreSelectionInFocusedEditableElement()
# Callbacks.
- GetContentsAsString(WebKit::CallbackID callbackID)
+ GetContentsAsString(enum:bool WebKit::ContentAsStringIncludesChildFrames inChildFrames, WebKit::CallbackID callbackID)
#if PLATFORM(COCOA)
GetContentsAsAttributedString() -> (struct WebKit::AttributedString result) Async
#endif
Modified: trunk/Tools/ChangeLog (256235 => 256236)
--- trunk/Tools/ChangeLog 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Tools/ChangeLog 2020-02-11 02:18:05 UTC (rev 256236)
@@ -1,3 +1,17 @@
+2020-02-10 Alan Sien Wei Hshieh <[email protected]>
+
+ Add a variant of -[WKWebViewPrivate _getContentsAsStringWithCompletionHandler:] that includes contents from subframes
+ https://bugs.webkit.org/show_bug.cgi?id=207352
+ <rdar://problem/59115798>
+
+ Reviewed by Alex Christensen.
+
+ Add a test to exercise the new SPI.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm: Add a test for getting text from all frames with
+ a webpage that contains text in subframes.
+
+
2020-02-10 Per Arne Vollan <[email protected]>
[iOS] Crash when granting access to asset services
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm (256235 => 256236)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm 2020-02-11 02:08:05 UTC (rev 256235)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm 2020-02-11 02:18:05 UTC (rev 256236)
@@ -49,6 +49,22 @@
TestWebKitAPI::Util::run(&finished);
}
+TEST(WKWebView, GetContentsOfAllFramesShouldReturnString)
+{
+ RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+ [webView synchronouslyLoadHTMLString:@"<body>beep<iframe srcdoc=\"meep\">herp</iframe><iframe srcdoc=\"moop\">derp</iframe></body>"];
+
+ __block bool finished = false;
+
+ [webView _getContentsOfAllFramesAsStringWithCompletionHandler:^(NSString *string) {
+ EXPECT_WK_STREQ(@"beep\n\nmeep\n\nmoop", string);
+ finished = true;
+ }];
+
+ TestWebKitAPI::Util::run(&finished);
+}
+
TEST(WKWebView, GetContentsShouldReturnAttributedString)
{
RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);