diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 7a197654ac08..1301cb689e43 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -583,7 +583,6 @@ bool nsDOMClassInfo::sIsInitialized = false; jsid nsDOMClassInfo::sLocation_id = JSID_VOID; jsid nsDOMClassInfo::sConstructor_id = JSID_VOID; -jsid nsDOMClassInfo::s_content_id = JSID_VOID; jsid nsDOMClassInfo::sLength_id = JSID_VOID; jsid nsDOMClassInfo::sItem_id = JSID_VOID; jsid nsDOMClassInfo::sNamedItem_id = JSID_VOID; @@ -716,7 +715,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx) 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(sLength_id, cx, "length"); SET_JSID_TO_STRING(sItem_id, cx, "item"); SET_JSID_TO_STRING(sNamedItem_id, cx, "namedItem"); @@ -1965,7 +1963,6 @@ nsDOMClassInfo::ShutDown() sLocation_id = JSID_VOID; sConstructor_id = JSID_VOID; - s_content_id = JSID_VOID; sLength_id = JSID_VOID; sItem_id = JSID_VOID; sEnumerate_id = JSID_VOID; @@ -3256,21 +3253,6 @@ 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 bool -ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp) -{ - JSObject *obj = JS_THIS_OBJECT(cx, vp); - if (!obj) - return false; - - JS::Rooted value(cx); - bool result = ::JS_GetProperty(cx, obj, "content", &value); - *vp = value; - return result; -} - template static nsresult LocationSetterGuts(JSContext *cx, JSObject *obj, JS::MutableHandle vp) @@ -3577,35 +3559,6 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, return NS_OK; } - // NB: By accident, we previously didn't support this over Xrays. This is a - // deprecated non-standard feature, so there's no reason to start doing so - // now. - if ((s_content_id == id) && !xpc::WrapperFactory::IsXrayWrapper(obj)) { - // Map window._content to window.content for backwards - // compatibility, this should spit out an message on the JS - // console. - JS::Rooted funObj(cx); - JSFunction *fun = ::JS_NewFunction(cx, ContentWindowGetter, 0, 0, - obj, "_content"); - if (!fun) { - return NS_ERROR_OUT_OF_MEMORY; - } - funObj = ::JS_GetFunctionObject(fun); - - if (!JS_WrapObject(cx, &funObj) || - !JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, - JS_DATA_TO_FUNC_PTR(JSPropertyOp, funObj.get()), - JS_StrictPropertyStub, - JSPROP_ENUMERATE | JSPROP_GETTER | - JSPROP_SHARED)) { - return NS_ERROR_FAILURE; - } - - *objp = obj; - - return NS_OK; - } - if (!(flags & JSRESOLVE_ASSIGNING) && sDocument_id == id) { nsCOMPtr document = win->GetDoc(); JS::Rooted v(cx); diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index 10cf6f4ecf4b..a242522515e9 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -165,7 +165,6 @@ protected: public: static jsid sLocation_id; static jsid sConstructor_id; - static jsid s_content_id; static jsid sLength_id; static jsid sItem_id; static jsid sNamedItem_id; diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 68b6b911ecf7..524bbba79674 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -944,6 +944,10 @@ public: const mozilla::dom::Sequence& aExtraArgument, mozilla::ErrorResult& aError); JSObject* GetContent(JSContext* aCx, mozilla::ErrorResult& aError); + JSObject* Get_content(JSContext* aCx, mozilla::ErrorResult& aError) + { + return GetContent(aCx, aError); + } protected: // Array of idle observers that are notified of idle events. diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index a1283c7b436f..9498db070a2e 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -315,7 +315,7 @@ class IDLUnresolvedIdentifier(IDLObject): assert len(name) > 0 - if name[:2] == "__" and not allowDoubleUnderscore: + if name[:2] == "__" and name != "__content" and not allowDoubleUnderscore: raise WebIDLError("Identifiers beginning with __ are reserved", [location]) if name[0] == '_' and not allowDoubleUnderscore: diff --git a/dom/interfaces/base/nsIDOMChromeWindow.idl b/dom/interfaces/base/nsIDOMChromeWindow.idl index 63d4601f4318..4c4561743e38 100644 --- a/dom/interfaces/base/nsIDOMChromeWindow.idl +++ b/dom/interfaces/base/nsIDOMChromeWindow.idl @@ -10,7 +10,7 @@ interface nsIDOMElement; interface nsIDOMEvent; interface nsIMessageBroadcaster; -[scriptable, uuid(6ff5df67-22da-4379-bf57-da775dad19f8)] +[scriptable, uuid(0c10226f-8abb-4345-aa6b-2780a6f4687e)] interface nsIDOMChromeWindow : nsISupports { const unsigned short STATE_MAXIMIZED = 1; diff --git a/dom/tests/browser/browser.ini b/dom/tests/browser/browser.ini index eeb8c7fe9a02..a4eb93bf0b6f 100644 --- a/dom/tests/browser/browser.ini +++ b/dom/tests/browser/browser.ini @@ -6,6 +6,7 @@ support-files = page_privatestorageevent.html test-console-api.html +[browser_test__content.js] [browser_ConsoleAPITests.js] [browser_ConsoleStorageAPITests.js] [browser_ConsoleStoragePBTest_perwindowpb.js] diff --git a/dom/tests/browser/browser_test__content.js b/dom/tests/browser/browser_test__content.js new file mode 100644 index 000000000000..b06233527683 --- /dev/null +++ b/dom/tests/browser/browser_test__content.js @@ -0,0 +1,4 @@ +function test() { + is(window._content, window.content, + "_content needs to work, since extensions use it"); +} diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini index 15050b6122a1..7732c59b9111 100644 --- a/dom/tests/mochitest/general/mochitest.ini +++ b/dom/tests/mochitest/general/mochitest.ini @@ -13,7 +13,6 @@ support-files = historyframes.html [test_497898.html] -[test__content.html] [test_bug504220.html] [test_bug628069_1.html] [test_bug628069_2.html] diff --git a/dom/tests/mochitest/general/test__content.html b/dom/tests/mochitest/general/test__content.html deleted file mode 100644 index 85bf6830fa96..000000000000 --- a/dom/tests/mochitest/general/test__content.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Test for Bug 863390 - - - - - -Mozilla Bug 863390 -

-
- - -
-
-
-
-
diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl
index 7007111b2b0d..407adf18ae2e 100644
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -336,6 +336,8 @@ partial interface Window {
                                                any... extraArguments);
 
   [Replaceable, Throws] readonly attribute object? content;
+
+  [ChromeOnly, Throws] readonly attribute object? __content;
 };
 
 Window implements TouchEventHandlers;