Bug 1310885 - Part 4. (gecko) Allow ImageValue::Intialize be called more then once, but only LoadImage in the first call. r=haycam

MozReview-Commit-ID: IjL2e2LIy0f

--HG--
extra : rebase_source : 7ba6688ca3ca09f30909014ecc45f182b47a3e69
extra : source : 11fbcc3d133ed19e658c297aaf07d9c96280650c
This commit is contained in:
cku 2017-05-04 16:49:30 +08:00
Родитель bbbef1e5fb
Коммит dce4536c2f
2 изменённых файлов: 7 добавлений и 12 удалений

Просмотреть файл

@ -3043,7 +3043,6 @@ void
css::ImageValue::Initialize(nsIDocument* aDocument) css::ImageValue::Initialize(nsIDocument* aDocument)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mInitialized);
// NB: If aDocument is not the original document, we may not be able to load // NB: If aDocument is not the original document, we may not be able to load
// images from aDocument. Instead we do the image load from the original doc // images from aDocument. Instead we do the image load from the original doc
@ -3053,17 +3052,15 @@ css::ImageValue::Initialize(nsIDocument* aDocument)
loadingDoc = aDocument; loadingDoc = aDocument;
} }
loadingDoc->StyleImageLoader()->LoadImage(GetURI(), if (!mLoadedImage) {
mExtraData->GetPrincipal(), loadingDoc->StyleImageLoader()->LoadImage(GetURI(),
mExtraData->GetReferrer(), this); mExtraData->GetPrincipal(),
mExtraData->GetReferrer(), this);
if (loadingDoc != aDocument) { mLoadedImage = true;
aDocument->StyleImageLoader()->MaybeRegisterCSSImage(this);
} }
#ifdef DEBUG aDocument->StyleImageLoader()->MaybeRegisterCSSImage(this);
mInitialized = true;
#endif
} }
css::ImageValue::~ImageValue() css::ImageValue::~ImageValue()

Просмотреть файл

@ -230,9 +230,7 @@ public:
nsRefPtrHashtable<nsPtrHashKey<nsIDocument>, imgRequestProxy> mRequests; nsRefPtrHashtable<nsPtrHashKey<nsIDocument>, imgRequestProxy> mRequests;
private: private:
#ifdef DEBUG bool mLoadedImage = false;
bool mInitialized = false;
#endif
}; };
struct GridNamedArea { struct GridNamedArea {