зеркало из https://github.com/mozilla/pjs.git
Fix for bug 604362 (Don't rewrap XPCWrappedNatives that don't have classinfo). r=mrbkap.
This commit is contained in:
Родитель
c48781685e
Коммит
d840d4875b
|
@ -0,0 +1,12 @@
|
||||||
|
function run_test() {
|
||||||
|
var Cc = Components.classes;
|
||||||
|
var Ci = Components.interfaces;
|
||||||
|
var sp = Cc["@mozilla.org/systemprincipal;1"].
|
||||||
|
createInstance(Ci.nsIPrincipal);
|
||||||
|
var s = Components.utils.Sandbox(sp);
|
||||||
|
s.a = [];
|
||||||
|
s.Cu = Components.utils;
|
||||||
|
s.C = Components;
|
||||||
|
s.do_check_neq = do_check_neq;
|
||||||
|
Components.utils.evalInSandbox("do_check_neq(Cu.import, undefined);", s);
|
||||||
|
}
|
|
@ -108,6 +108,11 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, JSObject *scope, JSObject *obj
|
||||||
|
|
||||||
XPCWrappedNative *wn = static_cast<XPCWrappedNative *>(xpc_GetJSPrivate(obj));
|
XPCWrappedNative *wn = static_cast<XPCWrappedNative *>(xpc_GetJSPrivate(obj));
|
||||||
|
|
||||||
|
// If the object doesn't have classinfo we want to return the same
|
||||||
|
// XPCWrappedNative so that we keep the same set of interfaces.
|
||||||
|
if (!wn->GetClassInfo())
|
||||||
|
return DoubleWrap(cx, obj, flags);
|
||||||
|
|
||||||
// We know that DOM objects only allow one object, we can return early.
|
// We know that DOM objects only allow one object, we can return early.
|
||||||
if (wn->HasProto() && wn->GetProto()->ClassIsDOMObject())
|
if (wn->HasProto() && wn->GetProto()->ClassIsDOMObject())
|
||||||
return DoubleWrap(cx, obj, flags);
|
return DoubleWrap(cx, obj, flags);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче