Bug 1409992 - Allow SVG as images to load data: URL images. r=edgar

MozReview-Commit-ID: KMirRmkLBVa
This commit is contained in:
Cameron McCormack
2017-10-19 18:00:43 +08:00
parent 71650b12f1
commit 315649971e
6 changed files with 55 additions and 5 deletions

View File

@@ -431,7 +431,7 @@ HTMLImageElement::AfterMaybeChangeAttr(int32_t aNamespaceID, nsAtom* aName,
mSrcTriggeringPrincipal);
}
QueueImageLoadTask(true);
} else if (aNotify && OwnerDoc()->IsCurrentActiveDocument()) {
} else if (aNotify && OwnerDoc()->ShouldLoadImages()) {
// If aNotify is false, we are coming from the parser or some such place;
// we'll get bound after all the attributes have been set, so we'll do the
// sync image load from BindToTree. Skip the LoadImage call in that case.
@@ -491,7 +491,7 @@ HTMLImageElement::AfterMaybeChangeAttr(int32_t aNamespaceID, nsAtom* aName,
// per spec, full selection runs when this changes, even though
// it doesn't directly affect the source selection
QueueImageLoadTask(true);
} else if (OwnerDoc()->IsCurrentActiveDocument()) {
} else if (OwnerDoc()->ShouldLoadImages()) {
// Bug 1076583 - We still use the older synchronous algorithm in
// non-responsive mode. Force a new load of the image with the
// new cross origin policy
@@ -608,7 +608,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// Otherwise MaybeLoadImage may run later when someone has reenabled
// loading.
if (LoadingEnabled() &&
OwnerDoc()->IsCurrentActiveDocument()) {
OwnerDoc()->ShouldLoadImages()) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod<bool>("dom::HTMLImageElement::MaybeLoadImage",
this,
@@ -830,7 +830,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
// reaches a stable state.
if (!dest->InResponsiveMode() &&
dest->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
dest->OwnerDoc()->IsCurrentActiveDocument()) {
dest->OwnerDoc()->ShouldLoadImages()) {
// Mark channel as urgent-start before load image if the image load is
// initaiated by a user interaction.
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
@@ -911,7 +911,7 @@ HTMLImageElement::QueueImageLoadTask(bool aAlwaysLoad)
{
// If loading is temporarily disabled, we don't want to queue tasks
// that may then run when loading is re-enabled.
if (!LoadingEnabled() || !this->OwnerDoc()->IsCurrentActiveDocument()) {
if (!LoadingEnabled() || !this->OwnerDoc()->ShouldLoadImages()) {
return;
}