Backed out changeset 01abd154ac05 (bug 1137334) for potentially busting m-e10s-dt on a CLOSED TREE

This commit is contained in:
Wes Kocher 2015-02-26 23:17:00 -08:00
parent 3ef8d25b18
commit 4d09a038e1
3 changed files with 38 additions and 1 deletions

View File

@ -2379,6 +2379,31 @@ nsDOMWindowUtils::IsInModalState(bool *retval)
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetParent(JS::Handle<JS::Value> aObject,
JSContext* aCx,
JS::MutableHandle<JS::Value> aParent)
{
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
// First argument must be an object.
if (aObject.isPrimitive()) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
JS::Rooted<JSObject*> parent(aCx, JS_GetParent(&aObject.toObject()));
// Outerize if necessary.
if (parent) {
if (js::ObjectOp outerize = js::GetObjectClass(parent)->ext.outerObject) {
parent = outerize(aCx, parent);
}
}
aParent.setObject(*parent);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
{

View File

@ -50,7 +50,7 @@ interface nsITranslationNodeList;
interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
[scriptable, uuid(6eaf87a1-b252-4c4e-a2fc-318120680335)]
[scriptable, uuid(d0461871-31bd-4da1-b22d-24595c27295c)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1247,6 +1247,14 @@ interface nsIDOMWindowUtils : nsISupports {
in AString aPseudoElement,
in AString aPropertyName);
/**
* Returns the parent of obj.
*
* @param obj The JavaScript object whose parent is to be gotten.
* @return the parent.
*/
[implicit_jscontext] jsval getParent(in jsval obj);
/**
* Get the id of the outer window of this window. This will never throw.
*/

View File

@ -6,6 +6,10 @@
var utils = SpecialPowers.DOMWindowUtils;
ok(utils.getClassName(wrapper) === expected, note);
}
function check_parent(ok, obj, expected, note) {
var utils = SpecialPowers.DOMWindowUtils;
ok(utils.getParent(obj) === expected, note);
}
function run_test(ok, xpcnw, sjow) {
// both wrappers should point to our window: XOW
check_wrapper(ok, ok, "Proxy", "functions are wrapped properly")