mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 760109 - Introduce an explicit ChromeObjectWrapper. r=mrbkap
For now it's identical to ChromeObjectWrapperBase. Custom behavior comes in the next patch.
This commit is contained in:
parent
bc2fe5e629
commit
27dfe5daed
@ -5,6 +5,9 @@
|
||||
* 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 __AccessCheck_h__
|
||||
#define __AccessCheck_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jswrapper.h"
|
||||
#include "WrapperFactory.h"
|
||||
@ -149,3 +152,5 @@ struct ComponentsObjectPolicy : public Policy {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __AccessCheck_h__ */
|
||||
|
7
js/xpconnect/wrappers/ChromeObjectWrapper.cpp
Normal file
7
js/xpconnect/wrappers/ChromeObjectWrapper.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "ChromeObjectWrapper.h"
|
||||
|
||||
namespace xpc {
|
||||
|
||||
ChromeObjectWrapper ChromeObjectWrapper::singleton;
|
||||
|
||||
}
|
34
js/xpconnect/wrappers/ChromeObjectWrapper.h
Normal file
34
js/xpconnect/wrappers/ChromeObjectWrapper.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=4 sw=4 et tw=99 ft=cpp:
|
||||
*
|
||||
* 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 __ChromeObjectWrapper_h__
|
||||
#define __ChromeObjectWrapper_h__
|
||||
|
||||
#include "FilteringWrapper.h"
|
||||
#include "AccessCheck.h"
|
||||
|
||||
namespace xpc {
|
||||
|
||||
// When chrome JS objects are exposed to content, they get a ChromeObjectWrapper.
|
||||
//
|
||||
// The base filtering wrapper here does most of the work for us. We define a
|
||||
// custom class here to introduce custom behavior with respect to the prototype
|
||||
// chain.
|
||||
#define ChromeObjectWrapperBase \
|
||||
FilteringWrapper<js::CrossCompartmentSecurityWrapper, ExposedPropertiesOnly>
|
||||
|
||||
class ChromeObjectWrapper : public ChromeObjectWrapperBase
|
||||
{
|
||||
public:
|
||||
ChromeObjectWrapper() : ChromeObjectWrapperBase(0) {};
|
||||
|
||||
static ChromeObjectWrapper singleton;
|
||||
};
|
||||
|
||||
} /* namespace xpc */
|
||||
|
||||
#endif /* __ChromeObjectWrapper_h__ */
|
@ -7,6 +7,7 @@
|
||||
#include "FilteringWrapper.h"
|
||||
#include "AccessCheck.h"
|
||||
#include "WaiveXrayWrapper.h"
|
||||
#include "ChromeObjectWrapper.h"
|
||||
#include "XrayWrapper.h"
|
||||
#include "WrapperFactory.h"
|
||||
|
||||
@ -104,7 +105,6 @@ FilteringWrapper<Base, Policy>::enter(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
|
||||
#define SOW FilteringWrapper<CrossCompartmentSecurityWrapper, OnlyIfSubjectIsSystem>
|
||||
#define SCSOW FilteringWrapper<SameCompartmentSecurityWrapper, OnlyIfSubjectIsSystem>
|
||||
#define COW FilteringWrapper<CrossCompartmentSecurityWrapper, ExposedPropertiesOnly>
|
||||
#define XOW FilteringWrapper<XrayWrapper<CrossCompartmentSecurityWrapper>, \
|
||||
CrossOriginAccessiblePropertiesOnly>
|
||||
#define PXOW FilteringWrapper<XrayProxy, \
|
||||
@ -125,7 +125,6 @@ template<> SOW SOW::singleton(WrapperFactory::SCRIPT_ACCESS_ONLY_FLAG |
|
||||
WrapperFactory::SOW_FLAG);
|
||||
template<> SCSOW SCSOW::singleton(WrapperFactory::SCRIPT_ACCESS_ONLY_FLAG |
|
||||
WrapperFactory::SOW_FLAG);
|
||||
template<> COW COW::singleton(0);
|
||||
template<> XOW XOW::singleton(WrapperFactory::SCRIPT_ACCESS_ONLY_FLAG |
|
||||
WrapperFactory::PARTIALLY_TRANSPARENT);
|
||||
template<> PXOW PXOW::singleton(WrapperFactory::SCRIPT_ACCESS_ONLY_FLAG |
|
||||
@ -141,12 +140,11 @@ template<> CW CW::singleton(0);
|
||||
template<> XCW XCW::singleton(0);
|
||||
|
||||
template class SOW;
|
||||
template class COW;
|
||||
template class XOW;
|
||||
template class PXOW;
|
||||
template class DXOW;
|
||||
template class NNXOW;
|
||||
template class LW;
|
||||
template class XLW;
|
||||
|
||||
template class ChromeObjectWrapperBase;
|
||||
}
|
||||
|
@ -5,6 +5,9 @@
|
||||
* 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 __FilteringWrapper_h__
|
||||
#define __FilteringWrapper_h__
|
||||
|
||||
#include <jsapi.h>
|
||||
#include <jswrapper.h>
|
||||
|
||||
@ -27,3 +30,5 @@ class FilteringWrapper : public Base {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __FilteringWrapper_h__ */
|
||||
|
@ -14,11 +14,14 @@ LIBRARY_NAME = xpcwrappers_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
CPPSRCS = AccessCheck.cpp \
|
||||
WaiveXrayWrapper.cpp \
|
||||
FilteringWrapper.cpp \
|
||||
XrayWrapper.cpp \
|
||||
WrapperFactory.cpp
|
||||
CPPSRCS = \
|
||||
AccessCheck.cpp \
|
||||
WaiveXrayWrapper.cpp \
|
||||
FilteringWrapper.cpp \
|
||||
ChromeObjectWrapper.cpp \
|
||||
XrayWrapper.cpp \
|
||||
WrapperFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../src \
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "XrayWrapper.h"
|
||||
#include "AccessCheck.h"
|
||||
#include "XPCWrapper.h"
|
||||
#include "ChromeObjectWrapper.h"
|
||||
|
||||
#include "xpcprivate.h"
|
||||
#include "dombindings.h"
|
||||
@ -383,8 +384,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO
|
||||
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper,
|
||||
ComponentsObjectPolicy>::singleton;
|
||||
} else {
|
||||
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper,
|
||||
ExposedPropertiesOnly>::singleton;
|
||||
wrapper = &ChromeObjectWrapper::singleton;
|
||||
|
||||
// If the prototype of the chrome object being wrapped is a prototype
|
||||
// for a standard class, use the one from the content compartment so
|
||||
|
Loading…
Reference in New Issue
Block a user