Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: third_party/WebKit/Source/core/frame/FrameSerializer.cpp

Issue 1977303003: Adds a feature to MHTML serialization that omits subframes and subresources marked no-store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-store
Patch Set: Address dcheng's comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameSerializer.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
index 6427f7e04fab9595002ef102e06221ba685c23a4..a49c4505834089fff944f7009500f9d8e3ba5d48 100644
--- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -386,17 +386,20 @@ void FrameSerializer::serializeCSSRule(CSSRule* rule)
bool FrameSerializer::shouldAddURL(const KURL& url)
{
return url.isValid() && !m_resourceURLs.contains(url) && !url.protocolIsData()
- && !m_delegate.shouldSkipResource(url);
+ && !m_delegate.shouldSkipResourceWithURL(url);
}
-void FrameSerializer::addToResources(Resource* resource, PassRefPtr<SharedBuffer> data, const KURL& url)
+void FrameSerializer::addToResources(const Resource& resource, PassRefPtr<SharedBuffer> data, const KURL& url)
{
+ if (m_delegate.shouldSkipResource(resource))
+ return;
+
if (!data) {
DLOG(ERROR) << "No data for resource " << url.getString();
return;
}
- String mimeType = resource->response().mimeType();
+ String mimeType = resource.response().mimeType();
m_resources->append(SerializedResource(url, mimeType, data));
m_resourceURLs.add(url);
}
@@ -407,7 +410,7 @@ void FrameSerializer::addImageToResources(ImageResource* image, const KURL& url)
return;
RefPtr<SharedBuffer> data = image->getImage()->data();
- addToResources(image, data, url);
+ addToResources(*image, data, url);
}
void FrameSerializer::addFontToResources(FontResource* font)
@@ -417,7 +420,7 @@ void FrameSerializer::addFontToResources(FontResource* font)
RefPtr<SharedBuffer> data(font->resourceBuffer());
- addToResources(font, data, font->url());
+ addToResources(*font, data, font->url());
}
void FrameSerializer::retrieveResourcesForProperties(const StylePropertySet* styleDeclaration, Document& document)

Powered by Google App Engine
This is Rietveld 408576698