Bug 1324642. Move assert from bug 1323207 from nsImageLoadingContent::Notify to ScriptedNotificationObserver. r=continuation

nsImageLoadingContent::Notify is where all image notifications for things like <img> elements go through. The vast majority being implemented in C++. Any image observers implemented in JS must go through ScriptedNotificationObserver.

We only use ScriptedNotificationObserver in tests. The addon repository only has six hits, and four of them seem to be different versions of the same addon. And they don't seem to be among the more popular addons.

The original location of the assert only caught some images anyway. Things like CSS background images don't go through nsImageLoadingContent. ProgressTracker is the origin of all image notifications.
This commit is contained in:
Timothy Nikkel
2016-12-20 13:49:31 -06:00
parent 801208d84e
commit 7b03c0d788
2 changed files with 3 additions and 4 deletions

View File

@@ -44,7 +44,6 @@
#include "mozAutoDocUpdate.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/EventStates.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ImageTracker.h"
@@ -149,9 +148,6 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
}
{
MOZ_RELEASE_ASSERT(js::AllowGCBarriers(CycleCollectedJSContext::Get()->Context()),
"ImageObservers can be implement in JS, so they should not be called during painting. See bug 1311841");
nsAutoScriptBlocker scriptBlocker;
for (ImageObserver* observer = &mObserverList, *next; observer;

View File

@@ -31,6 +31,9 @@ ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
int32_t aType,
const nsIntRect* /*aUnused*/)
{
MOZ_RELEASE_ASSERT(js::AllowGCBarriers(CycleCollectedJSContext::Get()->Context()),
"sending image notification to JS observer during painting. See bug 1311841");
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
return mInner->SizeAvailable(aRequest);
}