summaryrefslogtreecommitdiff
path: root/js/xpconnect/wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'js/xpconnect/wrappers')
-rw-r--r--js/xpconnect/wrappers/AddonWrapper.cpp2
-rw-r--r--js/xpconnect/wrappers/FilteringWrapper.cpp1
-rw-r--r--js/xpconnect/wrappers/WrapperFactory.cpp42
-rw-r--r--js/xpconnect/wrappers/moz.build2
4 files changed, 19 insertions, 28 deletions
diff --git a/js/xpconnect/wrappers/AddonWrapper.cpp b/js/xpconnect/wrappers/AddonWrapper.cpp
index fdab6c248..73420c280 100644
--- a/js/xpconnect/wrappers/AddonWrapper.cpp
+++ b/js/xpconnect/wrappers/AddonWrapper.cpp
@@ -11,6 +11,7 @@
#include "nsIAddonInterposition.h"
#include "xpcprivate.h"
#include "mozilla/dom/BindingUtils.h"
+#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "nsGlobalWindow.h"
#include "GeckoProfiler.h"
@@ -19,6 +20,7 @@
using namespace js;
using namespace JS;
+using namespace mozilla;
namespace xpc {
diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp
index 11f6e556c..0291e9df4 100644
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -12,6 +12,7 @@
using namespace JS;
using namespace js;
+using namespace mozilla;
namespace xpc {
diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp
index fc8c06351..d8f8e4ee1 100644
--- a/js/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/xpconnect/wrappers/WrapperFactory.cpp
@@ -442,40 +442,28 @@ WrapperFactory::Rewrap(JSContext* cx, HandleObject existing, HandleObject obj)
// First, handle the special cases.
//
- // If UniversalXPConnect is enabled, this is just some dumb mochitest. Use
- // a vanilla CCW.
if (xpc::IsUniversalXPConnectEnabled(target)) {
+ // If UniversalXPConnect is enabled, this is just some dumb mochitest. Use
+ // a vanilla CCW.
CrashIfNotInAutomation();
wrapper = &CrossCompartmentWrapper::singleton;
- }
-
- // Let the SpecialPowers scope make its stuff easily accessible to content.
- else if (CompartmentPrivate::Get(origin)->forcePermissiveCOWs) {
+ } else if (CompartmentPrivate::Get(origin)->forcePermissiveCOWs) {
+ // Let the SpecialPowers scope make its stuff easily accessible to content.
CrashIfNotInAutomation();
wrapper = &CrossCompartmentWrapper::singleton;
- }
-
- // Special handling for chrome objects being exposed to content.
- else if (originIsChrome && !targetIsChrome) {
- // If this is a chrome function being exposed to content, we need to allow
- // call (but nothing else). We allow CPOWs that purport to be function's
- // here, but only in the content process.
- if ((IdentifyStandardInstance(obj) == JSProto_Function ||
- (jsipc::IsCPOW(obj) && JS::IsCallable(obj) &&
- XRE_IsContentProcess())))
- {
+ } else if (originIsChrome && !targetIsChrome) {
+ // Special handling for chrome objects being exposed to content.
+ if (IdentifyStandardInstance(obj) == JSProto_Function) {
+ // If this is a chrome function being exposed to content, we need to allow
+ // call (but nothing else).
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper, OpaqueWithCall>::singleton;
- }
-
- // For Vanilla JSObjects exposed from chrome to content, we use a wrapper
- // that supports __exposedProps__. We'd like to get rid of these eventually,
- // but in their current form they don't cause much trouble.
- else if (IdentifyStandardInstance(obj) == JSProto_Object) {
+ } else if (IdentifyStandardInstance(obj) == JSProto_Object) {
+ // For Vanilla JSObjects exposed from chrome to content, we use a wrapper
+ // that supports __exposedProps__. We'd like to get rid of these eventually,
+ // but in their current form they don't cause much trouble.
wrapper = &ChromeObjectWrapper::singleton;
- }
-
- // Otherwise we get an opaque wrapper.
- else {
+ } else {
+ // Otherwise we get an opaque wrapper.
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper, Opaque>::singleton;
}
}
diff --git a/js/xpconnect/wrappers/moz.build b/js/xpconnect/wrappers/moz.build
index 8b70b0e75..21a2c9565 100644
--- a/js/xpconnect/wrappers/moz.build
+++ b/js/xpconnect/wrappers/moz.build
@@ -7,7 +7,7 @@ EXPORTS += [
'WrapperFactory.h',
]
-UNIFIED_SOURCES += [
+SOURCES += [
'AccessCheck.cpp',
'AddonWrapper.cpp',
'ChromeObjectWrapper.cpp',