gecko/dom/plugins/base/nsPluginSafety.h
Robert O'Callahan e170f559fb Bug 829557. Part 1: When calling into plugin code, identify situations where it is safe (or unsafe) to reenter Gecko from plugin code. r=bsmedberg
When Gecko is reentered from unsafe call sites, we allow the reentry, but we
suppress execution of the refresh driver to minimize the danger.
In this patch, we treat all sites as unsafe.

--HG--
rename : toolkit/modules/Timer.jsm => browser/devtools/shared/Browser.jsm
rename : toolkit/modules/tests/xpcshell/test_timer.js => browser/devtools/shared/test/browser_browser_basic.js
rename : build/mach_bootstrap.py => mach
extra : rebase_source : b83c1d09313bff62357eaa931eced0f72f838493
2013-02-28 00:50:27 +13:00

43 lines
1.6 KiB
C

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPluginSafety_h_
#define nsPluginSafety_h_
#include <prinrval.h>
enum NSPluginCallReentry;
// On Android, we need to guard against plugin code leaking entries in the local
// JNI ref table. See https://bugzilla.mozilla.org/show_bug.cgi?id=780831#c21
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#define MAIN_THREAD_JNI_REF_GUARD mozilla::AutoLocalJNIFrame jniFrame
#else
#define MAIN_THREAD_JNI_REF_GUARD
#endif
PRIntervalTime NS_NotifyBeginPluginCall(NSPluginCallReentry aReentryState);
void NS_NotifyPluginCall(PRIntervalTime aTime, NSPluginCallReentry aReentryState);
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, pluginInst, pluginCallReentry) \
PR_BEGIN_MACRO \
MAIN_THREAD_JNI_REF_GUARD; \
PRIntervalTime startTime = NS_NotifyBeginPluginCall(pluginCallReentry); \
ret = fun; \
NS_NotifyPluginCall(startTime, pluginCallReentry); \
PR_END_MACRO
#define NS_TRY_SAFE_CALL_VOID(fun, pluginInst, pluginCallReentry) \
PR_BEGIN_MACRO \
MAIN_THREAD_JNI_REF_GUARD; \
PRIntervalTime startTime = NS_NotifyBeginPluginCall(pluginCallReentry); \
fun; \
NS_NotifyPluginCall(startTime, pluginCallReentry); \
PR_END_MACRO
#endif //nsPluginSafety_h_