Bug 1359833 - Part 8. ScriptedNotificationObserver should use nsAutoScriptBlocker when issuing notifications. r=tnikkel

This commit is contained in:
Andrew Osmond 2017-07-19 14:15:12 -04:00
Родитель 8a1d7d4bf1
Коммит 3f2ef119ba
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -7,6 +7,7 @@
#include "ScriptedNotificationObserver.h" #include "ScriptedNotificationObserver.h"
#include "imgIScriptedNotificationObserver.h" #include "imgIScriptedNotificationObserver.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsContentUtils.h" // for nsAutoScriptBlocker
namespace mozilla { namespace mozilla {
namespace image { namespace image {
@ -31,6 +32,13 @@ ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
int32_t aType, int32_t aType,
const nsIntRect* /*aUnused*/) const nsIntRect* /*aUnused*/)
{ {
// For now, we block (other) scripts from running to preserve the historical
// behavior from when ScriptedNotificationObserver::Notify was called as part
// of the observers list in nsImageLoadingContent::Notify. Now each
// ScriptedNotificationObserver has its own imgRequestProxy and thus gets
// Notify called directly by imagelib.
nsAutoScriptBlocker scriptBlocker;
if (aType == imgINotificationObserver::SIZE_AVAILABLE) { if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
return mInner->SizeAvailable(aRequest); return mInner->SizeAvailable(aRequest);
} }