mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1050340 - Do a CheckedUnwrap in xpc::IsReflector. r=gabor
This matches the behavior of UnwrapReflectorToISupports, and makes all of the structured clone callbacks scattered throughout Gecko compatible with wrappers that have not already had CheckedUnwrap invoked on them.
This commit is contained in:
parent
8995a85ada
commit
d9deab8699
@ -26,6 +26,9 @@ namespace xpc {
|
||||
bool
|
||||
IsReflector(JSObject *obj)
|
||||
{
|
||||
obj = CheckedUnwrap(obj, /* stopAtOuter = */ false);
|
||||
if (!obj)
|
||||
return false;
|
||||
return IS_WN_REFLECTOR(obj) || dom::IsDOMObject(obj);
|
||||
}
|
||||
|
||||
@ -117,15 +120,11 @@ bool IsBlobOrFileList(JSObject *obj)
|
||||
|
||||
static bool
|
||||
StackScopedCloneWrite(JSContext *cx, JSStructuredCloneWriter *writer,
|
||||
Handle<JSObject *> objArg, void *closure)
|
||||
Handle<JSObject *> obj, void *closure)
|
||||
{
|
||||
MOZ_ASSERT(closure, "Null pointer!");
|
||||
StackScopedCloneData *cloneData = static_cast<StackScopedCloneData *>(closure);
|
||||
|
||||
// The SpiderMonkey structured clone machinery does a CheckedUnwrap, but
|
||||
// doesn't strip off outer windows. Do that to avoid confusing the reflector
|
||||
// detection.
|
||||
RootedObject obj(cx, JS_ObjectToInnerObject(cx, objArg));
|
||||
if ((cloneData->mOptions->wrapReflectors && IsReflector(obj)) ||
|
||||
IsBlobOrFileList(obj))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user