Index: Source/core/html/HTMLImageElement.cpp |
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp |
index f6d39f0c885c1a734ffba8092e779063de159c56..8b7c1ea5f99b6bf71c668046fe00285a8a3bcdfa 100644 |
--- a/Source/core/html/HTMLImageElement.cpp |
+++ b/Source/core/html/HTMLImageElement.cpp |
@@ -51,6 +51,7 @@ |
#include "platform/EventDispatchForbiddenScope.h" |
#include "platform/MIMETypeRegistry.h" |
#include "platform/RuntimeEnabledFeatures.h" |
+#include "platform/weborigin/SecurityPolicy.h" |
namespace blink { |
@@ -385,7 +386,7 @@ Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode* |
// If we have been inserted from a layoutObject-less document, |
// our loader may have not fetched the image, so do it now. |
if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModified) |
- imageLoader().updateFromElement(ImageLoader::UpdateNormal); |
+ imageLoader().updateFromElement(ImageLoader::UpdateNormal, referrerPolicy()); |
return HTMLElement::insertedInto(insertionPoint); |
} |
@@ -660,7 +661,7 @@ float HTMLImageElement::sourceSize(Element& element) |
void HTMLImageElement::forceReload() const |
{ |
- imageLoader().updateFromElement(ImageLoader::UpdateForcedReload); |
+ imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, referrerPolicy()); |
} |
void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior behavior) |
@@ -683,7 +684,7 @@ void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be |
m_listener = ViewportChangeListener::create(this); |
document().mediaQueryMatcher().addViewportListener(m_listener); |
} |
- imageLoader().updateFromElement(behavior); |
+ imageLoader().updateFromElement(behavior, referrerPolicy()); |
if (imageLoader().image() || (imageLoader().hasPendingActivity() && !imageSourceURL().isEmpty())) |
ensurePrimaryContent(); |
@@ -759,4 +760,13 @@ bool HTMLImageElement::isOpaque() const |
return image && image->currentFrameKnownToBeOpaque(); |
} |
+ReferrerPolicy HTMLImageElement::referrerPolicy() const |
+{ |
+ ReferrerPolicy policy = ReferrerPolicyDefault; |
+ if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled() && hasAttribute(referrerpolicyAttr)) { |
+ SecurityPolicy::referrerPolicyFromString(fastGetAttribute(referrerpolicyAttr), &policy); |
+ } |
+ |
+ return policy; |
+} |
Yoav Weiss
2015/08/18 07:22:17
Processing the referrer every time referrerPolicy(
estark
2015/08/18 17:34:26
Done.
|
} |