mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 641342 - Treat chrome DOM objects like DOM objects. r=gal/jst
This commit is contained in:
parent
1c4e7a1190
commit
6f695315f5
@ -73,7 +73,8 @@ UnwrapNW(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (xpc::WrapperFactory::IsXrayWrapper(obj)) {
|
||||
if (xpc::WrapperFactory::IsXrayWrapper(obj) &&
|
||||
!xpc::WrapperFactory::IsPartiallyTransparent(obj)) {
|
||||
return JS_GetProperty(cx, obj, "wrappedJSObject", vp);
|
||||
}
|
||||
|
||||
|
@ -294,8 +294,23 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
wrapper = &FilteringWrapper<JSCrossCompartmentWrapper,
|
||||
ExposedPropertiesOnly>::singleton;
|
||||
|
||||
JSObject *inner = obj;
|
||||
OBJ_TO_INNER_OBJECT(cx, inner);
|
||||
XPCWrappedNative *wn;
|
||||
if (IS_WN_WRAPPER(inner) &&
|
||||
(wn = static_cast<XPCWrappedNative *>(inner->getPrivate()))->HasProto() &&
|
||||
wn->GetProto()->ClassIsDOMObject()) {
|
||||
typedef XrayWrapper<JSCrossCompartmentWrapper> Xray;
|
||||
wrapper = &FilteringWrapper<Xray,
|
||||
CrossOriginAccessiblePropertiesOnly>::singleton;
|
||||
xrayHolder = Xray::createHolder(cx, obj, parent);
|
||||
if (!xrayHolder)
|
||||
return nsnull;
|
||||
} else {
|
||||
wrapper = &FilteringWrapper<JSCrossCompartmentWrapper,
|
||||
ExposedPropertiesOnly>::singleton;
|
||||
}
|
||||
} else if (AccessCheck::isSameOrigin(origin, target)) {
|
||||
// Same origin we use a transparent wrapper, unless the compartment asks
|
||||
// for an Xray or the wrapper needs a SOW.
|
||||
@ -332,7 +347,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO
|
||||
wrapper = &FilteringWrapper<Xray,
|
||||
SameOriginOrCrossOriginAccessiblePropertiesOnly>::singleton;
|
||||
} else {
|
||||
wrapper= &FilteringWrapper<Xray,
|
||||
wrapper = &FilteringWrapper<Xray,
|
||||
CrossOriginAccessiblePropertiesOnly>::singleton;
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,10 @@ XrayWrapper<Base>::resolveOwnProperty(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
{
|
||||
JSPropertyDescriptor *desc = Jsvalify(desc_in);
|
||||
|
||||
if (id == nsXPConnect::GetRuntimeInstance()->GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
|
||||
// Partially transparent wrappers (which used to be known as XOWs) don't
|
||||
// have a .wrappedJSObject property.
|
||||
if (!WrapperFactory::IsPartiallyTransparent(wrapper) &&
|
||||
id == nsXPConnect::GetRuntimeInstance()->GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
|
||||
bool status;
|
||||
JSWrapper::Action action = set ? JSWrapper::SET : JSWrapper::GET;
|
||||
desc->obj = NULL; // default value
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
// Run the test in a separate window so we get a clean browser window.
|
||||
window.open("data:text/html,<html style='overflow:scroll'><script>opener.doTest(window);</script>",
|
||||
"", "scrollbars=yes,toolbar,menubar,width=500,height=500");
|
||||
"", "scrollbars=yes,toolbar,menubar,width=500,height=500,chrome");
|
||||
|
||||
function doTest(win) {
|
||||
var initialCount = win.mozPaintCount;
|
||||
|
@ -67,7 +67,7 @@ function getTabModalPromptBox(domWin) {
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.chromeEventHandler.ownerDocument.defaultView;
|
||||
return chromeWin;
|
||||
return XPCNativeWrapper.unwrap(chromeWin);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -76,7 +76,7 @@ function getTabModalPromptBox(domWin) {
|
||||
|
||||
// Get the chrome window for the content window we're using.
|
||||
// (Unwrap because we need a non-IDL property below.)
|
||||
var chromeWin = getChromeWindow(promptWin).wrappedJSObject;
|
||||
var chromeWin = getChromeWindow(promptWin);
|
||||
|
||||
if (chromeWin.getTabModalPromptBox)
|
||||
promptBox = chromeWin.getTabModalPromptBox(promptWin);
|
||||
|
Loading…
Reference in New Issue
Block a user