Bug 1252211 - Remove DOMCI for TreeSelection, XULCommandDispatcher and XULControllers. r=bz.

This commit is contained in:
Peter Van der Beken
2017-05-18 09:07:25 +02:00
parent eec3d86818
commit 82283f3097
17 changed files with 51 additions and 100 deletions

View File

@@ -63,6 +63,8 @@
#include "nsContentUtils.h"
#include "nsJSUtils.h"
#include "nsILoadInfo.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsITreeSelection.h"
// This should be probably defined on some other place... but I couldn't find it
#define WEBAPPS_PERM_NAME "webapps-manage"
@@ -1208,7 +1210,8 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
}
// We give remote-XUL whitelisted domains a free pass here. See bug 932906.
if (!xpc::AllowContentXBLScope(js::GetContextCompartment(cx)))
JSCompartment* contextCompartment = js::GetContextCompartment(cx);
if (!xpc::AllowContentXBLScope(contextCompartment))
{
return NS_OK;
}
@@ -1218,6 +1221,20 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
return NS_OK;
}
// We want to expose nsIDOMXULCommandDispatcher and nsITreeSelection implementations
// in XBL scopes.
if (xpc::IsContentXBLScope(contextCompartment)) {
nsCOMPtr<nsIDOMXULCommandDispatcher> dispatcher = do_QueryInterface(aObj);
if (dispatcher) {
return NS_OK;
}
nsCOMPtr<nsITreeSelection> treeSelection = do_QueryInterface(aObj);
if (treeSelection) {
return NS_OK;
}
}
//-- Access denied, report an error
NS_ConvertUTF8toUTF16 strName("CreateWrapperDenied");
nsAutoCString origin;