2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include "LegacyWebArchive.h"
35 #include "DocumentLoader.h"
37 #include "FrameLoader.h"
38 #include "FrameTree.h"
39 #include "HTMLFrameOwnerElement.h"
40 #include "HTMLNames.h"
41 #include "IconDatabase.h"
48 #include "SelectionController.h"
49 #include "SharedBuffer.h"
50 #include <wtf/ListHashSet.h>
51 #include <wtf/RetainPtr.h>
55 static const CFStringRef LegacyWebArchiveMainResourceKey = CFSTR("WebMainResource");
56 static const CFStringRef LegacyWebArchiveSubresourcesKey = CFSTR("WebSubresources");
57 static const CFStringRef LegacyWebArchiveSubframeArchivesKey = CFSTR("WebSubframeArchives");
58 static const CFStringRef LegacyWebArchiveResourceDataKey = CFSTR("WebResourceData");
59 static const CFStringRef LegacyWebArchiveResourceFrameNameKey = CFSTR("WebResourceFrameName");
60 static const CFStringRef LegacyWebArchiveResourceMIMETypeKey = CFSTR("WebResourceMIMEType");
61 static const CFStringRef LegacyWebArchiveResourceURLKey = CFSTR("WebResourceURL");
62 static const CFStringRef LegacyWebArchiveResourceTextEncodingNameKey = CFSTR("WebResourceTextEncodingName");
63 static const CFStringRef LegacyWebArchiveResourceResponseKey = CFSTR("WebResourceResponse");
64 static const CFStringRef LegacyWebArchiveResourceResponseVersionKey = CFSTR("WebResourceResponseVersion");
66 RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(ArchiveResource* resource, MainResourceStatus isMainResource)
69 // The property list representation of a null/empty WebResource has the following 3 objects stored as nil.
70 // FIXME: 0 is not serializable. Presumably we need to use kCFNull here instead for compatibility.
71 // FIXME: But why do we need to support a resource of 0? Who relies on that?
72 RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, CFDictionaryCreateMutable(0, 3, 0, 0));
73 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceDataKey, 0);
74 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceURLKey, 0);
75 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceMIMETypeKey, 0);
79 RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, CFDictionaryCreateMutable(0, 6, 0, &kCFTypeDictionaryValueCallBacks));
81 // Resource data can be empty, but must be represented by an empty CFDataRef
82 SharedBuffer* data = resource->data();
83 RetainPtr<CFDataRef> cfData;
85 cfData.adoptCF(data->createCFData());
87 cfData.adoptCF(CFDataCreate(0, 0, 0));
88 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceDataKey, cfData.get());
90 // Resource URL cannot be null
91 RetainPtr<CFStringRef> cfURL(AdoptCF, resource->url().string().createCFString());
93 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceURLKey, cfURL.get());
95 LOG(Archives, "LegacyWebArchive - NULL resource URL is invalid - returning null property list");
99 // FrameName should be left out if empty for subresources, but always included for main resources
100 const String& frameName(resource->frameName());
101 if (!frameName.isEmpty() || isMainResource) {
102 RetainPtr<CFStringRef> cfFrameName(AdoptCF, frameName.createCFString());
103 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceFrameNameKey, cfFrameName.get());
106 // Set MIMEType, TextEncodingName, and ResourceResponse only if they actually exist
107 const String& mimeType(resource->mimeType());
108 if (!mimeType.isEmpty()) {
109 RetainPtr<CFStringRef> cfMIMEType(AdoptCF, mimeType.createCFString());
110 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceMIMETypeKey, cfMIMEType.get());
113 const String& textEncoding(resource->textEncoding());
114 if (!textEncoding.isEmpty()) {
115 RetainPtr<CFStringRef> cfTextEncoding(AdoptCF, textEncoding.createCFString());
116 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceTextEncodingNameKey, cfTextEncoding.get());
119 // Don't include the resource response for the main resource
120 if (!isMainResource) {
121 RetainPtr<CFDataRef> resourceResponseData = createPropertyListRepresentation(resource->response());
122 if (resourceResponseData)
123 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceResponseKey, resourceResponseData.get());
129 RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(Archive* archive)
131 RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, CFDictionaryCreateMutable(0, 3, 0, &kCFTypeDictionaryValueCallBacks));
133 RetainPtr<CFDictionaryRef> mainResourceDict = createPropertyListRepresentation(archive->mainResource(), MainResource);
134 ASSERT(mainResourceDict);
135 if (!mainResourceDict)
137 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveMainResourceKey, mainResourceDict.get());
139 RetainPtr<CFMutableArrayRef> subresourcesArray(AdoptCF, CFArrayCreateMutable(0, archive->subresources().size(), &kCFTypeArrayCallBacks));
140 const Vector<RefPtr<ArchiveResource> >& subresources(archive->subresources());
141 for (unsigned i = 0; i < subresources.size(); ++i) {
142 RetainPtr<CFDictionaryRef> subresource = createPropertyListRepresentation(subresources[i].get(), Subresource);
144 CFArrayAppendValue(subresourcesArray.get(), subresource.get());
146 LOG(Archives, "LegacyWebArchive - Failed to create property list for subresource");
148 if (CFArrayGetCount(subresourcesArray.get()))
149 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveSubresourcesKey, subresourcesArray.get());
151 RetainPtr<CFMutableArrayRef> subframesArray(AdoptCF, CFArrayCreateMutable(0, archive->subframeArchives().size(), &kCFTypeArrayCallBacks));
152 const Vector<RefPtr<Archive> >& subframeArchives(archive->subframeArchives());
153 for (unsigned i = 0; i < subframeArchives.size(); ++i) {
154 RetainPtr<CFDictionaryRef> subframeArchive = createPropertyListRepresentation(subframeArchives[i].get());
156 CFArrayAppendValue(subframesArray.get(), subframeArchive.get());
158 LOG(Archives, "LegacyWebArchive - Failed to create property list for subframe archive");
160 if (CFArrayGetCount(subframesArray.get()))
161 CFDictionarySetValue(propertyList.get(), LegacyWebArchiveSubframeArchivesKey, subframesArray.get());
166 ResourceResponse LegacyWebArchive::createResourceResponseFromPropertyListData(CFDataRef data, CFStringRef responseDataType)
170 return ResourceResponse();
172 // If the ResourceResponseVersion (passed in as responseDataType) exists at all, this is a "new" web archive that we
173 // can parse well in a cross platform manner If it doesn't exist, we will assume this is an "old" web archive with,
174 // NSURLResponse objects in it and parse the ResourceResponse as such.
175 if (!responseDataType)
176 return createResourceResponseFromMacArchivedData(data);
178 // FIXME: Parse the "new" format that the above comment references here. This format doesn't exist yet.
179 return ResourceResponse();
182 PassRefPtr<ArchiveResource> LegacyWebArchive::createResource(CFDictionaryRef dictionary)
188 CFDataRef resourceData = static_cast<CFDataRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceDataKey));
189 if (resourceData && CFGetTypeID(resourceData) != CFDataGetTypeID()) {
190 LOG(Archives, "LegacyWebArchive - Resource data is not of type CFData, cannot create invalid resource");
194 CFStringRef frameName = static_cast<CFStringRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceFrameNameKey));
195 if (frameName && CFGetTypeID(frameName) != CFStringGetTypeID()) {
196 LOG(Archives, "LegacyWebArchive - Frame name is not of type CFString, cannot create invalid resource");
200 CFStringRef mimeType = static_cast<CFStringRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceMIMETypeKey));
201 if (mimeType && CFGetTypeID(mimeType) != CFStringGetTypeID()) {
202 LOG(Archives, "LegacyWebArchive - MIME type is not of type CFString, cannot create invalid resource");
206 CFStringRef url = static_cast<CFStringRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceURLKey));
207 if (url && CFGetTypeID(url) != CFStringGetTypeID()) {
208 LOG(Archives, "LegacyWebArchive - URL is not of type CFString, cannot create invalid resource");
212 CFStringRef textEncoding = static_cast<CFStringRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceTextEncodingNameKey));
213 if (textEncoding && CFGetTypeID(textEncoding) != CFStringGetTypeID()) {
214 LOG(Archives, "LegacyWebArchive - Text encoding is not of type CFString, cannot create invalid resource");
218 ResourceResponse response;
220 CFDataRef resourceResponseData = static_cast<CFDataRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceResponseKey));
221 if (resourceResponseData) {
222 if (CFGetTypeID(resourceResponseData) != CFDataGetTypeID()) {
223 LOG(Archives, "LegacyWebArchive - Resource response data is not of type CFData, cannot create invalid resource");
227 CFStringRef resourceResponseVersion = static_cast<CFStringRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceResponseVersionKey));
228 if (resourceResponseVersion && CFGetTypeID(resourceResponseVersion) != CFStringGetTypeID()) {
229 LOG(Archives, "LegacyWebArchive - Resource response version is not of type CFString, cannot create invalid resource");
233 response = createResourceResponseFromPropertyListData(resourceResponseData, resourceResponseVersion);
236 return ArchiveResource::create(SharedBuffer::create(CFDataGetBytePtr(resourceData), CFDataGetLength(resourceData)), KURL(url), mimeType, textEncoding, frameName, response);
239 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create()
241 return adoptRef(new LegacyWebArchive);
244 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(PassRefPtr<ArchiveResource> mainResource, Vector<PassRefPtr<ArchiveResource> >& subresources, Vector<PassRefPtr<LegacyWebArchive> >& subframeArchives)
246 ASSERT(mainResource);
250 RefPtr<LegacyWebArchive> archive = create();
251 archive->setMainResource(mainResource);
253 for (unsigned i = 0; i < subresources.size(); ++i)
254 archive->addSubresource(subresources[i]);
256 for (unsigned i = 0; i < subframeArchives.size(); ++i)
257 archive->addSubframeArchive(subframeArchives[i]);
259 return archive.release();
262 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(SharedBuffer* data)
264 LOG(Archives, "LegacyWebArchive - Creating from raw data");
266 RefPtr<LegacyWebArchive> archive = create();
272 RetainPtr<CFDataRef> cfData(AdoptCF, data->createCFData());
276 CFStringRef errorString = 0;
278 RetainPtr<CFDictionaryRef> plist(AdoptCF, static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(0, cfData.get(), kCFPropertyListImmutable, &errorString)));
281 const char* cError = errorString ? CFStringGetCStringPtr(errorString, kCFStringEncodingUTF8) : "unknown error";
282 LOG(Archives, "LegacyWebArchive - Error parsing PropertyList from archive data - %s", cError);
285 CFRelease(errorString);
289 if (CFGetTypeID(plist.get()) != CFDictionaryGetTypeID()) {
290 LOG(Archives, "LegacyWebArchive - Archive property list is not the expected CFDictionary, aborting invalid WebArchive");
294 if (!archive->extract(plist.get()))
297 return archive.release();
300 bool LegacyWebArchive::extract(CFDictionaryRef dictionary)
304 LOG(Archives, "LegacyWebArchive - Null root CFDictionary, aborting invalid WebArchive");
308 CFDictionaryRef mainResourceDict = static_cast<CFDictionaryRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveMainResourceKey));
309 if (!mainResourceDict) {
310 LOG(Archives, "LegacyWebArchive - No main resource in archive, aborting invalid WebArchive");
313 if (CFGetTypeID(mainResourceDict) != CFDictionaryGetTypeID()) {
314 LOG(Archives, "LegacyWebArchive - Main resource is not the expected CFDictionary, aborting invalid WebArchive");
318 setMainResource(createResource(mainResourceDict));
319 if (!mainResource()) {
320 LOG(Archives, "LegacyWebArchive - Failed to parse main resource from CFDictionary or main resource does not exist, aborting invalid WebArchive");
324 CFArrayRef subresourceArray = static_cast<CFArrayRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveSubresourcesKey));
325 if (subresourceArray && CFGetTypeID(subresourceArray) != CFArrayGetTypeID()) {
326 LOG(Archives, "LegacyWebArchive - Subresources is not the expected Array, aborting invalid WebArchive");
330 if (subresourceArray) {
331 CFIndex count = CFArrayGetCount(subresourceArray);
332 for (CFIndex i = 0; i < count; ++i) {
333 CFDictionaryRef subresourceDict = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(subresourceArray, i));
334 if (CFGetTypeID(subresourceDict) != CFDictionaryGetTypeID()) {
335 LOG(Archives, "LegacyWebArchive - Subresource is not expected CFDictionary, aborting invalid WebArchive");
338 addSubresource(createResource(subresourceDict));
342 CFArrayRef subframeArray = static_cast<CFArrayRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveSubframeArchivesKey));
343 if (subframeArray && CFGetTypeID(subframeArray) != CFArrayGetTypeID()) {
344 LOG(Archives, "LegacyWebArchive - Subframe archives is not the expected Array, aborting invalid WebArchive");
349 CFIndex count = CFArrayGetCount(subframeArray);
350 for (CFIndex i = 0; i < count; ++i) {
351 CFDictionaryRef subframeDict = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(subframeArray, i));
352 if (CFGetTypeID(subframeDict) != CFDictionaryGetTypeID()) {
353 LOG(Archives, "LegacyWebArchive - Subframe array is not expected CFDictionary, aborting invalid WebArchive");
357 RefPtr<LegacyWebArchive> subframeArchive = create();
358 if (subframeArchive->extract(subframeDict))
359 addSubframeArchive(subframeArchive.release());
361 LOG(Archives, "LegacyWebArchive - Invalid subframe archive skipped");
368 RetainPtr<CFDataRef> LegacyWebArchive::rawDataRepresentation()
370 RetainPtr<CFDictionaryRef> propertyList = createPropertyListRepresentation(this);
371 ASSERT(propertyList);
373 LOG(Archives, "LegacyWebArchive - Failed to create property list for archive, returning no data");
377 RetainPtr<CFWriteStreamRef> stream(AdoptCF, CFWriteStreamCreateWithAllocatedBuffers(0, 0));
379 CFWriteStreamOpen(stream.get());
380 CFPropertyListWriteToStream(propertyList.get(), stream.get(), kCFPropertyListBinaryFormat_v1_0, 0);
382 RetainPtr<CFDataRef> plistData(AdoptCF, static_cast<CFDataRef>(CFWriteStreamCopyProperty(stream.get(), kCFStreamPropertyDataWritten)));
385 CFWriteStreamClose(stream.get());
388 LOG(Archives, "LegacyWebArchive - Failed to convert property list into raw data, returning no data");
397 ResourceResponse LegacyWebArchive::createResourceResponseFromMacArchivedData(CFDataRef responseData)
399 // FIXME: If is is possible to parse in a serialized NSURLResponse manually, without using
400 // NSKeyedUnarchiver, manipulating plists directly, then we want to do that here.
401 // Until then, this can be done on Mac only.
402 return ResourceResponse();
405 RetainPtr<CFDataRef> LegacyWebArchive::createPropertyListRepresentation(const ResourceResponse& response)
407 // FIXME: Write out the "new" format described in createResourceResponseFromPropertyListData once we invent it.
413 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Node* node)
419 Document* document = node->document();
420 Frame* frame = document ? document->frame() : 0;
424 Vector<Node*> nodeList;
425 String markupString = createMarkup(node, IncludeNode, &nodeList);
426 Node::NodeType nodeType = node->nodeType();
427 if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE)
428 markupString = frame->documentTypeString() + markupString;
430 return create(markupString, frame, nodeList);
433 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Frame* frame)
437 DocumentLoader* documentLoader = frame->loader()->documentLoader();
442 Vector<PassRefPtr<LegacyWebArchive> > subframeArchives;
444 unsigned children = frame->tree()->childCount();
445 for (unsigned i = 0; i < children; ++i) {
446 RefPtr<LegacyWebArchive> childFrameArchive = create(frame->tree()->child(i));
447 if (childFrameArchive)
448 subframeArchives.append(childFrameArchive.release());
451 Vector<PassRefPtr<ArchiveResource> > subresources;
452 documentLoader->getSubresources(subresources);
454 return create(documentLoader->mainResource(), subresources, subframeArchives);
457 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Range* range)
462 Node* startContainer = range->startContainer();
466 Document* document = startContainer->document();
470 Frame* frame = document->frame();
474 Vector<Node*> nodeList;
476 // FIXME: This is always "for interchange". Is that right? See the previous method.
477 String markupString = frame->documentTypeString() + createMarkup(range, &nodeList, AnnotateForInterchange);
479 return create(markupString, frame, nodeList);
482 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString, Frame* frame, const Vector<Node*>& nodes)
486 const ResourceResponse& response = frame->loader()->documentLoader()->response();
487 KURL responseURL = response.url();
489 // it's possible to have a response without a URL here
490 // <rdar://problem/5454935>
491 if (responseURL.isNull())
492 responseURL = KURL("");
494 PassRefPtr<ArchiveResource> mainResource = ArchiveResource::create(utf8Buffer(markupString), responseURL, response.mimeType(), "UTF-8", frame->tree()->name());
496 Vector<PassRefPtr<LegacyWebArchive> > subframeArchives;
497 Vector<PassRefPtr<ArchiveResource> > subresources;
498 HashSet<KURL> uniqueSubresources;
500 size_t nodesSize = nodes.size();
501 for (size_t i = 0; i < nodesSize; ++i) {
502 Node* node = nodes[i];
504 if ((node->hasTagName(HTMLNames::frameTag) || node->hasTagName(HTMLNames::iframeTag) || node->hasTagName(HTMLNames::objectTag)) &&
505 (childFrame = static_cast<HTMLFrameOwnerElement*>(node)->contentFrame())) {
506 RefPtr<LegacyWebArchive> subframeArchive = create(childFrame->document());
509 subframeArchives.append(subframeArchive);
511 LOG_ERROR("Unabled to archive subframe %s", childFrame->tree()->name().string().utf8().data());
513 ListHashSet<KURL> subresourceURLs;
514 node->getSubresourceURLs(subresourceURLs);
516 DocumentLoader* documentLoader = frame->loader()->documentLoader();
517 ListHashSet<KURL>::iterator iterEnd = subresourceURLs.end();
518 for (ListHashSet<KURL>::iterator iter = subresourceURLs.begin(); iter != iterEnd; ++iter) {
519 const KURL& subresourceURL = *iter;
520 if (uniqueSubresources.contains(subresourceURL))
523 uniqueSubresources.add(subresourceURL);
525 RefPtr<ArchiveResource> resource = documentLoader->subresource(subresourceURL);
527 subresources.append(resource.release());
531 CachedResource *cachedResource = cache()->resourceForURL(subresourceURL);
532 if (cachedResource) {
533 resource = ArchiveResource::create(cachedResource->data(), subresourceURL, cachedResource->response());
535 subresources.append(resource.release());
540 // FIXME: should do something better than spew to console here
541 LOG_ERROR("Failed to archive subresource for %s", subresourceURL.string().utf8().data());
546 // Add favicon if one exists for this page, if we are archiving the entire page.
547 if (nodesSize && nodes[0]->isDocumentNode() && iconDatabase() && iconDatabase()->isEnabled()) {
548 const String& iconURL = iconDatabase()->iconURLForPageURL(responseURL);
549 if (!iconURL.isEmpty() && iconDatabase()->iconDataKnownForIconURL(iconURL)) {
550 if (Image* iconImage = iconDatabase()->iconForPageURL(responseURL, IntSize(16, 16))) {
551 if (RefPtr<ArchiveResource> resource = ArchiveResource::create(iconImage->data(), KURL(iconURL), "image/x-icon", "", ""))
552 subresources.append(resource.release());
557 return create(mainResource, subresources, subframeArchives);
560 PassRefPtr<LegacyWebArchive> LegacyWebArchive::createFromSelection(Frame* frame)
565 RefPtr<Range> selectionRange = frame->selection()->toNormalizedRange();
566 Vector<Node*> nodeList;
567 String markupString = frame->documentTypeString() + createMarkup(selectionRange.get(), &nodeList, AnnotateForInterchange);
569 RefPtr<LegacyWebArchive> archive = create(markupString, frame, nodeList);
571 if (!frame->document() || !frame->document()->isFrameSet())
572 return archive.release();
574 // Wrap the frameset document in an iframe so it can be pasted into
575 // another document (which will have a body or frameset of its own).
576 String iframeMarkup = String::format("<iframe frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\" width=\"98%%\" height=\"98%%\" src=\"%s\"></iframe>",
577 frame->loader()->documentLoader()->response().url().string().utf8().data());
578 RefPtr<ArchiveResource> iframeResource = ArchiveResource::create(utf8Buffer(iframeMarkup), blankURL(), "text/html", "UTF-8", String());
580 Vector<PassRefPtr<ArchiveResource> > subresources;
582 Vector<PassRefPtr<LegacyWebArchive> > subframeArchives;
583 subframeArchives.append(archive);
585 archive = create(iframeResource.release(), subresources, subframeArchives);
587 return archive.release();