Bug 1539884 - Part 24: Mark nsIContentViewer::pageHide as can_run_script r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D134388
This commit is contained in:
Kagami Sascha Rosylight 2021-12-23 16:27:21 +00:00
parent a34e15c597
commit b35db1ba18
3 changed files with 9 additions and 6 deletions

View File

@ -958,11 +958,13 @@ class nsDocShell final : public nsDocLoader,
// If aSkipCheckingDynEntries is true, it will not try to remove dynamic
// subframe entries. This is to avoid redundant RemoveDynEntries calls in all
// children docshells.
void FirePageHideNotificationInternal(bool aIsUnload,
bool aSkipCheckingDynEntries);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY void FirePageHideNotificationInternal(
bool aIsUnload, bool aSkipCheckingDynEntries);
void ThawFreezeNonRecursive(bool aThaw);
void FirePageHideShowNonRecursive(bool aShow);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY void FirePageHideShowNonRecursive(bool aShow);
nsresult Dispatch(mozilla::TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable);

View File

@ -113,7 +113,7 @@ interface nsIContentViewer : nsISupports
*/
readonly attribute boolean beforeUnloadFiring;
void pageHide(in boolean isUnload);
[can_run_script] void pageHide(in boolean isUnload);
/**
* All users of a content viewer are responsible for calling both

View File

@ -1400,7 +1400,7 @@ nsDocumentViewer::PageHide(bool aIsUnload) {
NS_ENSURE_STATE(mDocument);
// First, get the window from the document...
nsPIDOMWindowOuter* window = mDocument->GetWindow();
RefPtr<nsPIDOMWindowOuter> window = mDocument->GetWindow();
if (!window) {
// Fail if no window is available...
@ -1427,7 +1427,8 @@ nsDocumentViewer::PageHide(bool aIsUnload) {
Document::PageUnloadingEventTimeStamp timestamp(mDocument);
EventDispatcher::Dispatch(window, mPresContext, &event, nullptr, &status);
RefPtr<nsPresContext> presContext = mPresContext;
EventDispatcher::Dispatch(window, presContext, &event, nullptr, &status);
}
// look for open menupopups and close them after the unload event, in case