Backout changeset c77acb256aec for failing to work.

This commit is contained in:
Ms2ger 2012-08-11 18:12:54 +02:00
Родитель 1e1c24cbce
Коммит 0ec3bd25cf
3 изменённых файлов: 46 добавлений и 12 удалений

Просмотреть файл

@ -1821,6 +1821,7 @@ jsid nsDOMClassInfo::sParent_id = JSID_VOID;
jsid nsDOMClassInfo::sScrollbars_id = JSID_VOID;
jsid nsDOMClassInfo::sLocation_id = JSID_VOID;
jsid nsDOMClassInfo::sConstructor_id = JSID_VOID;
jsid nsDOMClassInfo::s_content_id = JSID_VOID;
jsid nsDOMClassInfo::sContent_id = JSID_VOID;
jsid nsDOMClassInfo::sMenubar_id = JSID_VOID;
jsid nsDOMClassInfo::sToolbar_id = JSID_VOID;
@ -2097,6 +2098,7 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
SET_JSID_TO_STRING(sScrollbars_id, cx, "scrollbars");
SET_JSID_TO_STRING(sLocation_id, cx, "location");
SET_JSID_TO_STRING(sConstructor_id, cx, "constructor");
SET_JSID_TO_STRING(s_content_id, cx, "_content");
SET_JSID_TO_STRING(sContent_id, cx, "content");
SET_JSID_TO_STRING(sMenubar_id, cx, "menubar");
SET_JSID_TO_STRING(sToolbar_id, cx, "toolbar");
@ -5212,6 +5214,7 @@ nsDOMClassInfo::ShutDown()
sScrollbars_id = JSID_VOID;
sLocation_id = JSID_VOID;
sConstructor_id = JSID_VOID;
s_content_id = JSID_VOID;
sContent_id = JSID_VOID;
sMenubar_id = JSID_VOID;
sToolbar_id = JSID_VOID;
@ -6949,6 +6952,18 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
return rv;
}
// Native code for window._content getter, this simply maps
// window._content to window.content for backwards compatibility only.
static JSBool
ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
if (!obj)
return JS_FALSE;
return ::JS_GetProperty(cx, obj, "content", vp);
}
static JSNewResolveOp sOtherResolveFuncs[] = {
mozilla::dom::workers::ResolveWorkerClasses
};
@ -7280,6 +7295,36 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
}
if (s_content_id == id) {
// Map window._content to window.content for backwards
// compatibility, this should spit out an message on the JS
// console.
JSObject *windowObj = win->GetGlobalJSObject();
JSAutoRequest ar(cx);
JSFunction *fun = ::JS_NewFunction(cx, ContentWindowGetter, 0, 0,
windowObj, "_content");
if (!fun) {
return NS_ERROR_OUT_OF_MEMORY;
}
JSObject *funObj = ::JS_GetFunctionObject(fun);
if (!::JS_DefinePropertyById(cx, windowObj, id, JSVAL_VOID,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funObj),
nullptr,
JSPROP_ENUMERATE | JSPROP_GETTER |
JSPROP_SHARED)) {
return NS_ERROR_FAILURE;
}
*objp = obj;
return NS_OK;
}
if (flags & JSRESOLVE_ASSIGNING) {
if (IsReadonlyReplaceable(id) ||
(!(flags & JSRESOLVE_QUALIFIED) && IsWritableReplaceable(id))) {

Просмотреть файл

@ -3085,14 +3085,6 @@ nsGlobalWindow::GetTopImpl(nsIDOMWindow** aTop, bool aScriptable)
return NS_OK;
}
// Map window._content to window.content for backwards compatibility, this
// should spit out an message on the JS console.
NS_IMETHODIMP
nsGlobalWindow::GetContentForCompat(nsIDOMWindow** aContent)
{
return GetContent(aContent);
}
NS_IMETHODIMP
nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
{

Просмотреть файл

@ -5,7 +5,7 @@
#include "domstubs.idl"
[scriptable, uuid(1f4da4d4-1d72-4709-8207-3665dbaac4b4)]
[scriptable, uuid(6652c4d2-6b49-424b-aaf9-91f91006fab7)]
interface nsIDOMJSWindow : nsISupports
{
void dump(in DOMString str);
@ -76,7 +76,4 @@ interface nsIDOMJSWindow : nsISupports
* This property is "replaceable" in JavaScript.
*/
readonly attribute nsIDOMWindow frames;
[binaryname(ContentForCompat)]
readonly attribute nsIDOMWindow _content;
};