From aa90d7dcb63e7833a7e4406f5389fc3880bb2ace Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Fri, 6 Jan 2017 13:57:26 -0800 Subject: [PATCH] Bug 1328423 - Add AutoAssertNoContentJS to PresShell::Paint (r=dvander) MozReview-Commit-ID: 4M4pYZSygPH --- layout/base/PresShell.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 297b5ee3baada..469708440e8ca 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -168,6 +168,7 @@ #include "LayerTreeInvalidation.h" #include "mozilla/css/ImageLoader.h" #include "mozilla/dom/DocumentTimeline.h" +#include "mozilla/dom/ScriptSettings.h" #include "mozilla/Preferences.h" #include "mozilla/Telemetry.h" #include "nsCanvasFrame.h" @@ -6239,6 +6240,13 @@ PresShell::Paint(nsView* aViewToPaint, PROFILER_LABEL("PresShell", "Paint", js::ProfileEntry::Category::GRAPHICS); + Maybe nojs; + if (!(aFlags & nsIPresShell::PAINT_COMPOSITE)) { + // We need to allow content JS when the flag is set since we may trigger + // MozAfterPaint events in content in those cases. + nojs.emplace(dom::danger::GetJSContext()); + } + NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell"); NS_ASSERTION(aViewToPaint, "null view");